From 361ac275c73dfa79c945a71bd549e60dca3d1b45 Mon Sep 17 00:00:00 2001 From: bat-odoo Date: Tue, 10 Jan 2023 10:10:03 +0000 Subject: [PATCH] [IMP] l10n_in: set partner state in `Place of supply` only when journal type is sale Currently, the Place of supply value is set from the partner state for all journal types. So in this commit, we set the partner state in `Place of supply` only when the journal type is a sale. Also added the country domain in XML view. Part-of: odoo/odoo#109717 --- addons/l10n_in/models/account_invoice.py | 6 ++++-- addons/l10n_in/views/account_invoice_views.xml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py index 4d312808418..d0fc2c60bce 100644 --- a/addons/l10n_in/models/account_invoice.py +++ b/addons/l10n_in/models/account_invoice.py @@ -37,10 +37,10 @@ class AccountMove(models.Model): for record in self: record.l10n_in_gst_treatment = record.partner_id.l10n_in_gst_treatment - @api.depends('partner_id') + @api.depends('partner_id', 'company_id') def _compute_l10n_in_state_id(self): for move in self: - if move.country_code == 'IN': + if move.country_code == 'IN' and move.journal_id.type == 'sale': country_code = move.partner_id.country_id.code if country_code == 'IN': move.l10n_in_state_id = move.partner_id.state_id @@ -48,6 +48,8 @@ class AccountMove(models.Model): move.l10n_in_state_id = self.env.ref('l10n_in.state_in_oc', raise_if_not_found=False) else: move.l10n_in_state_id = move.company_id.state_id + elif move.country_code == 'IN' and move.journal_id.type == 'purchase': + move.l10n_in_state_id = move.company_id.state_id else: move.l10n_in_state_id = False diff --git a/addons/l10n_in/views/account_invoice_views.xml b/addons/l10n_in/views/account_invoice_views.xml index d9aff6e1de8..45995d5044c 100644 --- a/addons/l10n_in/views/account_invoice_views.xml +++ b/addons/l10n_in/views/account_invoice_views.xml @@ -7,7 +7,7 @@ -