From fcd6c6d40072c8c9ce4fe39116487cb52ca004c6 Mon Sep 17 00:00:00 2001 From: "Nishant Jain (niai)" Date: Tue, 24 Jan 2023 10:15:36 +0000 Subject: [PATCH] [IMP] l10n_in: auto set GST Treatment in invoice/bill Before this commit ================== GST Treatment will not be assigned to those invoices/bills whose partners don't have GST Treatment. After this commit ================= GST Treatment will be assigned to those invoices/bills whose partners don't have GST Treatment. closes odoo/odoo#111528 X-original-commit: de944b54715db0a0b6898fb9b049449c5ced29c9 Related: odoo/enterprise#36555 Signed-off-by: Josse Colpaert --- addons/l10n_in/models/account_invoice.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py index d0fc2c60bce..fbd3ca1203f 100644 --- a/addons/l10n_in/models/account_invoice.py +++ b/addons/l10n_in/models/account_invoice.py @@ -35,7 +35,14 @@ class AccountMove(models.Model): @api.depends('partner_id') def _compute_l10n_in_gst_treatment(self): for record in self: - record.l10n_in_gst_treatment = record.partner_id.l10n_in_gst_treatment + 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 @api.depends('partner_id', 'company_id') def _compute_l10n_in_state_id(self):