[IMP] stock: move auto-show reception report to picking type
Previously this setting was an application setting which meant the report could auto-open at undesired times (e.g. internal picking when multi-step). Instead we make it more flexible for the user's desires by moving it to the picking type setting. Part of Task: 2632884 Upgrade PR: odoo/upgrade#2815 Part-of: odoo/odoo#76147
This commit is contained in:
@@ -46,7 +46,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
annual_inventory_month = fields.Selection(related='company_id.annual_inventory_month', readonly=False)
|
||||
annual_inventory_day = fields.Integer(related='company_id.annual_inventory_day', readonly=False)
|
||||
group_stock_reception_report = fields.Boolean("Reception Report", implied_group='stock.group_reception_report')
|
||||
group_stock_auto_reception_report = fields.Boolean("Show Reception Report at Validation", implied_group='stock.group_auto_reception_report')
|
||||
|
||||
@api.onchange('group_stock_multi_locations')
|
||||
def _onchange_group_stock_multi_locations(self):
|
||||
|
||||
@@ -72,6 +72,9 @@ class PickingType(models.Model):
|
||||
help="How products in transfers of this operation type should be reserved.")
|
||||
reservation_days_before = fields.Integer('Days', help="Maximum number of days before scheduled date that products should be reserved.")
|
||||
reservation_days_before_priority = fields.Integer('Days when starred', help="Maximum number of days before scheduled date that priority picking products should be reserved.")
|
||||
auto_show_reception_report = fields.Boolean(
|
||||
"Show Reception Report at Validation",
|
||||
help="If this checkbox is ticked, Odoo will automatically show the reception report (if there are moves to allocate to) when validating a picking.")
|
||||
|
||||
count_picking_draft = fields.Integer(compute='_compute_picking_count')
|
||||
count_picking_ready = fields.Integer(compute='_compute_picking_count')
|
||||
@@ -978,8 +981,7 @@ class Picking(models.Model):
|
||||
pickings_to_backorder.with_context(cancel_backorder=False)._action_done()
|
||||
|
||||
if self.user_has_groups('stock.group_reception_report') \
|
||||
and self.user_has_groups('stock.group_auto_reception_report') \
|
||||
and self.filtered(lambda p: p.picking_type_id.code != 'outgoing'):
|
||||
and self.picking_type_id.auto_show_reception_report:
|
||||
lines = self.move_ids.filtered(lambda m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids)
|
||||
if lines:
|
||||
# don't show reception report if all already assigned/nothing to assign
|
||||
|
||||
@@ -74,10 +74,6 @@
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
|
||||
<record id="group_auto_reception_report" model="res.groups">
|
||||
<field name="name">Display Reception Report at Validation</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
<record id="group_stock_picking_wave" model="res.groups">
|
||||
<field name="name">Use wave pickings</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
|
||||
@@ -95,15 +95,6 @@
|
||||
<div class="text-muted">
|
||||
View and allocate received quantities.
|
||||
</div>
|
||||
<div class="row mt-2" attrs="{'invisible': [('group_stock_reception_report','=',False)]}">
|
||||
<field name="group_stock_auto_reception_report" class="col-lg-1 ml16 mr0"/>
|
||||
<div class="col pl-0">
|
||||
<label for="group_stock_auto_reception_report"/>
|
||||
<div class="text-muted">
|
||||
Automatically open reception report when a receipt is validated.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<field name="warehouse_id" groups="stock.group_stock_multi_warehouses" force_save="1"/>
|
||||
<field name="print_label" attrs="{'invisible': [('code', '!=', 'internal')]}"/>
|
||||
<field name="reservation_method" attrs="{'invisible': [('code', '=', 'incoming')]}" widget="radio"/>
|
||||
<field name="auto_show_reception_report" attrs="{'invisible': [('code', 'not in', ['incoming', 'internal'])]}" groups="stock.group_reception_report"/>
|
||||
<label for="reservation_days_before" string="Reserve before scheduled date" attrs="{'invisible': ['|', ('code', '=', 'incoming'), ('reservation_method', '!=', 'by_date')]}"/>
|
||||
<div class="o_row" attrs="{'invisible': ['|', ('code', '=', 'incoming'), ('reservation_method', '!=', 'by_date')]}">
|
||||
<span><field name="reservation_days_before" style="width: 23px;"/> days before/</span>
|
||||
|
||||
Reference in New Issue
Block a user