From 8f647c07e49ed5fab3a0b8544a9b3385d0fa01e2 Mon Sep 17 00:00:00 2001 From: Jigar Vaghela Date: Fri, 29 Jan 2021 13:21:04 +0000 Subject: [PATCH] [FIX] l10n_in: If vat is not available in delivery address then check same in customer This below case is not working before this commit: when Bill to Ship to where Delivery address partner is not registered and not have GSTIN closes odoo/odoo#65599 X-original-commit: d9b409247303c6b165a7df381169f2480a19900f Signed-off-by: Josse Colpaert --- addons/l10n_in/models/account_invoice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py index 8b2082065e7..fce81216c24 100644 --- a/addons/l10n_in/models/account_invoice.py +++ b/addons/l10n_in/models/account_invoice.py @@ -105,7 +105,9 @@ class AccountMove(models.Model): move.l10n_in_state_id = company_unit_partner.state_id shipping_partner = move._l10n_in_get_shipping_partner() - move.l10n_in_gstin = move._l10n_in_get_shipping_partner_gstin(shipping_partner) + # In case of shipping address does not have GSTN then also check customer(partner_id) GSTN + # This happens when Bill-to Ship-to transaction where shipping(Ship-to) address is unregistered and customer(Bill-to) is registred. + move.l10n_in_gstin = move._l10n_in_get_shipping_partner_gstin(shipping_partner) or move.partner_id.vat if not move.l10n_in_gstin and move.l10n_in_gst_treatment in ['regular', 'composition', 'special_economic_zone', 'deemed_export']: raise ValidationError(_( "Partner %(partner_name)s (%(partner_id)s) GSTIN is required under GST Treatment %(name)s",