[FIX] mrp: remove unused code
Commit 5ef46664a2 change the workorder
model but some of the old fields was not removed. This clean all
the occurence of these unused part of code.
This commit is contained in:
@@ -136,7 +136,7 @@ class MrpAbstractWorkorder(models.AbstractModel):
|
||||
'qty_to_consume': to_consume_in_line,
|
||||
'qty_reserved': move_line.product_uom_qty,
|
||||
'lot_id': move_line.lot_id.id,
|
||||
'qty_done': is_tracked and 0 or to_consume_in_line
|
||||
'qty_done': to_consume_in_line
|
||||
}
|
||||
lines.append(line)
|
||||
qty_to_consume -= to_consume_in_line
|
||||
@@ -159,7 +159,7 @@ class MrpAbstractWorkorder(models.AbstractModel):
|
||||
'product_id': move.product_id.id,
|
||||
'product_uom_id': move.product_uom.id,
|
||||
'qty_to_consume': qty_to_consume,
|
||||
'qty_done': is_tracked and 0 or qty_to_consume
|
||||
'qty_done': qty_to_consume
|
||||
}
|
||||
lines.append(line)
|
||||
return lines
|
||||
|
||||
@@ -825,8 +825,8 @@ class MrpProduction(models.Model):
|
||||
moves_to_finish = order.move_finished_ids.filtered(lambda x: x.state not in ('done','cancel'))
|
||||
moves_to_finish._action_done()
|
||||
order.action_assign()
|
||||
consume_move_lines = moves_to_do.mapped('active_move_line_ids')
|
||||
for moveline in moves_to_finish.mapped('active_move_line_ids'):
|
||||
consume_move_lines = moves_to_do.mapped('move_line_ids')
|
||||
for moveline in moves_to_finish.mapped('move_line_ids'):
|
||||
if moveline.product_id == order.product_id and moveline.move_id.has_tracking != 'none':
|
||||
if any([not ml.lot_produced_id for ml in consume_move_lines]):
|
||||
raise UserError(_('You can not consume without telling for which lot you consumed it'))
|
||||
|
||||
@@ -209,9 +209,6 @@ class MrpWorkorder(models.Model):
|
||||
'location_dest_id': by_product_move.location_dest_id.id,
|
||||
}
|
||||
|
||||
def _link_to_quality_check(self, old_move_line, new_move_line):
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def record_production(self):
|
||||
if not self:
|
||||
|
||||
@@ -16,7 +16,6 @@ class StockMoveLine(models.Model):
|
||||
lot_produced_qty = fields.Float(
|
||||
'Quantity Finished Product', digits=dp.get_precision('Product Unit of Measure'),
|
||||
help="Informative, not used in matching")
|
||||
done_wo = fields.Boolean('Done for Work Order', default=True, help="Technical Field which is False when temporarily filled in in work order") # TDE FIXME: naming
|
||||
done_move = fields.Boolean('Move Done', related='move_id.is_done', readonly=False, store=True) # TDE FIXME: naming
|
||||
|
||||
def _get_similar_move_lines(self):
|
||||
@@ -24,12 +23,11 @@ class StockMoveLine(models.Model):
|
||||
if self.move_id.production_id:
|
||||
finished_moves = self.move_id.production_id.move_finished_ids
|
||||
finished_move_lines = finished_moves.mapped('move_line_ids')
|
||||
lines |= finished_move_lines.filtered(lambda ml: ml.product_id == self.product_id and (ml.lot_id or ml.lot_name) and ml.done_wo == self.done_wo)
|
||||
lines |= finished_move_lines.filtered(lambda ml: ml.product_id == self.product_id and (ml.lot_id or ml.lot_name))
|
||||
if self.move_id.raw_material_production_id:
|
||||
raw_moves = self.move_id.raw_material_production_id.move_raw_ids
|
||||
raw_moves_lines = raw_moves.mapped('move_line_ids')
|
||||
raw_moves_lines |= self.move_id.active_move_line_ids
|
||||
lines |= raw_moves_lines.filtered(lambda ml: ml.product_id == self.product_id and (ml.lot_id or ml.lot_name) and ml.done_wo == self.done_wo)
|
||||
lines |= raw_moves_lines.filtered(lambda ml: ml.product_id == self.product_id and (ml.lot_id or ml.lot_name))
|
||||
return lines
|
||||
|
||||
def _reservation_is_updatable(self, quantity, reserved_quant):
|
||||
@@ -46,7 +44,7 @@ class StockMoveLine(models.Model):
|
||||
for move_line in self:
|
||||
if move_line.move_id.production_id and 'lot_id' in vals:
|
||||
move_line.production_id.move_raw_ids.mapped('move_line_ids')\
|
||||
.filtered(lambda r: r.done_wo and not r.done_move and r.lot_produced_id == move_line.lot_id)\
|
||||
.filtered(lambda r: not r.done_move and r.lot_produced_id == move_line.lot_id)\
|
||||
.write({'lot_produced_id': vals['lot_id']})
|
||||
production = move_line.move_id.production_id or move_line.move_id.raw_material_production_id
|
||||
if production and move_line.state == 'done' and any(field in vals for field in ('lot_id', 'location_id', 'qty_done')):
|
||||
@@ -71,7 +69,6 @@ class StockMove(models.Model):
|
||||
workorder_id = fields.Many2one(
|
||||
'mrp.workorder', 'Work Order To Consume')
|
||||
# Quantities to process, in normalized UoMs
|
||||
active_move_line_ids = fields.One2many('stock.move.line', 'move_id', domain=[('done_wo', '=', True)], string='Lots')
|
||||
bom_line_id = fields.Many2one('mrp.bom.line', 'BoM Line')
|
||||
unit_factor = fields.Float('Unit Factor')
|
||||
is_done = fields.Boolean(
|
||||
@@ -89,10 +86,6 @@ class StockMove(models.Model):
|
||||
.filtered(lambda ml: ml.qty_done == 0.0)\
|
||||
.write({'move_id': new_move, 'product_uom_qty': 0})
|
||||
|
||||
@api.depends('active_move_line_ids.qty_done', 'active_move_line_ids.product_uom_id')
|
||||
def _compute_done_quantity(self):
|
||||
super(StockMove, self)._compute_done_quantity()
|
||||
|
||||
@api.depends('raw_material_production_id.move_finished_ids.move_line_ids.lot_id')
|
||||
def _compute_order_finished_lot_ids(self):
|
||||
for move in self:
|
||||
@@ -116,13 +109,6 @@ class StockMove(models.Model):
|
||||
if move.raw_material_production_id:
|
||||
move.is_locked = move.raw_material_production_id.is_locked
|
||||
|
||||
def _get_move_lines(self):
|
||||
self.ensure_one()
|
||||
if self.raw_material_production_id:
|
||||
return self.active_move_line_ids
|
||||
else:
|
||||
return super(StockMove, self)._get_move_lines()
|
||||
|
||||
@api.depends('state')
|
||||
def _compute_is_done(self):
|
||||
for move in self:
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<field name="finished_lots_exist" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="active_move_line_ids" attrs="{'invisible': [('parent.state', '=', 'draft')], 'readonly': [('is_locked', '=', True)]}" context="{'default_workorder_id': workorder_id, 'default_product_uom_id': product_uom, 'default_product_id': product_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id, 'default_production_id': production_id or raw_material_production_id}">
|
||||
<field name="move_line_ids" attrs="{'invisible': [('parent.state', '=', 'draft')], 'readonly': [('is_locked', '=', True)]}" context="{'default_workorder_id': workorder_id, 'default_product_uom_id': product_uom, 'default_product_id': product_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id, 'default_production_id': production_id or raw_material_production_id}">
|
||||
<tree editable="bottom" decoration-success="product_uom_qty==qty_done" decoration-danger="(product_uom_qty > 0) and (qty_done>product_uom_qty)">
|
||||
<field name="lot_id" attrs="{'column_invisible': [('parent.has_tracking', '=', 'none')]}" domain="[('product_id', '=', parent.product_id)]" context="{'default_product_id': parent.product_id}"/>
|
||||
<field name="lot_produced_id" options="{'no_open': True, 'no_create': True}" domain="[('id', 'in', parent.order_finished_lot_ids)]" invisible="not context.get('final_lots')"/>
|
||||
@@ -61,7 +61,6 @@
|
||||
<field name="product_uom_id" invisible="1"/>
|
||||
<field name="location_id" invisible="1"/>
|
||||
<field name="location_dest_id" invisible="1"/>
|
||||
<field name="done_wo" invisible="1"/>
|
||||
<field name="production_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user