[PATCH] Upstream patch - 03102023

This commit is contained in:
Parthiv Patel
2023-10-03 08:34:26 +00:00
parent fc5b8301f8
commit 459e34c6b8
2 changed files with 16 additions and 2 deletions
@@ -1,6 +1,8 @@
<flectra>
<record model="ir.config_parameter" id="minlength">
<data noupdate="1">
<record model="ir.config_parameter" id="minlength" forcecreate="True">
<field name="key">auth_password_policy.minlength</field>
<field name="value" type="int">8</field>
</record>
</data>
</flectra>
+13 -1
View File
@@ -77,6 +77,7 @@ _ref_vat = {
_region_specific_vat_codes = {
'xi',
't',
}
@@ -84,7 +85,14 @@ class ResPartner(models.Model):
_inherit = 'res.partner'
def _split_vat(self, vat):
vat_country, vat_number = vat[:2].lower(), vat[2:].replace(' ', '')
'''
Splits the VAT Number to get the country code in a first place and the code itself in a second place.
This has to be done because some countries' code are one character long instead of two (i.e. "T" for Japan)
'''
if vat[1].isalpha():
vat_country, vat_number = vat[:2].lower(), vat[2:].replace(' ', '')
else:
vat_country, vat_number = vat[:1].lower(), vat[1:].replace(' ', '')
return vat_country, vat_number
@api.model
@@ -602,6 +610,10 @@ class ResPartner(models.Model):
return len(vat) == 11 and vat.isdigit()
return check_func(vat)
def check_vat_t(self, vat):
if self.country_id.code == 'JP':
return self.simple_vat_check('jp', vat)
def format_vat_eu(self, vat):
# Foreign companies that trade with non-enterprises in the EU
# may have a VATIN starting with "EU" instead of a country code.