diff --git a/account_supplier_invoice_number/README.rst b/account_supplier_invoice_number/README.rst new file mode 100644 index 00000000..c5b4dcb0 --- /dev/null +++ b/account_supplier_invoice_number/README.rst @@ -0,0 +1,20 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +======================= +Supplier invoice number +======================= + +This module adds the 'Supplier Invoice Number' field to a supplier invoice. + +This module is a prerequisite for other modules adding extra functionality such as + +- supplier invoices with structured communications +- supplier invoice duplicate checking + + +Known issues / Roadmap +====================== + +- Align this module with the OCA 'account_invoice_supplier_ref_unique' module. diff --git a/account_supplier_invoice_number/__init__.py b/account_supplier_invoice_number/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/account_supplier_invoice_number/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_supplier_invoice_number/__manifest__.py b/account_supplier_invoice_number/__manifest__.py new file mode 100644 index 00000000..4f51093b --- /dev/null +++ b/account_supplier_invoice_number/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2009-2019 Noviat. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Supplier invoice number', + 'version': '11.0.1.0.0', + 'category': 'Accounting & Finance', + 'website': 'https://www.noviat.com', + 'author': 'Noviat', + 'license': 'AGPL-3', + 'data': [ + 'views/account_invoice_views.xml', + ], + 'depends': [ + 'account', + ], + 'installable': True, +} diff --git a/account_supplier_invoice_number/models/__init__.py b/account_supplier_invoice_number/models/__init__.py new file mode 100644 index 00000000..8e072db8 --- /dev/null +++ b/account_supplier_invoice_number/models/__init__.py @@ -0,0 +1 @@ +from . import account_invoice diff --git a/account_supplier_invoice_number/models/account_invoice.py b/account_supplier_invoice_number/models/account_invoice.py new file mode 100644 index 00000000..133ebb33 --- /dev/null +++ b/account_supplier_invoice_number/models/account_invoice.py @@ -0,0 +1,25 @@ +# Copyright 2009-2019 Noviat. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class AccountInvoice(models.Model): + _inherit = 'account.invoice' + + supplier_invoice_number = fields.Char( + string='Vendor Invoice Number', + readonly=True, + states={'draft': [('readonly', False)]}, + copy=False) + + @api.onchange('supplier_invoice_number') + def _onchange_supplier_invoice_number(self): + if not self.reference: + self.reference = self.supplier_invoice_number + + @api.onchange('reference') + def _onchange_vendor_bill_reference(self): + if self.type in ['in_invoice', 'in_refund'] \ + and not self.supplier_invoice_number: + self.supplier_invoice_number = self.reference diff --git a/account_supplier_invoice_number/static/description/icon.png b/account_supplier_invoice_number/static/description/icon.png new file mode 100644 index 00000000..32740c0c Binary files /dev/null and b/account_supplier_invoice_number/static/description/icon.png differ diff --git a/account_supplier_invoice_number/views/account_invoice_views.xml b/account_supplier_invoice_number/views/account_invoice_views.xml new file mode 100644 index 00000000..b3ed4b13 --- /dev/null +++ b/account_supplier_invoice_number/views/account_invoice_views.xml @@ -0,0 +1,15 @@ + + + + + account.invoice.supplier.form.inherit + account.invoice + + + + + + + + +