diff --git a/invoice.py b/invoice.py index b5c5220..10b9f4a 100755 --- a/invoice.py +++ b/invoice.py @@ -1733,7 +1733,8 @@ class Invoice(metaclass=PoolMeta): if not number: return legacy_supplier_ncf = ( - invoice.type == 'in' and re.fullmatch(r'[A-Z]\d{18}', number)) + getattr(invoice, 'type', None) == 'in' + and re.fullmatch(r'[A-Z]\d{18}', number)) if not legacy_supplier_ncf and not re.fullmatch( r'(?:B\d{10}|E\d{12})', number): raise UserError(gettext( diff --git a/pyproject.toml b/pyproject.toml index 9a30535..d8c461d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ include = [ [tool.hatch.metadata.hooks.tryton] copyright = 'COPYRIGHT' readme = 'README.rst' +prefixes = {account_credit_note = 'unpaismejor', account_debit_note = 'unpaismejor', account_invoice_do = 'unpaismejor'} [tool.hatch.metadata.hooks.tryton.tryton-optional-dependencies] test = ['proteus']