Skip to content

Commit

Permalink
[MIG] account_invoice_line_description: Migration to 13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kongrattapong authored and Ernesto Tejeda committed Jan 14, 2022
1 parent 17bddf5 commit 5fd37ca
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 80 deletions.
14 changes: 9 additions & 5 deletions account_invoice_line_description/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Account invoice line description
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/12.0/account_invoice_line_description
:target: https://github.com/OCA/account-invoicing/tree/13.0/account_invoice_line_description
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_line_description
:target: https://translation.odoo-community.org/projects/account-invoicing-13-0/account-invoicing-13-0-account_invoice_line_description
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/95/12.0
:target: https://runbot.odoo-community.org/runbot/95/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -48,7 +48,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/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 <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_line_description%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_line_description%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -67,6 +67,10 @@ Contributors
* Alex Comba <[email protected]>
* Luis M. Ontalba <[email protected]>
* Alberto Martín <[email protected]>
* Rattapong Chokmasermkul <[email protected]>
* `Tecnativa <https://www.tecnativa.com>`_:

* Ernesto Tejeda

Maintainers
~~~~~~~~~~~
Expand All @@ -81,6 +85,6 @@ 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/account-invoicing <https://github.com/OCA/account-invoicing/tree/12.0/account_invoice_line_description>`_ project on GitHub.
This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/13.0/account_invoice_line_description>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions account_invoice_line_description/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"name": "Account invoice line description",
"version": "13.0.1.0.0",
"category": "Generic Modules/Accounting",
"author": "Agile Business Group, " "Tecnativa, " "Odoo Community Association (OCA)",
"author": "Agile Business Group, Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"license": "AGPL-3",
"depends": ["account"],
"data": ["security/invoice_security.xml", "wizards/res_config_view.xml"],
"data": ["security/account_security.xml", "wizards/res_config_view.xml"],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_invoice_line_description
# * account_invoice_line_description
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand All @@ -15,14 +15,12 @@ msgstr ""

#. module: account_invoice_line_description
#: model:ir.model.fields,field_description:account_invoice_line_description.field_res_config_settings__group_use_product_description_per_inv_line
msgid "Allow using only the product description on the\n"
" invoice lines"
msgid "Allow using only the product description on the invoice lines"
msgstr ""

#. module: account_invoice_line_description
#: model:ir.model.fields,help:account_invoice_line_description.field_res_config_settings__group_use_product_description_per_inv_line
msgid "Allows you to use only product description on the\n"
" invoice lines."
msgid "Allows you to use only product description on the invoice lines."
msgstr ""

#. module: account_invoice_line_description
Expand All @@ -31,12 +29,11 @@ msgid "Config Settings"
msgstr ""

#. module: account_invoice_line_description
#: model:ir.model,name:account_invoice_line_description.model_account_invoice_line
msgid "Invoice Line"
#: model:ir.model,name:account_invoice_line_description.model_account_move_line
msgid "Journal Item"
msgstr ""

#. module: account_invoice_line_description
#: model:res.groups,name:account_invoice_line_description.group_use_product_description_per_inv_line
msgid "Use only product description on invoice lines"
msgstr ""

2 changes: 1 addition & 1 deletion account_invoice_line_description/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from . import account_invoice_line
from . import account_move
27 changes: 0 additions & 27 deletions account_invoice_line_description/models/account_invoice_line.py

This file was deleted.

22 changes: 22 additions & 0 deletions account_invoice_line_description/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2015 Agile Business Group sagl (https://www.agilebg.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo import api, models


class AccountMoveLine(models.Model):
_inherit = "account.move.line"

@api.onchange("product_id")
def _onchange_product_id(self):
res = super()._onchange_product_id()
if self.product_id and self.user_has_groups(
"account_invoice_line_description."
"group_use_product_description_per_inv_line"
):
product = self.product_id.with_context(lang=self.move_id.partner_id.lang)
if self.move_id.is_purchase_document():
self.name = product.description_purchase or self.name
elif self.move_id.is_sale_document():
self.name = product.description_sale or self.name
return res
3 changes: 3 additions & 0 deletions account_invoice_line_description/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
* Luis M. Ontalba <[email protected]>
* Alberto Martín <[email protected]>
* Rattapong Chokmasermkul <[email protected]>
* `Tecnativa <https://www.tecnativa.com>`_:

* Ernesto Tejeda
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="group_use_product_description_per_inv_line" model="res.groups">
<field
name="name">Use only product description on invoice lines</field>
<field name="category_id" ref="base.module_category_hidden"/>
<field name="name">Use only product description on invoice lines</field>
<field name="category_id" ref="base.module_category_hidden" />
</record>
</odoo>
11 changes: 8 additions & 3 deletions account_invoice_line_description/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Account invoice line description</h1>
!! This file is generated by oca-gen-addon-readme !!
!! 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/OCA/account-invoicing/tree/12.0/account_invoice_line_description"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_line_description"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/95/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></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/account-invoicing/tree/13.0/account_invoice_line_description"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-invoicing-13-0/account-invoicing-13-0-account_invoice_line_description"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/95/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows to use only the sale description or the purchase description
on the invoice lines depending on the invoice type.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -397,7 +397,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-invoicing/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_line_description%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/account-invoicing/issues/new?body=module:%20account_invoice_line_description%0Aversion:%2013.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>
</div>
<div class="section" id="credits">
Expand All @@ -415,6 +415,11 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<li>Alex Comba &lt;<a class="reference external" href="mailto:alex.comba&#64;agilebg.com">alex.comba&#64;agilebg.com</a>&gt;</li>
<li>Luis M. Ontalba &lt;<a class="reference external" href="mailto:luis.martinez&#64;tecnativa.com">luis.martinez&#64;tecnativa.com</a>&gt;</li>
<li>Alberto Martín &lt;<a class="reference external" href="mailto:alberto.martin&#64;guadaltech.es">alberto.martin&#64;guadaltech.es</a>&gt;</li>
<li>Rattapong Chokmasermkul &lt;<a class="reference external" href="mailto:rattapongc&#64;ecosoft.co.th">rattapongc&#64;ecosoft.co.th</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Ernesto Tejeda</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -424,7 +429,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<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/account-invoicing/tree/12.0/account_invoice_line_description">OCA/account-invoicing</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-invoicing/tree/13.0/account_invoice_line_description">OCA/account-invoicing</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>
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_line_description/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from . import test_account_invoice_line_description
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Copyright 2017 - Tecnativa, S.L. - Luis M. Ontalba
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo.tests.common import SavepointCase, at_install, post_install
from odoo.tests.common import SavepointCase, tagged


@at_install(False)
@post_install(True)
@tagged("post_install", "-at_install")
class TestAccountInvoiceLineDescription(SavepointCase):
@classmethod
def setUpClass(cls):
super(TestAccountInvoiceLineDescription, cls).setUpClass()
super().setUpClass()
cls.new_permission = cls.env.ref(
"account_invoice_line_description"
".group_use_product_description_per_inv_line"
Expand All @@ -29,11 +28,11 @@ def setUpClass(cls):
"type": "consu",
"categ_id": cls.product_category.id,
"description_sale": "Test Description Sale",
"sale_line_warn": "no-message",
"lst_price": 0,
}
)
cls.account_type_regular = cls.env["account.account.type"].create(
{"name": "regular,"}
{"name": "regular", "type": "other", "internal_group": "income"}
)
cls.account = cls.env["account.account"].create(
{
Expand All @@ -54,7 +53,7 @@ def setUpClass(cls):
},
)
]
cls.invoice_sale = cls.env["account.invoice"].create(
cls.invoice_sale = cls.env["account.move"].create(
{
"partner_id": cls.partner.id,
"journal_id": cls.journal_sale.id,
Expand All @@ -72,6 +71,7 @@ def setUpClass(cls):
"type": "consu",
"categ_id": cls.product_category.id,
"description_purchase": "Test Description Purchase",
"lst_price": 0,
}
)
cls.invoice_purchase_vals = [
Expand All @@ -86,7 +86,7 @@ def setUpClass(cls):
},
)
]
cls.invoice_purchase = cls.env["account.invoice"].create(
cls.invoice_purchase = cls.env["account.move"].create(
{
"partner_id": cls.partner.id,
"journal_id": cls.journal_purchase.id,
Expand Down
6 changes: 2 additions & 4 deletions account_invoice_line_description/wizards/res_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

group_use_product_description_per_inv_line = fields.Boolean(
"""Allow using only the product description on the
invoice lines""",
string="Allow using only the product description on the invoice lines",
implied_group="account_invoice_line_description."
"group_use_product_description_per_inv_line",
help="""Allows you to use only product description on the
invoice lines.""",
help="""Allows you to use only product description on the invoice lines.""",
)
23 changes: 10 additions & 13 deletions account_invoice_line_description/wizards/res_config_view.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_account_invoice_line_description_config" 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="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_use_product_description_per_inv_line"/>
</div>
<div class="o_setting_right_pane">
<label for="group_use_product_description_per_inv_line"/>
</div>
<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_use_product_description_per_inv_line" />
</div>
<div class="o_setting_right_pane">
<label for="group_use_product_description_per_inv_line" />
</div>
</div>
</xpath>
</field>
</record>
Expand Down

0 comments on commit 5fd37ca

Please sign in to comment.