Skip to content

Commit

Permalink
[11.0][ADD]account_supplier_invoice_number
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-demeyer committed Nov 12, 2019
1 parent 88083f7 commit ac98a6e
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
20 changes: 20 additions & 0 deletions account_supplier_invoice_number/README.rst
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions account_supplier_invoice_number/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions account_supplier_invoice_number/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
1 change: 1 addition & 0 deletions account_supplier_invoice_number/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_invoice
25 changes: 25 additions & 0 deletions account_supplier_invoice_number/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions account_supplier_invoice_number/views/account_invoice_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="invoice_supplier_form" model="ir.ui.view">
<field name="name">account.invoice.supplier.form.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="supplier_invoice_number"/>
</field>
</field>
</record>

</odoo>

0 comments on commit ac98a6e

Please sign in to comment.