[FIX] issues [87]:Invalid State Code and [88]:Sale Advance Pricelist Installation Error

This commit is contained in:
Haresh Chavda 2018-07-09 12:05:04 +05:30
parent 823c7409a5
commit 89b55fce31
4 changed files with 7 additions and 8 deletions

View File

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

View File

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

View File

@ -5,10 +5,6 @@
<field name="implied_ids" eval="[(4, ref('sales_team.group_sale_salesman')), (4, ref('sale.group_discount_per_so_line'))]"/>
</record>
<record id="base.main_company" model="res.company">
<field name="currency_id" ref="base.USD"/>
</record>
<record id="res_partner_advance_pricelist" model="res.partner">
<field name="name">Josheph</field>
<field eval="[(6, 0, [ref('base.res_partner_category_7'), ref('base.res_partner_category_9')])]" name="category_id"/>

View File

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