-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
[17.0]]MIG]sale_stock_analytic: Migration to 17.0 #617
Open
moitabenfdz
wants to merge
57
commits into
OCA:17.0
Choose a base branch
from
DynAppsNV:17.0-mig-sale_stock_analytic
base: 17.0
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
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.
Open
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
098ae42
migration to v7
3306b13
merge with mathieu
yvanpatry 2be3ced
update for migration V7
Pierre-Monod 6bb9de6
add images
c725d52
update for wilog v7.0
Pierre-Monod 58248fa
Add contract customer invoice and migrate [IMP] SMS erase print [IMP]…
yvanpatry 3dd157b
- change the logo of all modules
mathieuvatel 894d517
- Added new module stock_analytic
fv-clearcorp 5f46632
Adapt original module according OCA Standard
andhit-r 9b07f25
[MIG]stock_analytic to v9
AaronHForgeFlow deb3cdf
[MIG]stock_analytic to v10
AaronHForgeFlow cf00ab4
11.0 MIG stock_analytic
jaredkipe 5bafae3
Add the ability to pick Analytic account on picking form.
jaredkipe 8f22389
Translated using Weblate (German)
rschnapka 20a5997
[MIG]stock_analytic to v12
AaronHForgeFlow a47c513
[MIG] Updated the tests of the module stock_analytic.
59dc3b2
Translated using Weblate (Portuguese (Brazil))
marcelsavegnago 2aa857a
Translated using Weblate (Catalan)
3d1ecab
[12.0] [FIX] Wrong runbot link in readme
Jerther 01a89fe
[12.0] [FIX] stock_analytic: Analytic account field is in wrong page
Jerther a95b083
Translated using Weblate (Croatian)
badbole 1e8c50e
[IMP] stock_analytic: Add analytic account to scrap
max3903 bdd3250
Translated using Weblate (German)
marylla 9609bc1
Translated using Weblate (Portuguese)
alvarorib 47a1947
Translated using Weblate (Spanish)
ruthbeat 102f32f
[FIX] Apply analytic account on COGS account when booking customer in…
1a54a6d
[IMP] stock_analytic: black, isort
jimhoefnagels 6e456d9
[MIG] stock_analytic: Migration to 13.0
jimhoefnagels b35d6c6
stock_analytic 12.0.1.1.2
jimhoefnagels fd8a222
[IMP] stock_analytic: black, isort
jimhoefnagels 681f0b4
[MIG] stock_analytic: Migration to 13.0
jimhoefnagels 00ec9b1
Translated using Weblate (Portuguese (Brazil))
9d77082
[UPD] Eficent -> ForgeFlow
MiquelRForgeFlow e75f6d0
[13.0][IMP] stock_analytic - add analytic tags on stock move
baimont fe6dfda
[IMP] stock_analytic: black, isort, prettier
alan196 d50e4cd
[MIG] stock_analytic: Migration to 14.0
alan196 567503e
[14.0][IMP] stock_analytic: Transmit analytic account to new moves
rousseldenis e410fba
Translated using Weblate (Portuguese (Brazil))
caf5504
Translated using Weblate (Catalan)
Noel000 7eac7d5
[14.0][IMP] stock_analytic: Add analytic on move lines tree view
rousseldenis d91a479
[IMP] stock_analytic: Take into account extra move lines flow
rousseldenis 2f19cf1
[MIG] stock_analytic: Migration to 16.0
nicomacr 98a14fe
[IMP] stock_analytic: add validation on analytic distribution
yostashiro e5d6355
[16.0][IMP] stock_analytic: add analytic distribution to move tree re…
ThiagoMForgeFlow 6e5110d
Translated using Weblate (Dutch)
Jan-Onestein ea47702
Translated using Weblate (Spanish)
Ivorra78 9113bf8
Translated using Weblate (Portuguese (Brazil))
adrianojprado 5f4c575
[IMP] stock_analytic: pre-commit stuff
moitabenfdz f73b68e
[MIG] stock_analytic: Migration to 17.0
moitabenfdz f9ed7bc
[13.0][ADD] new module sale_stock_analytic
baimont 192b337
[14.0][MIG] sale_stock_analytic
rousseldenis a915813
[IMP] sale_stock_analytic: Depends on sale_stock
rousseldenis cf77e63
[IMP] sale_stock_analytic: Improve tests
rousseldenis cb21c36
[MIG] sale_stock_analytic: Migration to 15.0
moitabenfdz 56252c2
[MIG] sale_stock_analytic: Migration to 16.0
moitabenfdz 5b900c8
[IMP] sale_stock_analytic: pre-commit stuff
moitabenfdz 96ea9fa
[MIG] sale_stock_analytic: Migration to 17.0
moitabenfdz File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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,64 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=================== | ||
Sale Stock Analytic | ||
=================== | ||
|
||
Copies the analytic account of the sale order and the analytic tags of the sale order line to the stock move | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to your sale order | ||
#. Set values for analytic tags on your sale order lines | ||
#. Set value for analytic account on your sale order | ||
#. Confirm sale order | ||
#. ... and you should have your analytic account and analytic tags on your stock moves | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/87/13.0 | ||
|
||
.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt | ||
.. branch is "8.0" for example | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smash it by providing detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Benoit Aimont <benoit.aimont@acsone.eu> | ||
* Marcos Oitabén <marcos.oitaben@dynapps.eu> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
This file contains 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 @@ | ||
from . import models |
This file contains 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,14 @@ | ||
# Copyright 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Sale Stock Analytic", | ||
"summary": """ | ||
Copies the analytic account of the sale order and the analytic tags | ||
of the sale order line to the stock move""", | ||
"version": "17.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "ACSONE SA/NV,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/account-analytic", | ||
"depends": ["sale_stock", "stock_analytic"], | ||
} |
This file contains 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,34 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_stock_analytic | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.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: sale_stock_analytic | ||
#: model:ir.model.fields,field_description:sale_stock_analytic.field_stock_rule__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: sale_stock_analytic | ||
#: model:ir.model.fields,field_description:sale_stock_analytic.field_stock_rule__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: sale_stock_analytic | ||
#: model:ir.model.fields,field_description:sale_stock_analytic.field_stock_rule____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: sale_stock_analytic | ||
#: model:ir.model,name:sale_stock_analytic.model_stock_rule | ||
msgid "Stock Rule" | ||
msgstr "" |
This file contains 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 @@ | ||
from . import stock_rule |
This file contains 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,38 @@ | ||
# Copyright 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockRule(models.Model): | ||
_inherit = "stock.rule" | ||
|
||
def _get_stock_move_values( | ||
self, | ||
product_id, | ||
product_qty, | ||
product_uom, | ||
location_id, | ||
name, | ||
origin, | ||
company_id, | ||
values, | ||
): | ||
move_values = super()._get_stock_move_values( | ||
product_id, | ||
product_qty, | ||
product_uom, | ||
location_id, | ||
name, | ||
origin, | ||
company_id, | ||
values, | ||
) | ||
sol_id = move_values.get("sale_line_id", False) | ||
if sol_id: | ||
sol_model = self.env["sale.order.line"] | ||
sol = sol_model.browse(sol_id) | ||
analytic_distribution = sol.analytic_distribution | ||
if analytic_distribution: | ||
move_values.update({"analytic_distribution": analytic_distribution}) | ||
return move_values |
This file contains 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,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 @@ | ||
from . import test_sale_stock_analytic |
This file contains 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,42 @@ | ||
# Copyright 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestSaleStockAnalytic(TransactionCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.sale_order_model = cls.env["sale.order"] | ||
cls.sale_order_line_model = cls.env["sale.order.line"] | ||
cls.product_model = cls.env["product.product"] | ||
cls.res_partner_model = cls.env["res.partner"] | ||
|
||
cls.partner = cls.res_partner_model.create({"name": "Partner test"}) | ||
cls.product = cls.product_model.create({"name": "Product test"}) | ||
cls.analytic_account = cls.env.ref("analytic.analytic_agrolait") | ||
|
||
cls.sale_order = cls.sale_order_model.create( | ||
{ | ||
"partner_id": cls.partner.id, | ||
"analytic_account_id": cls.analytic_account.id, | ||
} | ||
) | ||
cls.sale_order_line = cls.sale_order_line_model.create( | ||
{ | ||
"name": "sale order line test", | ||
"order_id": cls.sale_order.id, | ||
"product_id": cls.product.id, | ||
"analytic_distribution": dict( | ||
{str(cls.env.ref("analytic.analytic_agrolait").id): 100.0} | ||
), | ||
} | ||
) | ||
|
||
def test_sale_stock_analytic(self): | ||
self.sale_order.action_confirm() | ||
self.move = self.sale_order.picking_ids.move_ids_without_package | ||
self.assertEqual( | ||
self.move.analytic_distribution, self.sale_order_line.analytic_distribution | ||
) |
This file contains 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,124 @@ | ||
============== | ||
Stock Analytic | ||
============== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:a86e6eadbda1a82f8959ab9abed984ad2f25b1a351ad6563deafb50ef3f6183f | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-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%2Faccount--analytic-lightgray.png?logo=github | ||
:target: https://github.com/OCA/account-analytic/tree/17.0/stock_analytic | ||
:alt: OCA/account-analytic | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/account-analytic-17-0/account-analytic-17-0-stock_analytic | ||
: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/account-analytic&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Adds Analytic Distribution field in stock move to be able to get | ||
analytic information when generating the journal items. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
As necessary, go to *Invoicing > Configuration > Analytic Plans*, open | ||
the relevant record and update the applicability for 'Stock Move'. | ||
|
||
Usage | ||
===== | ||
|
||
To Assign an Analytic Account to a Stock Move | ||
--------------------------------------------- | ||
|
||
You need to: | ||
|
||
1. Create manually or open draft picking | ||
2. Add move lines and assign an **analytic account** in Analytic | ||
Distribution field | ||
|
||
Assigned Journal Items created from Stock Move with Analytic Account | ||
-------------------------------------------------------------------- | ||
|
||
If stock move automatically create journal entry, the journal entry will | ||
contain journal items with following rule: | ||
|
||
1. Journal item with account equal to product's valuation account will | ||
not be assigned to any analytic account. | ||
2. Journal item with account different to product's valuation account | ||
will be assigned to an analytic account according to the stock move's | ||
analytic account. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-analytic/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/account-analytic/issues/new?body=module:%20stock_analytic%0Aversion:%2017.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 | ||
------- | ||
|
||
* Julius Network Solutions | ||
* ClearCorp | ||
* OpenSynergy Indonesia | ||
* Hibou Corp. | ||
|
||
Contributors | ||
------------ | ||
|
||
- Hanane ELKHAL <hanane@julius.fr> | ||
- Yvan Patry <yvan@julius.fr> | ||
- Pierre <pierre@julius.fr> | ||
- Mathieu VATEL <mathieu@julius.fr> | ||
- Fabio Vílchez <fabio.vilchez@clearcorp.co.cr> | ||
- Andhitia Rama <andhitia.r@gmail.com> | ||
- Michael Viriyananda <viriyananda.michael@gmail.com> | ||
- Aaron Henriquez <ahenriquez@forgeflow.com> | ||
- Jared Kipe <jared@hibou.io> | ||
- Alan Ramos <alan.ramos@jarsa.com.mx> | ||
- Mantas Šniukas <mantas@vialaurea.lt> | ||
- Marcos Oitabén <marcos.oitaben@dynapps.eu> | ||
- `Quartile <https://www.quartile.co>`__: | ||
|
||
- Yoshi Tashiro | ||
|
||
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. | ||
|
||
This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/17.0/stock_analytic>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains 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,3 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models |
This file contains 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,27 @@ | ||
# Copyright 2013 Julius Network Solutions | ||
# Copyright 2015 Clear Corp | ||
# Copyright 2016 OpenSynergy Indonesia | ||
# Copyright 2017 ForgeFlow S.L. | ||
# Copyright 2018 Hibou Corp. | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Stock Analytic", | ||
"summary": "Adds analytic distribution in stock move", | ||
"version": "17.0.1.0.0", | ||
"author": "Julius Network Solutions, " | ||
"ClearCorp, OpenSynergy Indonesia, " | ||
"Hibou Corp., " | ||
"Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/account-analytic", | ||
"category": "Warehouse Management", | ||
"license": "AGPL-3", | ||
"depends": ["stock_account", "analytic"], | ||
"data": [ | ||
"views/stock_move_views.xml", | ||
"views/stock_scrap_views.xml", | ||
"views/stock_move_line_views.xml", | ||
"views/stock_picking_views.xml", | ||
], | ||
"installable": True, | ||
} |
Oops, something went wrong.
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.
You might take into account the case where analytic account is at the sale order level...
you might cherry-pick DynAppsNV#2
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.
Alternatively, Odoo's own logic merges the two when preparing the invoice line information from a sale line: https://github.com/odoo/odoo/blob/1648ee1abff1ae12b3933baa85a2e048fa2eb557/addons/sale/models/sale_order_line.py#L1142C9-L1142C35.