Skip to content

Commit

Permalink
[MIG] account_invoice_margin: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BhaveshHeliconia committed Feb 14, 2025
1 parent 1709e9e commit 52fc1e0
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 38 deletions.
46 changes: 25 additions & 21 deletions account_invoice_margin/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Account Invoice Margin
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
:target: https://github.com/OCA/margin-analysis/tree/17.0/account_invoice_margin
:target: https://github.com/OCA/margin-analysis/tree/18.0/account_invoice_margin
:alt: OCA/margin-analysis
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/margin-analysis-17-0/margin-analysis-17-0-account_invoice_margin
:target: https://translation.odoo-community.org/projects/margin-analysis-18-0/margin-analysis-18-0-account_invoice_margin
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -32,16 +32,16 @@ This module allows to show sales margin in invoices.

The new information is available:

- on the invoice form view
- on the invoice form view

|image1|

- and on the invoice tree view
- and on the invoice tree view

|image2|

.. |image1| image:: https://raw.githubusercontent.com/OCA/margin-analysis/17.0/account_invoice_margin/static/description/account_invoice_form.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/margin-analysis/17.0/account_invoice_margin/static/description/account_invoice_tree.png
.. |image1| image:: https://raw.githubusercontent.com/OCA/margin-analysis/18.0/account_invoice_margin/static/description/account_invoice_form.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/margin-analysis/18.0/account_invoice_margin/static/description/account_invoice_tree.png

**Table of contents**

Expand All @@ -62,7 +62,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/margin-analysis/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin%0Aversion:%2018.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 @@ -78,29 +78,33 @@ Authors
Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

- Sergio Teruel
- Sergio Teruel

- `GRAP <http://www.grap.coop>`__:
- `GRAP <http://www.grap.coop>`__:

- Sylvain LE GAL (https://twitter.com/legalsylvain)
- Sylvain LE GAL (https://twitter.com/legalsylvain)

- `Open Source Integrators <https://www.opensourceintegrators.com>`__:
- `Open Source Integrators <https://www.opensourceintegrators.com>`__:

- Bhavesh Odedra
- Bhavesh Odedra

- `Avoin.Systems <https://www.avoin.systems>`__:
- `Avoin.Systems <https://www.avoin.systems>`__:

- Nedas Žilinskas
- Nedas Žilinskas

- `Factor Libre <https://factorlibre.com>`__:
- `Factor Libre <https://factorlibre.com>`__:

- Luis J. Salvatierra
- Luis J. Salvatierra

- `Komit <https://komit-consulting.com>`__:
- `Komit <https://komit-consulting.com>`__:

- Jean-Charles Drubay
- Jean-Charles Drubay

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

Maintainers
-----------
Expand All @@ -123,6 +127,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sergio-teruel|

This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/17.0/account_invoice_margin>`_ project on GitHub.
This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/18.0/account_invoice_margin>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion account_invoice_margin/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Account Invoice Margin",
"summary": "Show margin in invoices",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"category": "Account",
"website": "https://github.com/OCA/margin-analysis",
"author": "Tecnativa, GRAP, Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_margin/hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from odoo.tools import column_exists, create_column
from odoo.tools.sql import column_exists, create_column

_logger = logging.getLogger(__name__)

Expand Down
2 changes: 2 additions & 0 deletions account_invoice_margin/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
- Luis J. Salvatierra
- [Komit](https://komit-consulting.com):
- Jean-Charles Drubay
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia
6 changes: 3 additions & 3 deletions account_invoice_margin/report/account_invoice_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models
from odoo.tools import SQL


class AccountInvoiceReport(models.Model):
_inherit = "account.invoice.report"

margin = fields.Float(readonly=True)
margin = fields.Float(readonly=True, string="Margin Analysis")

def _select(self):
select_str = super()._select()
return f"{select_str}, line.margin_signed AS margin"
return SQL("%s, line.margin_signed AS margin", super()._select())

Check warning on line 14 in account_invoice_margin/report/account_invoice_report.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_margin/report/account_invoice_report.py#L14

Added line #L14 was not covered by tests
25 changes: 16 additions & 9 deletions account_invoice_margin/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,17 +369,17 @@ <h1 class="title">Account Invoice Margin</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c97e1417f92d2e848c7e58e05c31f394a1f93d3aaf07c4495623d98823ac1c25
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" 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 image-reference" href="https://github.com/OCA/margin-analysis/tree/17.0/account_invoice_margin"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/margin-analysis-17-0/margin-analysis-17-0-account_invoice_margin"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" 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 image-reference" href="https://github.com/OCA/margin-analysis/tree/18.0/account_invoice_margin"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/margin-analysis-18-0/margin-analysis-18-0-account_invoice_margin"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to show sales margin in invoices.</p>
<p>The new information is available:</p>
<ul class="simple">
<li>on the invoice form view</li>
</ul>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/margin-analysis/17.0/account_invoice_margin/static/description/account_invoice_form.png" /></p>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/margin-analysis/18.0/account_invoice_margin/static/description/account_invoice_form.png" /></p>
<ul class="simple">
<li>and on the invoice tree view</li>
</ul>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/margin-analysis/17.0/account_invoice_margin/static/description/account_invoice_tree.png" /></p>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/margin-analysis/18.0/account_invoice_margin/static/description/account_invoice_tree.png" /></p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -405,7 +406,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/margin-analysis/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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin%0Aversion:%2017.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/margin-analysis/issues/new?body=module:%20account_invoice_margin%0Aversion:%2018.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 Down Expand Up @@ -444,18 +445,24 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Jean-Charles Drubay</li>
</ul>
</li>
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
<li>Bhavesh Heliconia</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<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>
<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>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/17.0/account_invoice_margin">OCA/margin-analysis</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/18.0/account_invoice_margin">OCA/margin-analysis</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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# © 2016 Sergio Teruel <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields
from odoo.tests.common import Form, tagged
from odoo.tests import Form, tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
Expand Down
4 changes: 2 additions & 2 deletions account_invoice_margin/views/account_invoice_margin_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<field name="arch" type="xml">
<!-- To display new fields in invoice lines tab -->
<xpath
expr="//field[@name='invoice_line_ids']/tree/field[@name='price_unit']"
expr="//field[@name='invoice_line_ids']/list/field[@name='price_unit']"
position="after"
>
<field
Expand Down Expand Up @@ -61,7 +61,7 @@
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_invoice_tree" />
<field name="arch" type="xml">
<field name="amount_untaxed_signed" position="before">
<field name="amount_untaxed_in_currency_signed" position="before">
<field
name="margin_signed"
sum="Total"
Expand Down

0 comments on commit 52fc1e0

Please sign in to comment.