- add philippines localization task-2713149 closes odoo/odoo#105062 X-original-commit: 60b9738f7923135ec018fbdcd2cbbfa6de8c75e0 Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
23 lines
656 B
Python
23 lines
656 B
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import re
|
|
|
|
from odoo import fields, api, models
|
|
|
|
CHECK_VAT_PH_RE = re.compile(r"\d{3}-\d{3}-\d{3}-\d{5}")
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = "res.partner"
|
|
|
|
branch_code = fields.Char("Branch Code", default='000', required=True)
|
|
first_name = fields.Char("First Name")
|
|
middle_name = fields.Char("Middle Name")
|
|
last_name = fields.Char("Last Name")
|
|
|
|
@api.model
|
|
def _commercial_fields(self):
|
|
return super()._commercial_fields() + ['branch_code']
|
|
|
|
def check_vat_ph(self, vat):
|
|
return len(vat) == 17 and CHECK_VAT_PH_RE.match(vat)
|