[REF] mrp: remove confirm_no_consumption field
The `confirm_no_consumption` field was useless (can be replace by a other condition). Also it was compute in a slow computation method which should't not use in batch (not ready for now) See odoo/upgrade#2792 closes odoo/odoo#75827 Signed-off-by: Tiffany Chang <tic@odoo.com>
This commit is contained in:
@@ -215,9 +215,6 @@ class MrpProduction(models.Model):
|
||||
reserve_visible = fields.Boolean(
|
||||
'Allowed to Reserve Production', compute='_compute_unreserve_visible',
|
||||
help='Technical field to check when we can reserve quantities')
|
||||
confirm_no_consumption = fields.Boolean(
|
||||
compute='_compute_components_availability',
|
||||
help='Technical field used to see if we have to display a warning or not when confirming an order without any components.')
|
||||
user_id = fields.Many2one(
|
||||
'res.users', 'Responsible', default=lambda self: self.env.user,
|
||||
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]},
|
||||
@@ -288,13 +285,9 @@ class MrpProduction(models.Model):
|
||||
def _compute_components_availability(self):
|
||||
self.components_availability = False
|
||||
self.components_availability_state = 'available'
|
||||
self.confirm_no_consumption = False
|
||||
productions = self.filtered(lambda mo: mo.state not in ['cancel', 'draft', 'done'])
|
||||
productions.components_availability = _('Available')
|
||||
for production in productions:
|
||||
if not production.move_raw_ids:
|
||||
production.confirm_no_consumption = True
|
||||
continue
|
||||
forecast_date = max(production.move_raw_ids.filtered('forecast_expected_date').mapped('forecast_expected_date'), default=False)
|
||||
if any(float_compare(move.forecast_availability, move.product_qty, move.product_id.uom_id.rounding) == -1 for move in production.move_raw_ids):
|
||||
production.components_availability = _('Not Available')
|
||||
|
||||
@@ -71,14 +71,13 @@
|
||||
<form string="Manufacturing Orders">
|
||||
<header>
|
||||
<field name="confirm_cancel" invisible="1"/>
|
||||
<field name="confirm_no_consumption" invisible="1"/>
|
||||
<field name="show_lock" invisible="1"/>
|
||||
<button name="button_mark_done" attrs="{'invisible': ['|', '|', ('state', 'in', ('draft', 'cancel', 'done', 'to_close')), ('qty_producing', '=', 0), ('confirm_no_consumption', '=', False)]}" string="Validate" type="object" class="oe_highlight"
|
||||
<button name="button_mark_done" attrs="{'invisible': ['|', '|', ('state', 'in', ('draft', 'cancel', 'done', 'to_close')), ('qty_producing', '=', 0), ('move_raw_ids', '!=', [])]}" string="Validate" type="object" class="oe_highlight"
|
||||
confirm="There are no components to consume. Are you still sure you want to continue?" data-hotkey="g"/>
|
||||
<button name="button_mark_done" attrs="{'invisible': ['|', '|', ('state', 'in', ('draft', 'cancel', 'done', 'to_close')), ('qty_producing', '=', 0), ('confirm_no_consumption', '=', True)]}" string="Validate" type="object" class="oe_highlight" data-hotkey="g"/>
|
||||
<button name="button_mark_done" attrs="{'invisible': ['|', '|', ('state', 'in', ('draft', 'cancel', 'done', 'to_close')), ('qty_producing', '=', 0), ('move_raw_ids', '=', [])]}" string="Validate" type="object" class="oe_highlight" data-hotkey="g"/>
|
||||
<button name="button_mark_done" attrs="{'invisible': [
|
||||
'|',
|
||||
('confirm_no_consumption', '=', True),
|
||||
('move_raw_ids', '=', []),
|
||||
'&',
|
||||
'|',
|
||||
('state', 'not in', ('confirmed', 'progress')),
|
||||
@@ -86,7 +85,7 @@
|
||||
('state', '!=', 'to_close')]}" string="Mark as Done" type="object" class="oe_highlight" data-hotkey="g"/>
|
||||
<button name="button_mark_done" attrs="{'invisible': [
|
||||
'|',
|
||||
('confirm_no_consumption', '=', False),
|
||||
('move_raw_ids', '!=', []),
|
||||
'&',
|
||||
'|',
|
||||
('state', 'not in', ('confirmed', 'progress')),
|
||||
|
||||
Reference in New Issue
Block a user