-
-
Notifications
You must be signed in to change notification settings - Fork 181
[19.0][MIG] account_invoice_margin: Migration to 19.0 #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Debora7
wants to merge
60
commits into
OCA:19.0
Choose a base branch
from
dakai-soft:19.0-mig-account-invoice-margin
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,506
−9
Open
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
d441f0e
[9.0][WIP] account_invoice_margin: New module
sergio-teruel db69e3c
[MIG] account_invoice_margin: Migration to v11
sergio-teruel 6b5f025
[FIX] account_invoice_margin: Avoid error on empty invoice_id
pedrobaeza e4362d1
[11.0][IMP] account_invoice_margin: Minor fix in the same PR
sergio-teruel 050a499
[FIX] account_invoice_margin: Set purchase_price when user has not se…
sergio-teruel 97dd484
account_invoice_margin 11.0.1.1.0
OCA-git-bot 02aedcd
[MIG] account_invoice_margin: Migration to v12.0
sergio-teruel aa991f4
[UPD] Update account_invoice_margin.pot
oca-travis c878d1d
[IMP] make purchase price computation overloadable
legalsylvain f7962a1
[IMP] account_invoice_margin: margins computed with read_group + virt…
pedrobaeza ff42b6f
[IMP] move demo data for group, in data folder
legalsylvain f201992
[UPD] Update account_invoice_margin.pot
oca-travis b590282
account_invoice_margin 12.0.2.0.0
OCA-git-bot 5db7637
Update translation files
oca-transbot 47dbbae
[IMP] account_invoice_margin: black, isort
sergio-teruel f3f16ae
[MIG] account_invoice_margin: Migration to v13.0
sergio-teruel 4dae328
[IMP] account_invoice_margin: Take on account invoice lines with down…
sergio-teruel 5627b9a
[UPD] Update account_invoice_margin.pot
oca-travis abfa3bd
Update translation files
oca-transbot 11ea109
Update translation files
oca-transbot 12cfa84
Translated using Weblate (Spanish)
HaraldPanten 2deaebd
[ADD] generic method for better inheritance
c17a983
[IMP] skip margin calculation for Down Payment invoice
b1155a7
[UPD] README.rst
OCA-git-bot 5cc6c00
account_invoice_margin 13.0.1.0.1
OCA-git-bot ca86665
[13.0][IMP] account_invoice_margin: black, isort, prettier
Reyes4711-S73 a883575
[14.0][MIG] account_invoice_margin: Migration to 14.0
Reyes4711-S73 54762f0
[IMP] account_invoice_margin: Do optional fields in tree view
sergio-teruel 600830a
[UPD] Update account_invoice_margin.pot
oca-travis 0df9d99
[UPD] README.rst
OCA-git-bot f9972c3
[IMP] account_invoice_margin: Avoid error when trying to install modu…
dbe0ef6
account_invoice_margin 14.0.1.0.1
OCA-git-bot 2a64961
[MIG] account_invoice_margin: Migration to 15.0
nedaszilinskas 13a036a
[UPD] Update account_invoice_margin.pot
7147d1f
[UPD] README.rst
OCA-git-bot e78197f
[FIX] account_invoice_margin: Take currency into account
pedrobaeza 29fff4c
account_invoice_margin 15.0.1.0.1
OCA-git-bot 4b468cd
[MIG] account_invoice_margin: Migration to 16.0
ljsalvatierra-factorlibre 5e210be
[UPD] Update account_invoice_margin.pot
7729192
[UPD] README.rst
OCA-git-bot b39321d
Added translation using Weblate (French (France) (fr_FR))
sanrav a7adc15
Translated using Weblate (French)
sanrav 980194a
Translated using Weblate (French (France) (fr_FR))
sanrav cb58d64
[UPD] README.rst
OCA-git-bot 7c80800
Update translation files
weblate 7569d87
Translated using Weblate (Spanish)
Ivorra78 9ed29ff
[IMP] account_invoice_margin: test performance improvement
josep-tecnativa e558beb
[BOT] post-merge updates
OCA-git-bot 118d2df
[IMP] account_invoice_margin: pre-commit auto fixes
jcdrubay b179796
[MIG] account_invoice_margin: Migration to 17.0
jcdrubay c08a381
[UPD] Update account_invoice_margin.pot
2b5c2b6
[BOT] post-merge updates
OCA-git-bot 2997ccd
Added translation using Weblate (Italian)
mymage 7eaf92a
Translated using Weblate (Italian)
mymage ae5ee87
[IMP] account_invoice_margin: pre-commit auto fixes
BhaveshHeliconia 6bce4c5
[MIG] account_invoice_margin: Migration to 18.0
BhaveshHeliconia d75b937
[UPD] Update account_invoice_margin.pot
4a09012
[BOT] post-merge updates
OCA-git-bot 106a470
[MIG] account_invoice_margin: Migration to 19.0
Debora7 a8ef1b5
Delet commented code.
Debora7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| .. image:: https://odoo-community.org/readme-banner-image | ||
| :target: https://odoo-community.org/get-involved?utm_source=readme | ||
| :alt: Odoo Community Association | ||
|
|
||
| ====================== | ||
| Account Invoice Margin | ||
| ====================== | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:7adca1b38d24a7449a19e13ac1a138558b8e5f6b07663158039a37391142913b | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png | ||
| :target: https://odoo-community.org/page/development-status | ||
| :alt: Production/Stable | ||
| .. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png | ||
| :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/19.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-19-0/margin-analysis-19-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=19.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| This module allows to show sales margin in invoices. | ||
|
|
||
| The new information is available: | ||
|
|
||
| - on the invoice form view | ||
|
|
||
| |image1| | ||
|
|
||
| - and on the invoice tree view | ||
|
|
||
| |image2| | ||
|
|
||
| .. |image1| image:: https://raw.githubusercontent.com/OCA/margin-analysis/19.0/account_invoice_margin/static/description/account_invoice_form.png | ||
| .. |image2| image:: https://raw.githubusercontent.com/OCA/margin-analysis/19.0/account_invoice_margin/static/description/account_invoice_tree.png | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
| This module also adds a security group. | ||
|
|
||
| 1. To activate it go to user and active "Show Invoice Margin" in | ||
| security options. | ||
|
|
||
| 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:%2019.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. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ------- | ||
|
|
||
| * Tecnativa | ||
| * GRAP | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| - `Tecnativa <https://www.tecnativa.com>`__: | ||
|
|
||
| - Sergio Teruel | ||
|
|
||
| - `GRAP <http://www.grap.coop>`__: | ||
|
|
||
| - Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
|
|
||
| - `Open Source Integrators <https://www.opensourceintegrators.com>`__: | ||
|
|
||
| - Bhavesh Odedra | ||
|
|
||
| - `Avoin.Systems <https://www.avoin.systems>`__: | ||
|
|
||
| - Nedas Žilinskas | ||
|
|
||
| - `Factor Libre <https://factorlibre.com>`__: | ||
|
|
||
| - Luis J. Salvatierra | ||
|
|
||
| - `Komit <https://komit-consulting.com>`__: | ||
|
|
||
| - Jean-Charles Drubay | ||
|
|
||
| - `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__ | ||
|
|
||
| - Bhavesh Heliconia | ||
|
|
||
| Maintainers | ||
| ----------- | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| 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. | ||
|
|
||
| .. |maintainer-sergio-teruel| image:: https://github.com/sergio-teruel.png?size=40px | ||
| :target: https://github.com/sergio-teruel | ||
| :alt: sergio-teruel | ||
|
|
||
| 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/19.0/account_invoice_margin>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # © 2017 Sergio Teruel <sergio.teruel@tecnativa.com> | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| from .hooks import pre_init_hook | ||
| from . import models | ||
| from . import report |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Copyright 2017 Sergio Teruel <sergio.teruel@tecnativa.com> | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| { | ||
| "name": "Account Invoice Margin", | ||
| "summary": "Show margin in invoices", | ||
| "version": "19.0.1.0.0", | ||
| "category": "Account", | ||
| "website": "https://github.com/OCA/margin-analysis", | ||
| "author": "Tecnativa, GRAP, Odoo Community Association (OCA)", | ||
| "license": "AGPL-3", | ||
| "development_status": "Production/Stable", | ||
| "maintainers": ["sergio-teruel"], | ||
| "application": False, | ||
| "installable": True, | ||
| "depends": ["account"], | ||
| "data": [ | ||
| "security/account_invoice_margin_security.xml", | ||
| "views/account_invoice_margin_view.xml", | ||
| ], | ||
| "pre_init_hook": "pre_init_hook", | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import logging | ||
|
|
||
| from odoo.tools.sql import column_exists, create_column | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
||
| COLUMNS = ( | ||
| ("account_move", "margin"), | ||
| ("account_move", "margin_signed"), | ||
| ("account_move", "margin_percent"), | ||
| ("account_move_line", "margin"), | ||
| ("account_move_line", "margin_signed"), | ||
| ("account_move_line", "margin_percent"), | ||
| ("account_move_line", "purchase_price"), | ||
| ) | ||
|
|
||
|
|
||
| def pre_init_hook(env): | ||
| cr = env.cr | ||
| for table, column in COLUMNS: | ||
| if not column_exists(cr, table, column): | ||
| _logger.info("Create column %s in database", column) | ||
| create_column(cr, table, column, "numeric") | ||
| cr.execute( | ||
| """ | ||
| WITH am AS( | ||
| SELECT id FROM account_move WHERE move_type NOT ILIKE 'in_%' | ||
| ) | ||
| UPDATE account_move_line | ||
| SET margin = price_subtotal, margin_signed = price_subtotal, | ||
| margin_percent = 100 | ||
| FROM am | ||
| WHERE am.id = account_move_line.move_id | ||
| AND price_subtotal > 0.0; | ||
| """ | ||
| ) | ||
| cr.execute( | ||
| """ | ||
| WITH aml AS( | ||
| SELECT | ||
| account_move_line.move_id, | ||
| SUM(account_move_line.margin) AS sum_margin, | ||
| SUM(account_move_line.margin_signed) AS sum_margin_signed | ||
| FROM account_move_line | ||
| INNER JOIN account_move | ||
| ON account_move.id = account_move_line.move_id | ||
| GROUP BY account_move_line.move_id | ||
| ) | ||
| UPDATE account_move | ||
| SET margin = aml.sum_margin, | ||
| margin_signed = aml.sum_margin_signed, | ||
| margin_percent = aml.sum_margin_signed / amount_untaxed * 100 | ||
| FROM aml | ||
| WHERE account_move.id = aml.move_id | ||
| AND account_move.amount_untaxed > 0.0 | ||
| """ | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * account_invoice_margin | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 18.0\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "Last-Translator: \n" | ||
| "Language-Team: \n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \n" | ||
| "Plural-Forms: \n" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_move_line__purchase_price | ||
| msgid "Cost" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:ir.model,name:account_invoice_margin.model_account_invoice_report | ||
| msgid "Invoices Statistics" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:ir.model,name:account_invoice_margin.model_account_move | ||
| msgid "Journal Entry" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:ir.model,name:account_invoice_margin.model_account_move_line | ||
| msgid "Journal Item" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_bank_statement_line__margin | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_move__margin | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_move_line__margin | ||
| msgid "Margin" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_bank_statement_line__margin_percent | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_move__margin_percent | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_move_line__margin_percent | ||
| msgid "Margin (%)" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_invoice_report__margin | ||
| msgid "Margin Analysis" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_bank_statement_line__margin_signed | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_move__margin_signed | ||
| #: model:ir.model.fields,field_description:account_invoice_margin.field_account_move_line__margin_signed | ||
| msgid "Margin Signed" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model:res.groups,name:account_invoice_margin.group_account_invoice_margin_security | ||
| msgid "Show Invoice Margin" | ||
| msgstr "" | ||
|
|
||
| #. module: account_invoice_margin | ||
| #: model_terms:ir.ui.view,arch_db:account_invoice_margin.view_account_invoice_tree | ||
| msgid "Total" | ||
| msgstr "" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we changing this file?