From ec72da926fe628b44a40f0f61535438f82bd3961 Mon Sep 17 00:00:00 2001 From: Jigar Vaghela Date: Wed, 10 Feb 2021 11:08:56 +0000 Subject: [PATCH] [FIX] l10n_in_sale: place of supply base on delivery address Before this commit: place of supply always set from customer address. After this commit: place of supply is set by delivery address closes odoo/odoo#67393 Opw: 2456095 X-original-commit: dd141a882478c2e3684638321f36b952bcac3858 Signed-off-by: Josse Colpaert --- addons/l10n_in_sale/report/account_invoice_report.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/l10n_in_sale/report/account_invoice_report.py b/addons/l10n_in_sale/report/account_invoice_report.py index 16834b44fe0..1150be0c13a 100644 --- a/addons/l10n_in_sale/report/account_invoice_report.py +++ b/addons/l10n_in_sale/report/account_invoice_report.py @@ -7,6 +7,16 @@ from odoo import models class L10nInAccountInvoiceReport(models.Model): _inherit = "l10n_in.account.invoice.report" + def _from(self): + from_str = super(L10nInAccountInvoiceReport, self)._from() + return from_str.replace( + "LEFT JOIN res_country_state ps ON ps.id = p.state_id", + """ + LEFT JOIN res_partner dp ON dp.id = am.partner_shipping_id + LEFT JOIN res_country_state ps ON ps.id = dp.state_id + """ + ) + def _where(self): where_str = super(L10nInAccountInvoiceReport, self)._where() where_str += """ AND (aml.product_id IS NULL or aml.product_id != COALESCE(