Skip to content

Commit

Permalink
Merge PR #1465 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rousseldenis
  • Loading branch information
OCA-git-bot committed Nov 15, 2024
2 parents 87aa029 + 3033869 commit 82fa5e0
Show file tree
Hide file tree
Showing 19 changed files with 1,720 additions and 0 deletions.
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
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()
Loading

0 comments on commit 82fa5e0

Please sign in to comment.