-
-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by rousseldenis
- Loading branch information
Showing
21 changed files
with
1,152 additions
and
0 deletions.
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,108 @@ | ||
============================ | ||
Sale Order Line Chained Move | ||
============================ | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:b1f954bb0f57c05b8512af8b8222a08dd6aa534cbb965ba9e251407b0655fa4c | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/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%2Fsale--workflow-lightgray.png?logo=github | ||
:target: https://github.com/OCA/sale-workflow/tree/14.0/sale_order_line_chained_move | ||
:alt: OCA/sale-workflow | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_order_line_chained_move | ||
: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/sale-workflow&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module defines a technical field to store the related sale order line | ||
on stock move level in order to get all chained moves on sale order line side. | ||
|
||
In case the stock move contains multiple lines of the same product, Odoo's | ||
default behaviour is to merge those lines into the same one. | ||
|
||
With this module, there is the option of preserving one move for each | ||
sale order line, which enables correct tracing of each move back to its source. | ||
|
||
Each stock rule can define how the moves it creates should behave. | ||
If at least one move in the chain of moves is set to preserve one move | ||
per sale order line, all moves in the chain will act accordingly. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
Navigate to Inventory > Configuration > Rules. | ||
|
||
For each rule, select "Preserve Separate Sale Order Lines" if | ||
you would like to have one move for each order line. Uncheck the | ||
option if you're ok with Odoo merging lines with the same product. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_order_line_chained_move%0Aversion:%2014.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 | ||
~~~~~~~ | ||
|
||
* ACSONE SA/NV | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Denis Roussel <denis.roussel@acsone.eu> | ||
* Ooops404 | ||
* PyTech SRL | ||
|
||
* Alessandro Uffreduzzi <alessandro.uffreduzzi@pytech.it> | ||
|
||
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-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px | ||
:target: https://github.com/rousseldenis | ||
:alt: rousseldenis | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-rousseldenis| | ||
|
||
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/14.0/sale_order_line_chained_move>`_ 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,2 @@ | ||
from . import models | ||
from .hooks import post_init_hook |
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,18 @@ | ||
# Copyright 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Sale Order Line Chained Move", | ||
"summary": """ | ||
This module adds a field on sale order line to get all related move lines""", | ||
"version": "15.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "ACSONE SA/NV,Odoo Community Association (OCA)", | ||
"maintainers": ["rousseldenis"], | ||
"website": "https://github.com/OCA/sale-workflow", | ||
"development_status": "Production/Stable", | ||
"depends": ["sale_stock"], | ||
"demo": ["demo/sale_order.xml"], | ||
"data": ["views/stock_rule_views.xml"], | ||
"post_init_hook": "post_init_hook", | ||
} |
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,89 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2021 ACSONE SA/NV | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
<!-- Product --> | ||
<record id="product_product_two_steps" model="product.product"> | ||
<field name="name">Product Test Sale Chained Move</field> | ||
<field name="categ_id" ref="product.product_category_5" /> | ||
<field name="standard_price">2870.0</field> | ||
<field name="list_price">2950.0</field> | ||
<field name="type">product</field> | ||
<field name="weight">0.01</field> | ||
<field name="uom_id" ref="uom.product_uom_unit" /> | ||
<field name="uom_po_id" ref="uom.product_uom_unit" /> | ||
<field name="default_code">SALE_CHAINED</field> | ||
</record> | ||
<!-- Product Stock Rules - Define for demos without having to change steps --> | ||
<record id="route_product_sale_chained" model="stock.location.route"> | ||
<field name="name">Route for Chained Sale Moves with Pack</field> | ||
</record> | ||
<record id="sale_chained_stock_out_rule" model="stock.rule"> | ||
<field name="name">Stock -> Pack</field> | ||
<field | ||
name="location_id" | ||
eval="obj().env.ref('stock.warehouse0').wh_pack_stock_loc_id" | ||
model="stock.location" | ||
/> | ||
<field name="location_src_id" ref="stock.stock_location_stock" /> | ||
<field name="route_id" ref="route_product_sale_chained" /> | ||
<field name="action">pull</field> | ||
<field name="picking_type_id" ref="stock.picking_type_internal" /> | ||
</record> | ||
<record id="sale_chained_quality_out_rule" model="stock.rule"> | ||
<field name="name">Pack -> Out</field> | ||
<field name="location_id" ref="stock.stock_location_output" /> | ||
<field | ||
name="location_src_id" | ||
eval="obj().env.ref('stock.warehouse0').wh_pack_stock_loc_id" | ||
model="stock.location" | ||
/> | ||
<field name="route_id" ref="route_product_sale_chained" /> | ||
<field name="procure_method">make_to_order</field> | ||
<field name="action">pull</field> | ||
<field name="picking_type_id" ref="stock.picking_type_internal" /> | ||
</record> | ||
<record id="sale_chained_out_customers_rule" model="stock.rule"> | ||
<field name="name">Out -> Customers</field> | ||
<field name="location_id" ref="stock.stock_location_customers" /> | ||
<field name="location_src_id" ref="stock.stock_location_output" /> | ||
<field name="route_id" ref="route_product_sale_chained" /> | ||
<field name="procure_method">make_to_order</field> | ||
<field name="action">pull</field> | ||
<field name="picking_type_id" ref="stock.picking_type_out" /> | ||
</record> | ||
<record id="sale_order_stock" model="sale.order"> | ||
<field name="partner_id" ref="base.res_partner_2" /> | ||
<field name="partner_invoice_id" ref="base.res_partner_2" /> | ||
<field name="partner_shipping_id" ref="base.res_partner_2" /> | ||
<field name="user_id" ref="base.user_demo" /> | ||
<field name="pricelist_id" ref="product.list0" /> | ||
<field name="team_id" ref="sales_team.team_sales_department" /> | ||
<field name="campaign_id" ref="utm.utm_campaign_email_campaign_products" /> | ||
<field name="medium_id" ref="utm.utm_medium_email" /> | ||
<field name="source_id" ref="sale.utm_source_sale_order_0" /> | ||
<field | ||
name="date_order" | ||
eval="(DateTime.today() - relativedelta(months=1)).strftime('%Y-%m-%d %H:%M')" | ||
/> | ||
</record> | ||
<record id="sale_order_line_1" model="sale.order.line"> | ||
<field name="order_id" ref="sale_order_stock" /> | ||
<field | ||
name="name" | ||
model="sale.order.line" | ||
eval="obj().env.ref('product.product_product_25').get_product_multiline_description_sale()" | ||
/> | ||
<field name="product_id" ref="product_product_two_steps" /> | ||
<field name="product_uom_qty">3</field> | ||
<field name="product_uom" ref="uom.product_uom_unit" /> | ||
<field name="route_id" ref="route_product_sale_chained" /> | ||
<field name="price_unit">2950.00</field> | ||
</record> | ||
<function model="sale.order" name="action_confirm"> | ||
<value | ||
model="sale.order" | ||
eval="ref('sale_order_line_chained_move.sale_order_stock')" | ||
/> | ||
</function> | ||
</odoo> |
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,31 @@ | ||
# Copyright 2021 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import SUPERUSER_ID, api | ||
|
||
|
||
def __find_origin_moves(moves): | ||
all_moves = moves | ||
for move in moves: | ||
if move.move_orig_ids: | ||
all_moves |= __find_origin_moves(move.move_orig_ids) | ||
return all_moves | ||
|
||
|
||
def __fill_related(moves, line_id): | ||
for move in moves: | ||
moves_to_write = move | ||
if move.move_orig_ids: | ||
moves_to_write |= __find_origin_moves(move.move_orig_ids) | ||
moves_to_write.write({"related_sale_line_id": line_id.id}) | ||
|
||
|
||
def _fill_in_related_sale_line(env): | ||
"""Update related_sale_line_id on recursive moves""" | ||
moves = env["stock.move"].search([("sale_line_id", "!=", False)]) | ||
for move in moves: | ||
__fill_related(move.move_orig_ids, move.sale_line_id) | ||
|
||
|
||
def post_init_hook(cr, registry): | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
_fill_in_related_sale_line(env) |
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,108 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_order_line_chained_move | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-11-02 17:38+0000\n" | ||
"Last-Translator: Francesco Foresti <francesco.foresti@ooops404.com>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line__chained_move_ids | ||
msgid "Chained Move" | ||
msgstr "Movimento collegato" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line__display_name | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move__display_name | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule__display_name | ||
msgid "Display Name" | ||
msgstr "Nome visualizzato" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line__id | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move__id | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule__id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_sale_order_line____last_update | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move____last_update | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule____last_update | ||
msgid "Last Modified on" | ||
msgstr "Ultima modifica il" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_out_customers_rule | ||
msgid "Out -> Customers" | ||
msgstr "In uscita -> Clienti" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_quality_out_rule | ||
msgid "Pack -> Out" | ||
msgstr "Pack -> In uscita" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_rule__preserve_separate_so_lines | ||
msgid "Preserve Separate Sale Order Lines" | ||
msgstr "Preserva righe ordine di vendita separate" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model.fields,help:sale_order_line_chained_move.field_stock_rule__preserve_separate_so_lines | ||
msgid "" | ||
"Prevents Odoo's default behaviour of merging moves with the same product." | ||
msgstr "" | ||
"Previene il comportamento base di odoo di unire i movimenti di magazzino " | ||
"dello stesso prodotto." | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:product.product,name:sale_order_line_chained_move.product_product_two_steps | ||
#: model:product.template,name:sale_order_line_chained_move.product_product_two_steps_product_template | ||
msgid "Product Test Sale Chained Move" | ||
msgstr "Prodotto test vendita movimento collegato" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model.fields,field_description:sale_order_line_chained_move.field_stock_move__related_sale_line_id | ||
msgid "Related Sale Line" | ||
msgstr "Riga ordine di vendita collegata" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:stock.location.route,name:sale_order_line_chained_move.route_product_sale_chained | ||
msgid "Route for Chained Sale Moves with Pack" | ||
msgstr "Rotta per movimenti collegati vendita con pack" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model,name:sale_order_line_chained_move.model_sale_order_line | ||
msgid "Sales Order Line" | ||
msgstr "Riga ordine di vendita" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:stock.rule,name:sale_order_line_chained_move.sale_chained_stock_out_rule | ||
msgid "Stock -> Pack" | ||
msgstr "Giacenza -> Pack" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model,name:sale_order_line_chained_move.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimento di magazzino" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:ir.model,name:sale_order_line_chained_move.model_stock_rule | ||
msgid "Stock Rule" | ||
msgstr "Regola di giacenza" | ||
|
||
#. module: sale_order_line_chained_move | ||
#: model:product.product,uom_name:sale_order_line_chained_move.product_product_two_steps | ||
#: model:product.template,uom_name:sale_order_line_chained_move.product_product_two_steps_product_template | ||
msgid "Units" | ||
msgstr "Unità" |
Oops, something went wrong.