From 89b55fce311d8d99f9c97150018bd2afb9060de2 Mon Sep 17 00:00:00 2001 From: Haresh Chavda Date: Mon, 9 Jul 2018 12:05:04 +0530 Subject: [PATCH] [FIX] issues [87]:Invalid State Code and [88]:Sale Advance Pricelist Installation Error --- addons/l10n_in_gst/models/res_company.py | 4 ++-- addons/l10n_in_gst/models/res_partner.py | 4 ++-- addons/sale_advance_pricelist/demo/res_partner_demo.xml | 4 ---- .../tests/sale_advance_pricelist_common.py | 3 +++ 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/l10n_in_gst/models/res_company.py b/addons/l10n_in_gst/models/res_company.py index 64888673..d6cb70b7 100644 --- a/addons/l10n_in_gst/models/res_company.py +++ b/addons/l10n_in_gst/models/res_company.py @@ -36,8 +36,8 @@ class Company(models.Model): def _check_gstin_format(self): """ Validations for GSTIN number format and length """ for res in self: - if res.state_id and res.vat and res.state_id.l10n_in_tin != \ - res.vat[:2]: + if res.state_id and res.vat and res.state_id.l10n_in_tin \ + and res.state_id.l10n_in_tin != res.vat[:2]: raise ValidationError(_('Invalid State Code!')) if res.vat and len(res.vat) != 15 and res.gst_type != \ 'unregistered': diff --git a/addons/l10n_in_gst/models/res_partner.py b/addons/l10n_in_gst/models/res_partner.py index c5e641ba..6300435f 100644 --- a/addons/l10n_in_gst/models/res_partner.py +++ b/addons/l10n_in_gst/models/res_partner.py @@ -31,8 +31,8 @@ class Partner(models.Model): @api.constrains('vat', 'state_id') def _check_gstin_format(self): for res in self: - if res.state_id and res.vat and res.state_id.l10n_in_tin != \ - res.vat[:2]: + if res.state_id and res.vat and res.state_id.l10n_in_tin \ + and res.state_id.l10n_in_tin != res.vat[:2]: raise ValidationError(_('Invalid State Code!')) if res.vat and len(res.vat) != 15 and res.gst_type != \ 'unregistered': diff --git a/addons/sale_advance_pricelist/demo/res_partner_demo.xml b/addons/sale_advance_pricelist/demo/res_partner_demo.xml index 6a0a4372..e685d74a 100644 --- a/addons/sale_advance_pricelist/demo/res_partner_demo.xml +++ b/addons/sale_advance_pricelist/demo/res_partner_demo.xml @@ -5,10 +5,6 @@ - - - - Josheph diff --git a/addons/sale_advance_pricelist/tests/sale_advance_pricelist_common.py b/addons/sale_advance_pricelist/tests/sale_advance_pricelist_common.py index da1f08b8..96f5b5c9 100644 --- a/addons/sale_advance_pricelist/tests/sale_advance_pricelist_common.py +++ b/addons/sale_advance_pricelist/tests/sale_advance_pricelist_common.py @@ -11,6 +11,9 @@ class TestAdvSalePricelist(TransactionCase): self.currency_id = self.env.ref('base.USD') self.category_id = self.env.ref('product.product_category_5') + self.main_company = self.env.ref('base.main_company') + self.main_company.currency_id = self.env.ref('base.USD').id + self.pricelist_1 = \ self.env.ref('sale_advance_pricelist.advance_pricelist') self.pricelist_2 = self.env.ref(