mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_available: Migration to 11.0
This commit is contained in:
@@ -35,7 +35,7 @@ chose to base the computation on.
|
||||
|
||||
.. 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/10.0
|
||||
:target: https://runbot.odoo-community.org/runbot/153/11.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
@@ -58,7 +58,7 @@ Contributors
|
||||
|
||||
* Lionel Sausin (Numérigraphe) <ls@numerigraphe.com>
|
||||
* Sodexis <sodexis@sodexis.com>
|
||||
* Cédric Pigeon <cedric.pigeon@acsone.eu>
|
||||
* Factor Libre - Kiko Peiro <francisco.peiro@factorlibre.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
@@ -73,4 +73,4 @@ 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.
|
||||
To contribute to this module, please visit https://odoo-community.org.
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Numérigraphe
|
||||
# Copyright 2016 Sodexis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Numérigraphe
|
||||
# Copyright 2016 Sodexis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
'name': 'Stock available to promise',
|
||||
'version': '10.0.1.0.1',
|
||||
'version': '11.0.1.0.0',
|
||||
"author": "Numérigraphe, Sodexis, Odoo Community Association (OCA)",
|
||||
'category': 'Warehouse',
|
||||
'depends': ['stock'],
|
||||
@@ -13,7 +12,7 @@
|
||||
'data': [
|
||||
'views/product_template_view.xml',
|
||||
'views/product_product_view.xml',
|
||||
'views/res_config_view.xml',
|
||||
'views/res_config_settings_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Numérigraphe
|
||||
# Copyright 2016 Sodexis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import product_template
|
||||
from . import product_product
|
||||
from . import res_config
|
||||
from . import res_config_settings
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Numérigraphe
|
||||
# Copyright 2016 Sodexis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Numérigraphe
|
||||
# Copyright 2016 Sodexis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Numérigraphe
|
||||
# Copyright 2016 Sodexis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
@@ -6,10 +5,10 @@
|
||||
from odoo import api, models, fields
|
||||
|
||||
|
||||
class StockConfig(models.TransientModel):
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
|
||||
"""Add options to easily install the submodules"""
|
||||
_inherit = 'stock.config.settings'
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
@api.model
|
||||
def _get_stock_available_mrp_based_on(self):
|
||||
@@ -54,17 +53,17 @@ class StockConfig(models.TransientModel):
|
||||
)
|
||||
|
||||
@api.model
|
||||
def get_default_stock_available_mrp_based_on(self, fields):
|
||||
res = {}
|
||||
icp = self.env['ir.config_parameter']
|
||||
res['stock_available_mrp_based_on'] = icp.get_param(
|
||||
'stock_available_mrp_based_on', 'qty_available'
|
||||
def get_values(self):
|
||||
res = super(ResConfigSettings, self).get_values()
|
||||
res.update(stock_available_mrp_based_on=self.env[
|
||||
'ir.config_parameter'].sudo().get_param(
|
||||
'stock_available_mrp_based_on',
|
||||
'qty_available')
|
||||
)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def set_stock_available_mrp_based_on(self):
|
||||
if self.stock_available_mrp_based_on:
|
||||
icp = self.env['ir.config_parameter']
|
||||
icp.set_param('stock_available_mrp_based_on',
|
||||
self.stock_available_mrp_based_on)
|
||||
def set_values(self):
|
||||
super(ResConfigSettings, self).set_values()
|
||||
self.env['ir.config_parameter'].sudo().set_param(
|
||||
'stock_available_mrp_based_on', self.stock_available_mrp_based_on)
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Numérigraphe
|
||||
# Copyright 2016 Sodexis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Numérigraphe
|
||||
# Copyright 2016 Sodexis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
@@ -9,13 +8,13 @@ from odoo.tests.common import TransactionCase
|
||||
class TestStockLogisticsWarehouse(TransactionCase):
|
||||
def test_res_config(self):
|
||||
"""Test the config file"""
|
||||
stock_setting = self.env['stock.config.settings'].create({})
|
||||
stock_setting = self.env['res.config.settings'].create({})
|
||||
|
||||
self.assertEquals(
|
||||
stock_setting.stock_available_mrp_based_on,
|
||||
'qty_available')
|
||||
stock_setting.stock_available_mrp_based_on = 'immediately_usable_qty'
|
||||
stock_setting.set_stock_available_mrp_based_on()
|
||||
stock_setting.set_values()
|
||||
self.assertEquals(
|
||||
stock_setting.stock_available_mrp_based_on,
|
||||
'immediately_usable_qty')
|
||||
@@ -104,20 +103,20 @@ class TestStockLogisticsWarehouse(TransactionCase):
|
||||
compare_product_usable_qty(productA, 0)
|
||||
compare_product_usable_qty(templateAB, 0)
|
||||
|
||||
stockMoveInA.action_confirm()
|
||||
stockMoveInA._action_confirm()
|
||||
compare_product_usable_qty(productA, 2)
|
||||
compare_product_usable_qty(templateAB, 2)
|
||||
|
||||
stockMoveInA.action_assign()
|
||||
stockMoveInA._action_assign()
|
||||
compare_product_usable_qty(productA, 2)
|
||||
compare_product_usable_qty(templateAB, 2)
|
||||
|
||||
stockMoveInA.action_done()
|
||||
stockMoveInA._action_done()
|
||||
compare_product_usable_qty(productA, 2)
|
||||
compare_product_usable_qty(templateAB, 2)
|
||||
|
||||
# will directly trigger action_done on productB
|
||||
stockMoveInB.action_done()
|
||||
stockMoveInB._action_done()
|
||||
compare_product_usable_qty(productA, 2)
|
||||
compare_product_usable_qty(productB, 3)
|
||||
compare_product_usable_qty(templateAB, 5)
|
||||
@@ -133,7 +132,7 @@ class TestStockLogisticsWarehouse(TransactionCase):
|
||||
'state': 'confirmed',
|
||||
})
|
||||
|
||||
stockMoveOutA.action_done()
|
||||
stockMoveOutA._action_done()
|
||||
compare_product_usable_qty(productA, 1)
|
||||
compare_product_usable_qty(templateAB, 4)
|
||||
|
||||
|
||||
72
stock_available/views/res_config_settings_views.xml
Normal file
72
stock_available/views/res_config_settings_views.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2014 Numérigraphe
|
||||
Copyright 2016 Sodexis
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
|
||||
|
||||
<odoo>
|
||||
<record id="view_stock_configuration" model="ir.ui.view">
|
||||
<field name="name">Stock settings: quantity available to promise</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="stock.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//div[@data-key='stock']" position="inside">
|
||||
<h2 id="available_info">Stock available to promise</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_stock_available_immediately"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_stock_available_immediately"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_stock_available_mrp"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_stock_available_mrp"/>
|
||||
<div class="content-group">
|
||||
<div class="mt16" attrs="{'invisible': [('module_stock_available_mrp', '=', False)]}">
|
||||
<field name="stock_available_mrp_based_on" class="oe_inline" attrs="{'required':[('module_stock_available_mrp','=',True)]}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div>-->
|
||||
<!--<field name="module_stock_available_sale" class="oe_inline" />-->
|
||||
<!--<label for="module_stock_available_sale" />-->
|
||||
<!--</div>-->
|
||||
<!--
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" id="propagation_info" title="Rescheduling applies to any chain of operations (e.g. Make To Order, Pick Pack Ship). In the case of MTO sales, a vendor delay (updated incoming date) impacts the expected delivery date to the customer. This option allows to not propagate the rescheduling if the change is not critical.">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="use_propagation_minimum_delta"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="use_propagation_minimum_delta"/>
|
||||
<div class="text-muted">
|
||||
Don’t propagate scheduling changes through chains of operations
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="mt16" attrs="{'invisible': [('use_propagation_minimum_delta', '=', False)]}">
|
||||
<span>Change must be higher than <field name="propagation_minimum_delta" class="oe_inline"/> days to be propagated</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<field name="module_stock_available_mrp" class="oe_inline" />
|
||||
<label for="module_stock_available_mrp" />
|
||||
<label for="stock_available_mrp_based_on" />
|
||||
<field name="stock_available_mrp_based_on" class="oe_inline" attrs="{'required':[('module_stock_available_mrp','=',True)]}"/>
|
||||
</div> -->
|
||||
</div>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2014 Numérigraphe
|
||||
Copyright 2016 Sodexis
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
|
||||
|
||||
<odoo>
|
||||
<record id="view_stock_configuration" model="ir.ui.view">
|
||||
<field name="name">Stock settings: quantity available to promise</field>
|
||||
<field name="model">stock.config.settings</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_config_settings" />
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//group[last()]" position="after">
|
||||
<group>
|
||||
<label for="id" string="Stock available to promise" />
|
||||
<div>
|
||||
<div>
|
||||
<field name="module_stock_available_immediately"
|
||||
class="oe_inline" />
|
||||
<label for="module_stock_available_immediately" />
|
||||
</div>
|
||||
<!--<div>-->
|
||||
<!--<field name="module_stock_available_sale" class="oe_inline" />-->
|
||||
<!--<label for="module_stock_available_sale" />-->
|
||||
<!--</div>-->
|
||||
<div>
|
||||
<field name="module_stock_available_mrp" class="oe_inline" />
|
||||
<label for="module_stock_available_mrp" />
|
||||
<label for="stock_available_mrp_based_on" />
|
||||
<field name="stock_available_mrp_based_on" class="oe_inline" attrs="{'required':[('module_stock_available_mrp','=',True)]}"/>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user