Browse Source

[ADD] beesdoo_purchase: allow inverting of PO ref on inv line

pull/184/head
Vincent Van Rossem 4 years ago
parent
commit
69fbf8f2db
  1. 1
      beesdoo_purchase/README.rst
  2. 14
      beesdoo_purchase/__manifest__.py
  3. 2
      beesdoo_purchase/models/__init__.py
  4. 14
      beesdoo_purchase/models/account_invoice.py
  5. 14
      beesdoo_purchase/models/res_config.py
  6. 1
      beesdoo_purchase/readme/DESCRIPTION.rst
  7. 9
      beesdoo_purchase/security/invoice_security.xml
  8. 18
      beesdoo_purchase/static/description/index.html
  9. 23
      beesdoo_purchase/views/res_config_settings_view.xml

1
beesdoo_purchase/README.rst

@ -27,6 +27,7 @@ create_uid ORM field. His user's contact info is printed on
purchases orders as 'Referent'. purchases orders as 'Referent'.
- A filter w.r.t. the mail sellers is placed on the products field of a - 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** **Table of contents**

14
beesdoo_purchase/__manifest__.py

@ -1,15 +1,21 @@
{ {
"name": "Bees Purchase", "name": "Bees Purchase",
"summary": """ "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 - 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", "author": "Beescoop - Cellule IT, " "Coop IT Easy SCRLfs",
"website": "https://github.com/beescoop/Obeesdoo", "website": "https://github.com/beescoop/Obeesdoo",
"category": "Purchase", "category": "Purchase",
"version": "12.0.1.1.0",
"version": "12.0.1.2.0",
"depends": ["base", "purchase", "beesdoo_product"], "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", "license": "AGPL-3",
} }

2
beesdoo_purchase/models/__init__.py

@ -1 +1,3 @@
from . import account_invoice
from . import purchase from . import purchase
from . import res_config

14
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

14
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."""
)

1
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'. purchases orders as 'Referent'.
- A filter w.r.t. the mail sellers is placed on the products field of a - 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.

9
beesdoo_purchase/security/invoice_security.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="group_invert_po_ref_on_inv_line" model="res.groups">
<field name="name">Invert Purchase Order Reference on invoice line</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
</odoo>

18
beesdoo_purchase/static/description/index.html

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/beescoop/obeesdoo/tree/12.0/beesdoo_purchase"><img alt="beescoop/obeesdoo" src="https://img.shields.io/badge/github-beescoop%2Fobeesdoo-lightgray.png?logo=github" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/obeesdoo/tree/12.0/beesdoo_purchase"><img alt="OCA/obeesdoo" src="https://img.shields.io/badge/github-OCA%2Fobeesdoo-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/obeesdoo-12-0/obeesdoo-12-0-beesdoo_purchase"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a></p>
<p>Extends Purchase module: <p>Extends Purchase module:
- Adds a ‘Responsible’ field to purchase orders: - Adds a ‘Responsible’ field to purchase orders:
This is a user who will follow up the order. This users replaces 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 create_uid ORM field. His user’s contact info is printed on
purchases orders as ‘Referent’. purchases orders as ‘Referent’.
- A filter w.r.t. the mail sellers is placed on the products field of a - A filter w.r.t. the mail sellers is placed on the products field of a
purchase order.</p>
purchase order.
- Allow inverting the Purchase Order Reference on the invoice lines.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
@ -390,10 +391,10 @@ purchase order.</p>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/beescoop/obeesdoo/issues">GitHub Issues</a>.
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/obeesdoo/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/beescoop/obeesdoo/issues/new?body=module:%20beesdoo_purchase%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/obeesdoo/issues/new?body=module:%20beesdoo_purchase%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -414,8 +415,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2> <h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/beescoop/obeesdoo/tree/12.0/beesdoo_purchase">beescoop/obeesdoo</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/obeesdoo/tree/12.0/beesdoo_purchase">OCA/obeesdoo</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>
</div> </div>

23
beesdoo_purchase/views/res_config_settings_view.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res invoice line description settings</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath
expr="//div[@id='invoicing_settings']"
position="inside">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_invert_po_ref_on_inv_line"/>
</div>
<div class="o_setting_right_pane">
<label for="group_invert_po_ref_on_inv_line"/>
</div>
</div>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save