Skip to content

Commit cb75773

Browse files
committedNov 29, 2019
Merge PR OCA#622 into 12.0
Signed-off-by aheficent
2 parents 3df3ff2 + d87986d commit cb75773

12 files changed

+194
-0
lines changed
 

‎oca_dependencies.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
partner-contact
2+
product-attribute
23
purchase-workflow
34
queue
45
brand
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
2+
:target: https://www.gnu.org/licenses/agpl
3+
:alt: License: AGPL-3
4+
5+
=============================
6+
Product Customer Code Invoice
7+
=============================
8+
9+
Based on product_supplierinfo_for_customer, this module loads in every account invoice the
10+
customer code defined in the product.
11+
12+
Bug Tracker
13+
===========
14+
15+
Bugs are tracked on `GitHub Issues
16+
<https://github.com/OCA/account-invoicing/issues>`_. In case of trouble, please
17+
check there if your issue has already been reported. If you spotted it first,
18+
help us smash it by providing detailed and welcomed feedback.
19+
20+
Usage
21+
=====
22+
23+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
24+
:alt: Try me on Runbot
25+
:target: https://runbot.odoo-community.org/runbot/95/12.0
26+
27+
Credits
28+
=======
29+
30+
Images
31+
------
32+
33+
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
34+
35+
Contributors
36+
------------
37+
38+
* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
39+
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
40+
41+
Maintainer
42+
----------
43+
44+
.. image:: https://odoo-community.org/logo.png
45+
:alt: Odoo Community Association
46+
:target: https://odoo-community.org
47+
48+
This module is maintained by the OCA.
49+
50+
OCA, or the Odoo Community Association, is a nonprofit organization whose
51+
mission is to support the collaborative development of Odoo features and
52+
promote its widespread use.
53+
54+
To contribute to this module, please visit https://odoo-community.org.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
3+
from . import models
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2013-2017 Agile Business Group sagl
2+
# (<http://www.agilebg.com>)
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
{
6+
"name": "Product Customer code for account invoice",
7+
"summary": """Based on product_customer_code, this module loads in every
8+
account invoice the customer code defined in the product""",
9+
"version": "12.0.1.0.0",
10+
"author": "Agile Business Group,Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/account-invoicing",
12+
"category": "Account",
13+
"license": "AGPL-3",
14+
"depends": [
15+
"account",
16+
"product_supplierinfo_for_customer",
17+
],
18+
"data": [
19+
"views/account_invoice_view.xml",
20+
],
21+
"installable": True,
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Translation of OpenERP Server.
2+
# This file contains the translation of the following modules:
3+
# * product_customer_code_invoice
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: OpenERP Server 7.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2014-01-15 14:23+0000\n"
10+
"PO-Revision-Date: 2014-06-21 01:02+0000\n"
11+
"Last-Translator: Raphaël Valyi - http://www.akretion.com <Unknown>\n"
12+
"Language-Team: \n"
13+
"Language: it\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: 8bit\n"
17+
"X-Launchpad-Export-Date: 2014-06-22 05:58+0000\n"
18+
"X-Generator: Launchpad (build 17058)\n"
19+
20+
#. module: product_supplierinfo_for_customer_invoice
21+
#: model:ir.model,name:product_supplierinfo_for_customer_invoice.model_account_invoice_line
22+
msgid "Invoice Line"
23+
msgstr "Righe Fattura"
24+
25+
#. module: product_supplierinfo_for_customer_invoice
26+
#: model:ir.model.fields,field_description:product_supplierinfo_for_customer_invoice.field_account_invoice_line_product_customer_code
27+
msgid "Product Customer Code"
28+
msgstr "Codice Prodotto Cliente"
29+
30+
#~ msgid "Invoice"
31+
#~ msgstr "Fattura"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * product_supplierinfo_for_customer_invoice
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 12.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: <>\n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: product_supplierinfo_for_customer_invoice
17+
#: model:ir.model,name:product_supplierinfo_for_customer_invoice.model_account_invoice_line
18+
msgid "Invoice Line"
19+
msgstr ""
20+
21+
#. module: product_supplierinfo_for_customer_invoice
22+
#: model:ir.model.fields,field_description:product_supplierinfo_for_customer_invoice.field_account_invoice_line_product_customer_code
23+
msgid "Product Customer Code"
24+
msgstr ""
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
3+
from . import account_invoice
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2013-2017 Agile Business Group sagl
2+
# (<http://www.agilebg.com>)
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
from odoo import api, fields, models
6+
7+
8+
class AccountInvoiceLine(models.Model):
9+
_inherit = 'account.invoice.line'
10+
11+
@api.multi
12+
@api.depends('product_id')
13+
def _get_product_customer_code(self):
14+
product_customerinfo_obj = self.env['product.customerinfo']
15+
for line in self.filtered(
16+
lambda il: il.invoice_id.partner_id.customer):
17+
product = line.product_id
18+
code_id = product_customerinfo_obj.search([
19+
('product_tmpl_id', '=', product.product_tmpl_id.id),
20+
('name', '=', line.invoice_id.partner_id.id)
21+
], limit=1)
22+
line.product_customer_code = code_id.product_code or ''
23+
24+
product_customer_code = fields.Char(
25+
compute='_get_product_customer_code',
26+
string='Product Customer Code',
27+
)
28+
partner_is_customer = fields.Boolean(
29+
related='invoice_id.partner_id.customer',
30+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
2+
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Based on product_supplierinfo_for_customer, this module loads in every account invoice the
2+
customer code defined in the product.
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--Copyright 2013-2017 Agile Business Group sagl
3+
(<http://www.agilebg.com>)
4+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5+
-->
6+
<odoo>
7+
8+
<record id="invoice_form" model="ir.ui.view">
9+
<field name="name">account.invoice.product.code.form</field>
10+
<field name="model">account.invoice</field>
11+
<field name="inherit_id" ref="account.invoice_form"/>
12+
<field eval="16" name="priority"/>
13+
<field name="arch" type="xml">
14+
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='product_id']" position="after">
15+
<field name="partner_is_customer" invisible="1"/>
16+
<field name="product_customer_code" attrs="{'invisible': [('partner_is_customer', '!=', True)]}"/>
17+
</xpath>
18+
</field>
19+
</record>
20+
21+
</odoo>

0 commit comments

Comments
 (0)
Please sign in to comment.