mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[9.0][mig][stock_account_quant_merge] (#256)
* stock_account_quant_merge (#199) [ADD] stock_account_quant_merge * OCA Transbot updated translations from Transifex * [9.0][stock_account_quant_merge] Migration to 9.0
This commit is contained in:
committed by
GitHub
parent
d4bbd2ebce
commit
949d579ea4
65
stock_account_quant_merge/README.rst
Normal file
65
stock_account_quant_merge/README.rst
Normal file
@@ -0,0 +1,65 @@
|
||||
.. 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
|
||||
|
||||
=========================
|
||||
Stock Account Quant merge
|
||||
=========================
|
||||
|
||||
This module is an extension of "stock_quant_merge", and adds the cost as a
|
||||
criteria to merge quants.
|
||||
|
||||
Odoo splits quants each time a reservation is done: this module makes Odoo
|
||||
merge them back if they still meet the following requirements:
|
||||
|
||||
* same product
|
||||
* same serial number/lot
|
||||
* same location
|
||||
* same package
|
||||
* same unit cost
|
||||
* same incoming date
|
||||
|
||||
The restriction to only merge quants that have been received in the same
|
||||
date, with the the same cost is very important when the product is defined
|
||||
with the real costing method.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
The merge is done automatically when a reservation is undone. No user intervention is needed.
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/153/9.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/stock-logistics-warehouse/issues>`_. In case of
|
||||
trouble, please check there if your issue has already been reported. If you
|
||||
spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
feedback.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
|
||||
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.
|
||||
5
stock_account_quant_merge/__init__.py
Normal file
5
stock_account_quant_merge/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import models
|
||||
18
stock_account_quant_merge/__openerp__.py
Normal file
18
stock_account_quant_merge/__openerp__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Stock Account - Quant merge",
|
||||
"version": "9.0.1.0.0",
|
||||
"depends": [
|
||||
"stock_account",
|
||||
"stock_quant_merge"
|
||||
],
|
||||
"author": "Eficent,"
|
||||
"Odoo Community Association (OCA)",
|
||||
"website": "http://www.eficent.com",
|
||||
"category": "Warehouse Management",
|
||||
"installable": True,
|
||||
"license": "AGPL-3",
|
||||
"images": [],
|
||||
}
|
||||
24
stock_account_quant_merge/i18n/de.po
Normal file
24
stock_account_quant_merge/i18n/de.po
Normal file
@@ -0,0 +1,24 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_account_quant_merge
|
||||
#
|
||||
# Translators:
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-11-18 03:43+0000\n"
|
||||
"PO-Revision-Date: 2016-11-18 03:43+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
|
||||
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: de\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: stock_account_quant_merge
|
||||
#: model:ir.model,name:stock_account_quant_merge.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Quants"
|
||||
24
stock_account_quant_merge/i18n/es.po
Normal file
24
stock_account_quant_merge/i18n/es.po
Normal file
@@ -0,0 +1,24 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_account_quant_merge
|
||||
#
|
||||
# Translators:
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-11-18 03:43+0000\n"
|
||||
"PO-Revision-Date: 2016-11-18 03:43+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
|
||||
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: es\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: stock_account_quant_merge
|
||||
#: model:ir.model,name:stock_account_quant_merge.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Quants"
|
||||
24
stock_account_quant_merge/i18n/fi.po
Normal file
24
stock_account_quant_merge/i18n/fi.po
Normal file
@@ -0,0 +1,24 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_account_quant_merge
|
||||
#
|
||||
# Translators:
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-11-18 03:43+0000\n"
|
||||
"PO-Revision-Date: 2016-11-18 03:43+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
|
||||
"Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: fi\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: stock_account_quant_merge
|
||||
#: model:ir.model,name:stock_account_quant_merge.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Määrät"
|
||||
24
stock_account_quant_merge/i18n/fr.po
Normal file
24
stock_account_quant_merge/i18n/fr.po
Normal file
@@ -0,0 +1,24 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_account_quant_merge
|
||||
#
|
||||
# Translators:
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-11-18 03:43+0000\n"
|
||||
"PO-Revision-Date: 2016-11-18 03:43+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
|
||||
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: fr\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. module: stock_account_quant_merge
|
||||
#: model:ir.model,name:stock_account_quant_merge.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Quants"
|
||||
24
stock_account_quant_merge/i18n/it.po
Normal file
24
stock_account_quant_merge/i18n/it.po
Normal file
@@ -0,0 +1,24 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_account_quant_merge
|
||||
#
|
||||
# Translators:
|
||||
# Paolo Valier <paolo.valier@hotmail.it>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-11-18 03:43+0000\n"
|
||||
"PO-Revision-Date: 2016-11-18 03:43+0000\n"
|
||||
"Last-Translator: Paolo Valier <paolo.valier@hotmail.it>, 2016\n"
|
||||
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: it\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: stock_account_quant_merge
|
||||
#: model:ir.model,name:stock_account_quant_merge.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Quantità"
|
||||
24
stock_account_quant_merge/i18n/pt_BR.po
Normal file
24
stock_account_quant_merge/i18n/pt_BR.po
Normal file
@@ -0,0 +1,24 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_account_quant_merge
|
||||
#
|
||||
# Translators:
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-11-18 03:43+0000\n"
|
||||
"PO-Revision-Date: 2016-11-18 03:43+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
|
||||
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: pt_BR\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. module: stock_account_quant_merge
|
||||
#: model:ir.model,name:stock_account_quant_merge.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Quants"
|
||||
24
stock_account_quant_merge/i18n/ro.po
Normal file
24
stock_account_quant_merge/i18n/ro.po
Normal file
@@ -0,0 +1,24 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_account_quant_merge
|
||||
#
|
||||
# Translators:
|
||||
# Dorin Hongu <dhongu@gmail.com>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-11-18 03:43+0000\n"
|
||||
"PO-Revision-Date: 2016-11-18 03:43+0000\n"
|
||||
"Last-Translator: Dorin Hongu <dhongu@gmail.com>, 2016\n"
|
||||
"Language-Team: Romanian (https://www.transifex.com/oca/teams/23907/ro/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: ro\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
|
||||
|
||||
#. module: stock_account_quant_merge
|
||||
#: model:ir.model,name:stock_account_quant_merge.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Poziții de stoc"
|
||||
24
stock_account_quant_merge/i18n/sl.po
Normal file
24
stock_account_quant_merge/i18n/sl.po
Normal file
@@ -0,0 +1,24 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_account_quant_merge
|
||||
#
|
||||
# Translators:
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-11-18 03:43+0000\n"
|
||||
"PO-Revision-Date: 2016-11-18 03:43+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
|
||||
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: sl\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
|
||||
#. module: stock_account_quant_merge
|
||||
#: model:ir.model,name:stock_account_quant_merge.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Kvant"
|
||||
5
stock_account_quant_merge/models/__init__.py
Normal file
5
stock_account_quant_merge/models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import stock
|
||||
19
stock_account_quant_merge/models/stock.py
Normal file
19
stock_account_quant_merge/models/stock.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import api, models
|
||||
|
||||
|
||||
class StockQuant(models.Model):
|
||||
_inherit = 'stock.quant'
|
||||
|
||||
@api.multi
|
||||
def _mergeable_domain(self):
|
||||
domain = super(StockQuant, self)._mergeable_domain()
|
||||
|
||||
if self.product_id.cost_method == 'real':
|
||||
domain += [('cost', '=', self.cost),
|
||||
('in_date', '=', self.in_date)]
|
||||
|
||||
return domain
|
||||
5
stock_account_quant_merge/tests/__init__.py
Normal file
5
stock_account_quant_merge/tests/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import test_merge
|
||||
113
stock_account_quant_merge/tests/test_merge.py
Normal file
113
stock_account_quant_merge/tests/test_merge.py
Normal file
@@ -0,0 +1,113 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp.addons.stock.tests.common import TestStockCommon
|
||||
|
||||
|
||||
class TestMerge(TestStockCommon):
|
||||
"""Test the potential quantity on a product with a multi-line BoM"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestMerge, self).setUp()
|
||||
loc_supplier_id = self.env.ref('stock.stock_location_suppliers')
|
||||
self.loc_stock = self.env.ref('stock.stock_location_stock')
|
||||
self.loc_scrap = self.env.ref('stock.stock_location_scrapped')
|
||||
self.product = self.env.ref('product.product_product_36')
|
||||
|
||||
# Zero out the inventory of the product
|
||||
inventory = self.env['stock.inventory'].create(
|
||||
{'name': 'Remove product for test',
|
||||
'location_id': self.loc_stock.id,
|
||||
'filter': 'product',
|
||||
'product_id': self.product.id})
|
||||
inventory.prepare_inventory()
|
||||
inventory.reset_real_qty()
|
||||
inventory.action_done()
|
||||
|
||||
self.picking_obj = self.env['stock.picking']
|
||||
move_obj = self.env['stock.move']
|
||||
|
||||
self.picking_type = self.env.ref('stock.picking_type_in')
|
||||
|
||||
# Change the cost method to 'Real Price'
|
||||
self.product.cost_method = 'real'
|
||||
|
||||
self.picking_1 = self.picking_obj.create(
|
||||
{'picking_type_id': self.picking_type.id,
|
||||
'location_id': loc_supplier_id.id,
|
||||
'location_dest_id': self.loc_stock.id
|
||||
})
|
||||
move_obj.create({'name': '/',
|
||||
'picking_id': self.picking_1.id,
|
||||
'product_uom': self.product.uom_id.id,
|
||||
'location_id': loc_supplier_id.id,
|
||||
'location_dest_id': self.loc_stock.id,
|
||||
'product_id': self.product.id,
|
||||
'price_unit': 10,
|
||||
'product_uom_qty': 10})
|
||||
self.picking_1.action_confirm()
|
||||
self.picking_1.action_assign()
|
||||
self.picking_1.action_done()
|
||||
|
||||
self.picking_2 = self.picking_obj.create(
|
||||
{'picking_type_id': self.picking_type.id,
|
||||
'location_id': loc_supplier_id.id,
|
||||
'location_dest_id': self.loc_stock.id
|
||||
})
|
||||
move_obj.create({'name': '/',
|
||||
'picking_id': self.picking_2.id,
|
||||
'product_uom': self.product.uom_id.id,
|
||||
'location_id': loc_supplier_id.id,
|
||||
'location_dest_id': self.loc_stock.id,
|
||||
'product_id': self.product.id,
|
||||
'price_unit': 20,
|
||||
'product_uom_qty': 10})
|
||||
self.picking_2.action_confirm()
|
||||
self.picking_2.action_assign()
|
||||
self.picking_2.action_done()
|
||||
|
||||
def test_merge(self):
|
||||
quant_obj = self.env['stock.quant']
|
||||
domain = [('location_id', '=', self.loc_stock.id),
|
||||
('product_id', '=', self.product.id)]
|
||||
|
||||
quants = quant_obj.search(domain)
|
||||
self.assertEqual(len(quants), 2, "There should be 2 quants")
|
||||
|
||||
# Make a reservation to split the quants
|
||||
move_1 = self.env['stock.move'].create(
|
||||
{'name': 'Test move',
|
||||
'product_id': self.product.id,
|
||||
'location_id': self.loc_stock.id,
|
||||
'location_dest_id': self.loc_scrap.id,
|
||||
'product_uom_qty': 15.0,
|
||||
'product_uom': self.product.uom_id.id})
|
||||
move_1.action_confirm()
|
||||
move_1.action_assign()
|
||||
|
||||
# Make a reservation to split the quants
|
||||
move_2 = self.env['stock.move'].create(
|
||||
{'name': 'Test move',
|
||||
'product_id': self.product.id,
|
||||
'location_id': self.loc_stock.id,
|
||||
'location_dest_id': self.loc_scrap.id,
|
||||
'product_uom_qty': 3.0,
|
||||
'product_uom': self.product.uom_id.id})
|
||||
move_2.action_confirm()
|
||||
move_2.action_assign()
|
||||
|
||||
quants = quant_obj.search(domain)
|
||||
self.assertEqual(len(quants), 4, "There should be 4 quants")
|
||||
|
||||
# Cancel the second move : the quants with unit cost 20 should be
|
||||
# merged back together
|
||||
move_2.action_cancel()
|
||||
quants = quant_obj.search(domain)
|
||||
self.assertEqual(len(quants), 3, "There should be 3 quants")
|
||||
|
||||
# Cancel the first move : the quants with unit cost 20 should be
|
||||
# merged back together
|
||||
move_1.action_cancel()
|
||||
quants = quant_obj.search(domain)
|
||||
self.assertEqual(len(quants), 2, "There should be 2 quants")
|
||||
Reference in New Issue
Block a user