Skip to content
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

[16.0][MIG] product_cost_price_avco_sync: Migration to 16.0 #1465

Open
wants to merge 76 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
1fb7413
[ADD] product_cost_price_avco_sync: New module to sync product cost w…
sergio-teruel Oct 29, 2019
099b63e
[IMP] product_cost_price_avco_sync: Cover more use cases
carlosdauden Nov 7, 2019
70d3548
[UPD] Update product_cost_price_avco_sync.pot
oca-travis Jan 10, 2020
982071a
[MIG] product_cost_price_avco_sync: Migration to 12.0
carlosdauden Jan 16, 2020
c5d28cc
Update translation files
oca-transbot Feb 17, 2020
67e344a
[FIX] product_cost_price_avco_sync: Aleatory error because compare va…
carlosdauden Mar 4, 2020
e73055c
product_cost_price_avco_sync 12.0.1.0.1
OCA-git-bot Mar 12, 2020
f0ad407
[IMP] product_cost_price_avco_sync: Fix test. Aleatory error
sergio-teruel Apr 4, 2020
83d9787
product_cost_price_avco_sync 12.0.1.0.2
OCA-git-bot Apr 5, 2020
ae6a179
Added translation using Weblate (Portuguese (Brazil))
marcelsavegnago Jun 20, 2020
047a0a6
Translated using Weblate (Portuguese (Brazil))
fcolus Jun 23, 2020
466fde6
[IMP] product_cost_price_avco_sync: Cover case if multiple move lines…
carlosdauden Jun 24, 2020
4a89248
product_cost_price_avco_sync 12.0.1.0.3
OCA-git-bot Jun 25, 2020
7048523
[IMP] product_cost_price_avco_sync: black, isort
sergio-teruel Sep 7, 2020
adaa843
[MIG] product_cost_price_avco_sync: Migration to v13.0
sergio-teruel Sep 7, 2020
1981e3d
[MIG] product_cost_price_avco_sync: SVL compatibility
carlosdauden Sep 15, 2020
fa11df1
[MIG] product_cost_price_avco_sync: Simplify code (or not)
carlosdauden Sep 17, 2020
e2b2702
[MIG] product_cost_price_avco_sync: Compute returned moves from outgo…
sergio-teruel Oct 26, 2020
76eeb07
[MIG] product_cost_price_avco_sync: Remove old price
sergio-teruel Oct 27, 2020
dc03d9a
[IMP] product_cost_price_avco_sync: Update inventory adjust moves value
carlosdauden Nov 2, 2020
cfb4c8f
[IMP] product_cost_price_avco_sync: Better compute layers with zero u…
sergio-teruel Apr 29, 2021
495887e
[IMP] Improvements
sergio-teruel May 7, 2021
0df8e61
[IMP] Improvements
sergio-teruel May 8, 2021
3cab252
[IMP] Improvements
sergio-teruel May 10, 2021
c40cd18
[IMP] product_cost_price_avco_sync: Flake. Improve code and remove un…
carlosdauden May 10, 2021
d1ac04b
[IMP] product_cost_price_avco_sync: Flake. Vaccum manual adjustement
carlosdauden May 11, 2021
2c4c12d
[IMP] product_cost_price_avco_sync: Inventory adjustments
carlosdauden May 12, 2021
c7187b9
[FIX] product_cost_price_avco_sync: Division by zero
sergio-teruel May 12, 2021
2cd3d73
[IMP] product_cost_price_avco_sync: Round decimals
sergio-teruel May 13, 2021
19971ea
[IMP] product_cost_price_avco_sync: Test and cover use cases
carlosdauden May 17, 2021
5689af3
[IMP] product_cost_price_avco_sync: Test and cover cases of use
carlosdauden May 18, 2021
cee6bfd
[IMP] product_cost_price_avco_sync: Simplify code splitting in more m…
carlosdauden May 18, 2021
59ed38d
[IMP] product_cost_price_avco_sync: Cover case elaboration with inven…
sergio-teruel May 19, 2021
d0df6ff
[FIX] product_cost_price_avco_sync: Singleton on _create_correction_svl
sergio-teruel May 20, 2021
23cce4d
[IMP] product_cost_price_avco_sync: Keep inventory unit_cost if there…
sergio-teruel May 20, 2021
26d3e6f
[IMP] product_cost_price_avco_sync: Discard scrap and returned locati…
carlosdauden May 20, 2021
767ecd9
[IMP] product_cost_price_avco_sync: Avoid write stock move quantity d…
sergio-teruel May 20, 2021
2791008
[IMP] product_cost_price_avco_sync: Discard inventory moves if have a…
sergio-teruel May 20, 2021
fdf7f28
[IMP] product_cost_price_avco_sync: Discard scrap stock moves
sergio-teruel May 23, 2021
fdf7bf5
[IMP] product_cost_price_avco_sync: Add context to keep quantity afte…
sergio-teruel May 25, 2021
f39313d
[IMP] product_cost_price_avco_sync: Sync after write
sergio-teruel May 25, 2021
94f368a
[IMP] product_cost_price_avco_sync: Always compute remaining qty
sergio-teruel May 26, 2021
b4db7b0
[IMP] product_cost_price_avco_sync: Use dict to avoid modify many rec…
carlosdauden May 28, 2021
2b3ae5a
[IMP] product_cost_price_avco_sync: Remove unnecessary rounds.
carlosdauden May 28, 2021
6bf1ecf
[IMP] product_cost_price_avco_sync: Remove update_enabled.
carlosdauden May 28, 2021
3b7a72b
[IMP] product_cost_price_avco_sync: Simplify code and black style
carlosdauden May 28, 2021
1f0d21b
[FIX] product_cost_price_avco_sync: Value field are not in dict
carlosdauden May 31, 2021
c63cccc
[IMP] product_cost_price_avco_sync: Compare unit_cost field with curr…
carlosdauden May 31, 2021
566de57
[IMP] product_cost_price_avco_sync: Remaining quantities
carlosdauden May 31, 2021
ce15865
[IMP] product_cost_price_avco_sync: Simplify code
carlosdauden Jun 1, 2021
bee397a
[IMP] product_cost_price_avco_sync: Remove unneeded quantity in vals
sergio-teruel Jun 3, 2021
6339180
[IMP] product_cost_price_avco_sync: variable unit cost processed afte…
sergio-teruel Jun 4, 2021
9eda0d7
[FIX] product_cost_price_avco_sync: Change Monetary fields to Float (…
carlosdauden Jun 4, 2021
3111a90
[FIX] product_cost_price_avco_sync: Incorrect unit_cost when we have …
carlosdauden Dec 10, 2021
f16b36b
[FIX] product_cost_price_avco_sync: Create SVL for new stock move lines
sergio-teruel Jun 15, 2022
d463218
[IMP] product_cost_price_avco_sync: Use regex to extract price from d…
carlosdauden Aug 5, 2022
c7f8c75
[IMP] product_cost_price_avco_sync: Compatibility with landed cost
carlosdauden Sep 9, 2022
5e207fa
[FIX] product_cost_price_avco_sync: Don't fail on missing description
pedrobaeza Sep 9, 2022
130ca46
Revert "[FIX] product_cost_price_avco_sync: Change Monetary fields to…
carlosdauden Sep 9, 2022
fed3cf0
[IMP] product_cost_price_avco_sync: black, isort, prettier
CarlosRoca13 Nov 23, 2022
674bd4f
[MIG] product_cost_price_avco_sync: Migration to 15.0
CarlosRoca13 Nov 23, 2022
870faf5
[REF] product_cost_price_avco_sync: refactor for having hooks
pedrobaeza May 8, 2023
44e7956
[IMP] product_cost_price_avco_sync: Set zero instead of insignificant…
carlosdauden Aug 2, 2023
533cc5d
[IMP] product_cost_price_avco_sync: Add preprocess_svl_dict
CarlosRoca13 Aug 4, 2023
6bed6ab
[UPD] Update product_cost_price_avco_sync.pot
Sep 4, 2023
856bc77
[UPD] README.rst
OCA-git-bot Sep 4, 2023
ec00cbb
product_cost_price_avco_sync 15.0.1.0.1
OCA-git-bot Sep 4, 2023
e4ede57
[UPD] README.rst
OCA-git-bot Sep 4, 2023
3a5ad96
Update translation files
weblate Sep 4, 2023
d96dce4
[IMP] product_cost_price_avco_sync: test performance improvement
josep-tecnativa Oct 25, 2023
5480681
[BOT] post-merge updates
OCA-git-bot Oct 25, 2023
d9f2ff7
Translated using Weblate (Spanish)
Ivorra78 Oct 22, 2023
c4aa1a3
Added translation using Weblate (Italian)
mymage Dec 5, 2023
fbe310f
Translated using Weblate (Italian)
mymage Dec 5, 2023
9779ee5
[IMP] product_cost_price_avco_sync: pre-commit stuff
AungKoKoLin1997 Dec 27, 2023
3033869
[MIG] product_cost_price_avco_sync: Migration to 16.0
AungKoKoLin1997 Dec 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions product_cost_price_avco_sync/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
============================
Product cost price avco sync
============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f07176b3a7502ceb2553fc8c5613eb3680f27cd6fa3a28d492b55a6fcee661c1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/product_cost_price_avco_sync
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-product_cost_price_avco_sync
: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/stock-logistics-workflow&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to sync cost price products with average cost method from
stock moves price unit.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-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/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**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Dauden
* Sergio Teruel
* Carlos Roca

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-carlosdauden| image:: https://github.com/carlosdauden.png?size=40px
:target: https://github.com/carlosdauden
:alt: carlosdauden
.. |maintainer-sergio-teruel| image:: https://github.com/sergio-teruel.png?size=40px
:target: https://github.com/sergio-teruel
:alt: sergio-teruel

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-carlosdauden| |maintainer-sergio-teruel|

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.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions product_cost_price_avco_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models
16 changes: 16 additions & 0 deletions product_cost_price_avco_sync/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 Tecnativa - Carlos Dauden
# Copyright 2020 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Product cost price avco sync",
"summary": "Set product cost price from updated moves",
"version": "16.0.1.0.0",
"development_status": "Production/Stable",
"category": "Stock",
"website": "https://github.com/OCA/stock-logistics-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["carlosdauden", "sergio-teruel"],
"license": "AGPL-3",
"installable": True,
"depends": ["stock_account"],
}
54 changes: 54 additions & 0 deletions product_cost_price_avco_sync/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_cost_price_avco_sync
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-29 10:28+0000\n"
"PO-Revision-Date: 2023-10-28 18:53+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: product_cost_price_avco_sync
#: code:addons/product_cost_price_avco_sync/models/stock_valuation_layer.py:0
#, python-format
msgid ""
"More than one stock move line to assign the new stock valuation layer "
"quantity"
msgstr ""
"Más de una línea de movimiento de existencias para asignar la nueva cantidad "
"de capa de valoración de existencias"

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_product_product
msgid "Product"
msgstr "Producto"

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Movimientos de Producto (Línea de Movimiento de Existencias)"

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_valuation_layer
msgid "Stock Valuation Layer"
msgstr "Nivel de Valoración de Existencias"

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_picking
msgid "Transfer"
msgstr "Transferir"

#~ msgid "Stock Move"
#~ msgstr "Movimiento de existencias"

#~ msgid "Purchase Order Line"
#~ msgstr "Línea pedido de compra"
47 changes: 47 additions & 0 deletions product_cost_price_avco_sync/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_cost_price_avco_sync
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-05 17:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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: product_cost_price_avco_sync
#: code:addons/product_cost_price_avco_sync/models/stock_valuation_layer.py:0
#, python-format
msgid ""
"More than one stock move line to assign the new stock valuation layer "
"quantity"
msgstr ""
"Più di una riga movimento magazzino da assegnare alla nuava quantità livello "
"valorizzazione magazzino"

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_product_product
msgid "Product"
msgstr "Prodotto"

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Movimenti prodotto (riga movimento di magazzino)"

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_valuation_layer
msgid "Stock Valuation Layer"
msgstr "Livello valutazione magazzino"

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_picking
msgid "Transfer"
msgstr "Trasferimento"
42 changes: 42 additions & 0 deletions product_cost_price_avco_sync/i18n/product_cost_price_avco_sync.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_cost_price_avco_sync
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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: product_cost_price_avco_sync
#: code:addons/product_cost_price_avco_sync/models/stock_valuation_layer.py:0
#, python-format
msgid ""
"More than one stock move line to assign the new stock valuation layer "
"quantity"
msgstr ""

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_product_product
msgid "Product"
msgstr ""

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_valuation_layer
msgid "Stock Valuation Layer"
msgstr ""

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_picking
msgid "Transfer"
msgstr ""
48 changes: 48 additions & 0 deletions product_cost_price_avco_sync/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_cost_price_avco_sync
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-06-23 03:19+0000\n"
"Last-Translator: Fernando Colus <fcolus1@gmail.com>\n"
"Language-Team: none\n"
"Language: pt_BR\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 3.10\n"

#. module: product_cost_price_avco_sync
#: code:addons/product_cost_price_avco_sync/models/stock_valuation_layer.py:0
#, python-format
msgid ""
"More than one stock move line to assign the new stock valuation layer "
"quantity"
msgstr ""

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_product_product
msgid "Product"
msgstr ""

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_valuation_layer
msgid "Stock Valuation Layer"
msgstr ""

#. module: product_cost_price_avco_sync
#: model:ir.model,name:product_cost_price_avco_sync.model_stock_picking
msgid "Transfer"
msgstr "Transferência"

#~ msgid "Stock Move"
#~ msgstr "Movimentação de Estoque"
4 changes: 4 additions & 0 deletions product_cost_price_avco_sync/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import stock_move_line
from . import stock_picking
from . import stock_valuation_layer
27 changes: 27 additions & 0 deletions product_cost_price_avco_sync/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2019 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

@api.model
def _create_correction_svl(self, move, diff):
if move.product_id.cost_method != "average" or self.env.context.get(
"new_stock_move_create", False
):
return super()._create_correction_svl(move, diff)
for svl in move.stock_valuation_layer_ids:
# TODO: Review if is dropshipping
if move._is_out():
svl.quantity -= diff

Check warning on line 19 in product_cost_price_avco_sync/models/stock_move_line.py

View check run for this annotation

Codecov / codecov/patch

product_cost_price_avco_sync/models/stock_move_line.py#L19

Added line #L19 was not covered by tests
else:
svl.quantity += diff

@api.model_create_multi
def create(self, vals_list):
return super(
StockMoveLine, self.with_context(new_stock_move_create=True)
).create(vals_list)
12 changes: 12 additions & 0 deletions product_cost_price_avco_sync/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2019 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class StockPicking(models.Model):
_inherit = "stock.picking"

def action_done(self):
"""Avoid AVCO cost price recomputation when validating picking"""
return super(StockPicking, self.with_context(skip_avco_sync=True)).action_done()

Check warning on line 12 in product_cost_price_avco_sync/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

product_cost_price_avco_sync/models/stock_picking.py#L12

Added line #L12 was not covered by tests
Loading
Loading