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 @@ -