From 83974dc3a30b9ce678cd110a00fed333a17dd4aa Mon Sep 17 00:00:00 2001 From: Harsh Modi Date: Wed, 7 Feb 2024 11:23:24 +0530 Subject: [PATCH] [FIX] l10n_in: fix gst treatment on posted invoice Before this commit: After commit f7147b36da0b3963e5bafb09cb585f130dcbfcf0 on changing partner gst treatment, it makes GST treatment on posted invoice False After this commit: It resolves the issue due to commit f7147b36da0b3963e5bafb09cb585f130dcbfcf0 closes odoo/odoo#152997 Signed-off-by: Josse Colpaert --- addons/l10n_in/models/account_invoice.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py index d2f1354ae83..a66d639980f 100644 --- a/addons/l10n_in/models/account_invoice.py +++ b/addons/l10n_in/models/account_invoice.py @@ -34,16 +34,17 @@ class AccountMove(models.Model): @api.depends('partner_id', 'partner_id.l10n_in_gst_treatment') def _compute_l10n_in_gst_treatment(self): - indian_invoice = self.filtered(lambda m: m.state == 'draft' and m.country_code == 'IN') + indian_invoice = self.filtered(lambda m: m.country_code == 'IN') for record in indian_invoice: - gst_treatment = record.partner_id.l10n_in_gst_treatment - if not gst_treatment: - gst_treatment = 'unregistered' - if record.partner_id.country_id.code == 'IN' and record.partner_id.vat: - gst_treatment = 'regular' - elif record.partner_id.country_id and record.partner_id.country_id.code != 'IN': - gst_treatment = 'overseas' - record.l10n_in_gst_treatment = gst_treatment + if record.state == 'draft': + gst_treatment = record.partner_id.l10n_in_gst_treatment + if not gst_treatment: + gst_treatment = 'unregistered' + if record.partner_id.country_id.code == 'IN' and record.partner_id.vat: + gst_treatment = 'regular' + elif record.partner_id.country_id and record.partner_id.country_id.code != 'IN': + gst_treatment = 'overseas' + record.l10n_in_gst_treatment = gst_treatment (self - indian_invoice).l10n_in_gst_treatment = False @api.depends('partner_id', 'company_id')