Files
odoo_source/addons/l10n_cn/models/account_move.py
T
yhu-odoo 915abb533c [FIX] l10n_cn: don't check when no fapiao
Don't check the fapiao number format when there is not fapiao number :)

Related to #45743 and task 2180269

closes odoo/odoo#47835

Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-03-17 14:36:46 +00:00

18 lines
623 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class AccountMove(models.Model):
_inherit = 'account.move'
fapiao = fields.Char(string='Fapiao Number', size=8, copy=False, tracking=True)
@api.constrains('fapiao')
def _check_fapiao(self):
for record in self:
if record.fapiao and (len(record.fapiao) != 8 or not record.fapiao.isdecimal()):
raise ValidationError(_("Fapiao number is an 8-digit number. Please enter a correct one."))