diff --git a/beesdoo_purchase/README.rst b/beesdoo_purchase/README.rst
index 9570923..b268c6b 100644
--- a/beesdoo_purchase/README.rst
+++ b/beesdoo_purchase/README.rst
@@ -27,6 +27,7 @@ create_uid ORM field. His user's contact info is printed on
purchases orders as 'Referent'.
- A filter w.r.t. the mail sellers is placed on the products field of a
purchase order.
+- Allow inverting the Purchase Order Reference on the invoice lines.
**Table of contents**
diff --git a/beesdoo_purchase/__manifest__.py b/beesdoo_purchase/__manifest__.py
index 54c42a7..eaf8630 100644
--- a/beesdoo_purchase/__manifest__.py
+++ b/beesdoo_purchase/__manifest__.py
@@ -1,15 +1,21 @@
{
"name": "Bees Purchase",
"summary": """
- - Adds a 'Responsible' field to purchase orders,
+ - Adds a 'Responsible' field to purchase orders
- A filter w.r.t. the mail sellers is placed on the products field of a
- purchase order.
+ purchase order
+ - Allow inverting the Purchase Order Reference on the invoice lines
""",
"author": "Beescoop - Cellule IT, " "Coop IT Easy SCRLfs",
"website": "https://github.com/beescoop/Obeesdoo",
"category": "Purchase",
- "version": "12.0.1.1.0",
+ "version": "12.0.1.2.0",
"depends": ["base", "purchase", "beesdoo_product"],
- "data": ["views/purchase_order.xml", "report/report_purchaseorder.xml"],
+ "data": [
+ "security/invoice_security.xml",
+ "views/purchase_order.xml",
+ "views/res_config_settings_view.xml",
+ "report/report_purchaseorder.xml",
+ ],
"license": "AGPL-3",
}
diff --git a/beesdoo_purchase/models/__init__.py b/beesdoo_purchase/models/__init__.py
index 370f577..118e747 100644
--- a/beesdoo_purchase/models/__init__.py
+++ b/beesdoo_purchase/models/__init__.py
@@ -1 +1,3 @@
+from . import account_invoice
from . import purchase
+from . import res_config
\ No newline at end of file
diff --git a/beesdoo_purchase/models/account_invoice.py b/beesdoo_purchase/models/account_invoice.py
new file mode 100644
index 0000000..f6cc57a
--- /dev/null
+++ b/beesdoo_purchase/models/account_invoice.py
@@ -0,0 +1,14 @@
+from odoo import api, fields, models, _
+
+
+class AccountInvoice(models.Model):
+ _inherit = 'account.invoice'
+
+ def _prepare_invoice_line_from_po_line(self, line):
+ """ Override parent's method to invert Purchase Order Reference on invoice line"""
+ invoice_line = super(AccountInvoice, self)._prepare_invoice_line_from_po_line(line)
+ if self.user_has_groups(
+ 'beesdoo_purchase.'
+ 'group_invert_po_ref_on_inv_line'):
+ invoice_line['name'] = line.name + ': ' + line.order_id.name
+ return invoice_line
\ No newline at end of file
diff --git a/beesdoo_purchase/models/res_config.py b/beesdoo_purchase/models/res_config.py
new file mode 100644
index 0000000..f6f4fc0
--- /dev/null
+++ b/beesdoo_purchase/models/res_config.py
@@ -0,0 +1,14 @@
+from odoo import fields, models
+
+
+class ResConfigSettings(models.TransientModel):
+ _inherit = 'res.config.settings'
+
+ group_invert_po_ref_on_inv_line = fields.Boolean(
+ """Allow inverting the Purchase Order Reference on the
+ invoice lines""",
+ implied_group="beesdoo_purchase."
+ "group_invert_po_ref_on_inv_line",
+ help="""Allows you to invert Purchase Order Reference on the
+ invoice lines."""
+ )
diff --git a/beesdoo_purchase/readme/DESCRIPTION.rst b/beesdoo_purchase/readme/DESCRIPTION.rst
index 6d9e566..8accc85 100644
--- a/beesdoo_purchase/readme/DESCRIPTION.rst
+++ b/beesdoo_purchase/readme/DESCRIPTION.rst
@@ -6,3 +6,4 @@ create_uid ORM field. His user's contact info is printed on
purchases orders as 'Referent'.
- A filter w.r.t. the mail sellers is placed on the products field of a
purchase order.
+- Allow inverting the Purchase Order Reference on the invoice lines.
diff --git a/beesdoo_purchase/security/invoice_security.xml b/beesdoo_purchase/security/invoice_security.xml
new file mode 100644
index 0000000..344d146
--- /dev/null
+++ b/beesdoo_purchase/security/invoice_security.xml
@@ -0,0 +1,9 @@
+
+
+
+
+ Invert Purchase Order Reference on invoice line
+
+
+
+
diff --git a/beesdoo_purchase/static/description/index.html b/beesdoo_purchase/static/description/index.html
index 5572fa8..9b5edf1 100644
--- a/beesdoo_purchase/static/description/index.html
+++ b/beesdoo_purchase/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
Extends Purchase module:
- Adds a ‘Responsible’ field to purchase orders:
This is a user who will follow up the order. This users replaces
@@ -375,7 +375,8 @@ the creator in the order’s mail messages followers list, and in the
create_uid ORM field. His user’s contact info is printed on
purchases orders as ‘Referent’.
- A filter w.r.t. the mail sellers is placed on the products field of a
-purchase order.
+purchase order.
+- Allow inverting the Purchase Order Reference on the invoice lines.
Table of contents
@@ -390,10 +391,10 @@ purchase order.
-
Bugs are tracked on GitHub Issues.
+
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+
feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -414,8 +415,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
-
This module is part of the beescoop/obeesdoo project on GitHub.
-
You are welcome to contribute.
+
This module is maintained by the OCA.
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
This module is part of the OCA/obeesdoo project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/beesdoo_purchase/views/res_config_settings_view.xml b/beesdoo_purchase/views/res_config_settings_view.xml
new file mode 100644
index 0000000..a2d4731
--- /dev/null
+++ b/beesdoo_purchase/views/res_config_settings_view.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ res invoice line description settings
+ res.config.settings
+
+
+
+
+
+
+
+