Skip to content

Commit 82fa5e0

Browse files
committed
Merge PR #1465 into 16.0
Signed-off-by rousseldenis
2 parents 87aa029 + 3033869 commit 82fa5e0

19 files changed

+1720
-0
lines changed
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
============================
2+
Product cost price avco sync
3+
============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:f07176b3a7502ceb2553fc8c5613eb3680f27cd6fa3a28d492b55a6fcee661c1
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Production/Stable
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/product_cost_price_avco_sync
21+
:alt: OCA/stock-logistics-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-product_cost_price_avco_sync
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows to sync cost price products with average cost method from
32+
stock moves price unit.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Bug Tracker
40+
===========
41+
42+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
43+
In case of trouble, please check there if your issue has already been reported.
44+
If you spotted it first, help us to smash it by providing a detailed and welcomed
45+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20product_cost_price_avco_sync%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
46+
47+
Do not contact contributors directly about support or help with technical issues.
48+
49+
Credits
50+
=======
51+
52+
Authors
53+
~~~~~~~
54+
55+
* Tecnativa
56+
57+
Contributors
58+
~~~~~~~~~~~~
59+
60+
* `Tecnativa <https://www.tecnativa.com>`_:
61+
62+
* Carlos Dauden
63+
* Sergio Teruel
64+
* Carlos Roca
65+
66+
Maintainers
67+
~~~~~~~~~~~
68+
69+
This module is maintained by the OCA.
70+
71+
.. image:: https://odoo-community.org/logo.png
72+
:alt: Odoo Community Association
73+
:target: https://odoo-community.org
74+
75+
OCA, or the Odoo Community Association, is a nonprofit organization whose
76+
mission is to support the collaborative development of Odoo features and
77+
promote its widespread use.
78+
79+
.. |maintainer-carlosdauden| image:: https://github.com/carlosdauden.png?size=40px
80+
:target: https://github.com/carlosdauden
81+
:alt: carlosdauden
82+
.. |maintainer-sergio-teruel| image:: https://github.com/sergio-teruel.png?size=40px
83+
:target: https://github.com/sergio-teruel
84+
:alt: sergio-teruel
85+
86+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
87+
88+
|maintainer-carlosdauden| |maintainer-sergio-teruel|
89+
90+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/16.0/product_cost_price_avco_sync>`_ project on GitHub.
91+
92+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
from . import models
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2020 Tecnativa - Carlos Dauden
2+
# Copyright 2020 Tecnativa - Sergio Teruel
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
{
5+
"name": "Product cost price avco sync",
6+
"summary": "Set product cost price from updated moves",
7+
"version": "16.0.1.0.0",
8+
"development_status": "Production/Stable",
9+
"category": "Stock",
10+
"website": "https://github.com/OCA/stock-logistics-workflow",
11+
"author": "Tecnativa, Odoo Community Association (OCA)",
12+
"maintainers": ["carlosdauden", "sergio-teruel"],
13+
"license": "AGPL-3",
14+
"installable": True,
15+
"depends": ["stock_account"],
16+
}
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * product_cost_price_avco_sync
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 12.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2019-10-29 10:28+0000\n"
10+
"PO-Revision-Date: 2023-10-28 18:53+0000\n"
11+
"Last-Translator: Ivorra78 <[email protected]>\n"
12+
"Language-Team: \n"
13+
"Language: es\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: 8bit\n"
17+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
18+
"X-Generator: Weblate 4.17\n"
19+
20+
#. module: product_cost_price_avco_sync
21+
#: code:addons/product_cost_price_avco_sync/models/stock_valuation_layer.py:0
22+
#, python-format
23+
msgid ""
24+
"More than one stock move line to assign the new stock valuation layer "
25+
"quantity"
26+
msgstr ""
27+
"Más de una línea de movimiento de existencias para asignar la nueva cantidad "
28+
"de capa de valoración de existencias"
29+
30+
#. module: product_cost_price_avco_sync
31+
#: model:ir.model,name:product_cost_price_avco_sync.model_product_product
32+
msgid "Product"
33+
msgstr "Producto"
34+
35+
#. module: product_cost_price_avco_sync
36+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_move_line
37+
msgid "Product Moves (Stock Move Line)"
38+
msgstr "Movimientos de Producto (Línea de Movimiento de Existencias)"
39+
40+
#. module: product_cost_price_avco_sync
41+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_valuation_layer
42+
msgid "Stock Valuation Layer"
43+
msgstr "Nivel de Valoración de Existencias"
44+
45+
#. module: product_cost_price_avco_sync
46+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_picking
47+
msgid "Transfer"
48+
msgstr "Transferir"
49+
50+
#~ msgid "Stock Move"
51+
#~ msgstr "Movimiento de existencias"
52+
53+
#~ msgid "Purchase Order Line"
54+
#~ msgstr "Línea pedido de compra"
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * product_cost_price_avco_sync
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2023-12-05 17:34+0000\n"
10+
"Last-Translator: mymage <[email protected]>\n"
11+
"Language-Team: none\n"
12+
"Language: it\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 4.17\n"
18+
19+
#. module: product_cost_price_avco_sync
20+
#: code:addons/product_cost_price_avco_sync/models/stock_valuation_layer.py:0
21+
#, python-format
22+
msgid ""
23+
"More than one stock move line to assign the new stock valuation layer "
24+
"quantity"
25+
msgstr ""
26+
"Più di una riga movimento magazzino da assegnare alla nuava quantità livello "
27+
"valorizzazione magazzino"
28+
29+
#. module: product_cost_price_avco_sync
30+
#: model:ir.model,name:product_cost_price_avco_sync.model_product_product
31+
msgid "Product"
32+
msgstr "Prodotto"
33+
34+
#. module: product_cost_price_avco_sync
35+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_move_line
36+
msgid "Product Moves (Stock Move Line)"
37+
msgstr "Movimenti prodotto (riga movimento di magazzino)"
38+
39+
#. module: product_cost_price_avco_sync
40+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_valuation_layer
41+
msgid "Stock Valuation Layer"
42+
msgstr "Livello valutazione magazzino"
43+
44+
#. module: product_cost_price_avco_sync
45+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_picking
46+
msgid "Transfer"
47+
msgstr "Trasferimento"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * product_cost_price_avco_sync
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: product_cost_price_avco_sync
17+
#: code:addons/product_cost_price_avco_sync/models/stock_valuation_layer.py:0
18+
#, python-format
19+
msgid ""
20+
"More than one stock move line to assign the new stock valuation layer "
21+
"quantity"
22+
msgstr ""
23+
24+
#. module: product_cost_price_avco_sync
25+
#: model:ir.model,name:product_cost_price_avco_sync.model_product_product
26+
msgid "Product"
27+
msgstr ""
28+
29+
#. module: product_cost_price_avco_sync
30+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_move_line
31+
msgid "Product Moves (Stock Move Line)"
32+
msgstr ""
33+
34+
#. module: product_cost_price_avco_sync
35+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_valuation_layer
36+
msgid "Stock Valuation Layer"
37+
msgstr ""
38+
39+
#. module: product_cost_price_avco_sync
40+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_picking
41+
msgid "Transfer"
42+
msgstr ""
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * product_cost_price_avco_sync
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 12.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2020-06-23 03:19+0000\n"
10+
"Last-Translator: Fernando Colus <[email protected]>\n"
11+
"Language-Team: none\n"
12+
"Language: pt_BR\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n > 1;\n"
17+
"X-Generator: Weblate 3.10\n"
18+
19+
#. module: product_cost_price_avco_sync
20+
#: code:addons/product_cost_price_avco_sync/models/stock_valuation_layer.py:0
21+
#, python-format
22+
msgid ""
23+
"More than one stock move line to assign the new stock valuation layer "
24+
"quantity"
25+
msgstr ""
26+
27+
#. module: product_cost_price_avco_sync
28+
#: model:ir.model,name:product_cost_price_avco_sync.model_product_product
29+
msgid "Product"
30+
msgstr ""
31+
32+
#. module: product_cost_price_avco_sync
33+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_move_line
34+
msgid "Product Moves (Stock Move Line)"
35+
msgstr ""
36+
37+
#. module: product_cost_price_avco_sync
38+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_valuation_layer
39+
msgid "Stock Valuation Layer"
40+
msgstr ""
41+
42+
#. module: product_cost_price_avco_sync
43+
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_picking
44+
msgid "Transfer"
45+
msgstr "Transferência"
46+
47+
#~ msgid "Stock Move"
48+
#~ msgstr "Movimentação de Estoque"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
from . import stock_move_line
3+
from . import stock_picking
4+
from . import stock_valuation_layer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2019 Carlos Dauden - Tecnativa <[email protected]>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, models
5+
6+
7+
class StockMoveLine(models.Model):
8+
_inherit = "stock.move.line"
9+
10+
@api.model
11+
def _create_correction_svl(self, move, diff):
12+
if move.product_id.cost_method != "average" or self.env.context.get(
13+
"new_stock_move_create", False
14+
):
15+
return super()._create_correction_svl(move, diff)
16+
for svl in move.stock_valuation_layer_ids:
17+
# TODO: Review if is dropshipping
18+
if move._is_out():
19+
svl.quantity -= diff
20+
else:
21+
svl.quantity += diff
22+
23+
@api.model_create_multi
24+
def create(self, vals_list):
25+
return super(
26+
StockMoveLine, self.with_context(new_stock_move_create=True)
27+
).create(vals_list)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2019 Carlos Dauden - Tecnativa <[email protected]>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class StockPicking(models.Model):
8+
_inherit = "stock.picking"
9+
10+
def action_done(self):
11+
"""Avoid AVCO cost price recomputation when validating picking"""
12+
return super(StockPicking, self.with_context(skip_avco_sync=True)).action_done()

0 commit comments

Comments
 (0)