|
@@ -13,12 +13,12 @@ def get_account_invoice_line_widget():
|
|
invoice.date_invoice,
|
|
invoice.date_invoice,
|
|
invoice.type,
|
|
invoice.type,
|
|
product.name_template,
|
|
product.name_template,
|
|
- line.medic_id,
|
|
|
|
line.price_unit * (%s / (array_agg(rate.rate ORDER BY rate.id DESC))[1]) as price_unit,
|
|
line.price_unit * (%s / (array_agg(rate.rate ORDER BY rate.id DESC))[1]) as price_unit,
|
|
line.quantity AS cant,
|
|
line.quantity AS cant,
|
|
line.price_subtotal * (%s / (array_agg(rate.rate ORDER BY rate.id DESC))[1]) AS subtotal,
|
|
line.price_subtotal * (%s / (array_agg(rate.rate ORDER BY rate.id DESC))[1]) AS subtotal,
|
|
(line.quantity * (line.price_unit * (%s / (array_agg(rate.rate ORDER BY rate.id DESC))[1]))) - (line.price_subtotal * (%s / (array_agg(rate.rate ORDER BY rate.id DESC))[1])) AS impuestos,
|
|
(line.quantity * (line.price_unit * (%s / (array_agg(rate.rate ORDER BY rate.id DESC))[1]))) - (line.price_subtotal * (%s / (array_agg(rate.rate ORDER BY rate.id DESC))[1])) AS impuestos,
|
|
- (array_agg(history.cost ORDER BY history.id DESC))[1] AS cost
|
|
|
|
|
|
+ (array_agg(history.cost ORDER BY history.id DESC))[1] AS cost,
|
|
|
|
+ line.medic_id
|
|
FROM account_invoice AS invoice
|
|
FROM account_invoice AS invoice
|
|
LEFT JOIN account_invoice_line AS line
|
|
LEFT JOIN account_invoice_line AS line
|
|
ON line.invoice_id = invoice.id
|
|
ON line.invoice_id = invoice.id
|
|
@@ -30,7 +30,7 @@ def get_account_invoice_line_widget():
|
|
ON history.product_template_id = product.product_tmpl_id
|
|
ON history.product_template_id = product.product_tmpl_id
|
|
LEFT JOIN res_currency_rate AS rate
|
|
LEFT JOIN res_currency_rate AS rate
|
|
ON rate.currency_id = invoice.currency_id
|
|
ON rate.currency_id = invoice.currency_id
|
|
- WHERE invoice.state NOT IN ('draft', 'cancel')
|
|
|
|
|
|
+ WHERE invoice.state NOT IN ('draft', 'cancel') AND invoice.type = 'out_invoice'
|
|
AND TO_CHAR(invoice.date_invoice,'YYYY-MM') = TO_CHAR(current_date,'YYYY-MM')
|
|
AND TO_CHAR(invoice.date_invoice,'YYYY-MM') = TO_CHAR(current_date,'YYYY-MM')
|
|
AND journal.store_id = ''' + str(user_store) + '''
|
|
AND journal.store_id = ''' + str(user_store) + '''
|
|
GROUP BY
|
|
GROUP BY
|
|
@@ -39,11 +39,11 @@ def get_account_invoice_line_widget():
|
|
invoice.number,
|
|
invoice.number,
|
|
invoice.origin,
|
|
invoice.origin,
|
|
invoice.date_invoice,
|
|
invoice.date_invoice,
|
|
- line.medic_id,
|
|
|
|
product.name_template,
|
|
product.name_template,
|
|
line.price_unit,
|
|
line.price_unit,
|
|
line.quantity,
|
|
line.quantity,
|
|
- line.price_subtotal
|
|
|
|
|
|
+ line.price_subtotal,
|
|
|
|
+ line.medic_id
|
|
'''
|
|
'''
|
|
|
|
|
|
r.cr.execute(query,(tuple([company_currency_rate,company_currency_rate,company_currency_rate,company_currency_rate])))
|
|
r.cr.execute(query,(tuple([company_currency_rate,company_currency_rate,company_currency_rate,company_currency_rate])))
|