[REF] stock: use config parameter instead of ir values in settings
Fields like `default_foo` still used ir.values although those are system-wide parameters and should therefore be stored in ir.config_parameter table. When no default_model is set on a field, don't prefix it by `default_`.
This commit is contained in:
committed by
Yannick Tivisse
parent
7efa2b63a6
commit
2bbfce88d0
@@ -31,7 +31,10 @@ class StockConfigSettings(models.TransientModel):
|
||||
help="Add and customize route operations to process product moves in your warehouse(s): e.g. unload > quality control > stock for incoming products, pick > pack > ship for outgoing products. \n You can also set putaway strategies on warehouse locations in order to send incoming products into specific child locations straight away (e.g. specific bins, racks).")
|
||||
group_warning_stock = fields.Boolean("Warnings", implied_group='stock.group_warning_stock')
|
||||
propagation_minimum_delta = fields.Integer(related='company_id.propagation_minimum_delta', string="No Rescheduling Propagation")
|
||||
default_new_propagation_minimum_delta = fields.Boolean(string="No Rescheduling Propagation", default_model="stock.config.settings", help="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. \n This option allows to not propagate the rescheduling if the change is not critical.")
|
||||
use_propagation_minimum_delta = fields.Boolean(
|
||||
string="No Rescheduling Propagation",
|
||||
oldname='default_new_propagation_minimum_delta',
|
||||
help="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. \n This option allows to not propagate the rescheduling if the change is not critical.")
|
||||
module_stock_picking_wave = fields.Boolean("Picking Waves")
|
||||
module_stock_calendar = fields.Boolean("Vendor Calendar for Reordering",
|
||||
help='Scheduled dates of requests for quotation generated from reordering rules are based on vendor lead times (defined on products).\nBy default, such a scheduling is made on calendar days. This option allow to adapt the scheduling with vendor calendars to set on reordering rules.')
|
||||
@@ -51,6 +54,11 @@ class StockConfigSettings(models.TransientModel):
|
||||
module_sale = fields.Boolean(string="Sales")
|
||||
module_purchase = fields.Boolean(string="Purchase")
|
||||
|
||||
@api.onchange('use_propagation_minimum_delta')
|
||||
def _onchange_use_propagation_minimum_delta(self):
|
||||
if not self.use_propagation_minimum_delta:
|
||||
self.propagation_minimum_delta = 1
|
||||
|
||||
@api.onchange('group_stock_multi_locations')
|
||||
def _onchange_group_stock_multi_locations(self):
|
||||
if not self.group_stock_multi_locations:
|
||||
@@ -67,6 +75,16 @@ class StockConfigSettings(models.TransientModel):
|
||||
if self.group_stock_adv_location and not self.group_stock_multi_locations:
|
||||
self.group_stock_multi_locations = True
|
||||
|
||||
@api.model
|
||||
def get_default_fields(self, fields):
|
||||
return dict(
|
||||
use_propagation_minimum_delta=self.env['ir.config_parameter'].sudo().get_param('stock.use_propagation_minimum_delta')
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def set_default_fields(self):
|
||||
self.env['ir.config_parameter'].sudo().set_param('stock.use_propagation_minimum_delta', self.use_propagation_minimum_delta)
|
||||
|
||||
@api.multi
|
||||
def set_group_stock_multi_locations(self):
|
||||
""" If we are not in multiple locations, we can deactivate the internal
|
||||
|
||||
@@ -292,15 +292,15 @@
|
||||
<div id="purchase_po_lead"/>
|
||||
<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="default_new_propagation_minimum_delta"/>
|
||||
<field name="use_propagation_minimum_delta"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="default_new_propagation_minimum_delta"/>
|
||||
<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': [('default_new_propagation_minimum_delta', '=', False)]}">
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user