[IMP] mrp_operations_extension: Added material ready for operations + editable operations from production order

This commit is contained in:
Daniel-CA
2015-05-28 18:15:05 +02:00
committed by Pedro M. Baeza
parent a191e8cad8
commit 0df3f77462
2 changed files with 26 additions and 1 deletions

View File

@@ -22,6 +22,8 @@ from openerp import models, fields, api, exceptions, _
class MrpProduction(models.Model):
_inherit = 'mrp.production'
workcenter_lines = fields.One2many(readonly=False)
def _get_minor_sequence_operation(self, operations):
return min(operations, key=lambda x: x.sequence)
@@ -94,6 +96,16 @@ class MrpProductionProductLine(models.Model):
class MrpProductionWorkcenterLine(models.Model):
_inherit = 'mrp.production.workcenter.line'
@api.one
def _ready_materials(self):
self.is_material_ready = True
if self.product_line:
moves = self.env['stock.move'].search([('work_order', '=',
self.id)])
self.is_material_ready = not any(
x not in ('assigned', 'cancel', 'done') for x in
moves.mapped('state'))
product_line = fields.One2many('mrp.production.product.line',
'work_order', string='Product Lines')
routing_wc_line = fields.Many2one('mrp.routing.workcenter',
@@ -103,6 +115,8 @@ class MrpProductionWorkcenterLine(models.Model):
time_stop = fields.Float(string="Time Stop")
move_lines = fields.One2many('stock.move', 'work_order',
string='Moves')
is_material_ready = fields.Boolean('Materials Ready',
compute="_ready_materials")
@api.one
def action_assign(self):

View File

@@ -68,6 +68,7 @@
</xpath>
<xpath expr="//field[@name='workcenter_lines']/form//field[@name='sequence']" position="after">
<field name="do_production" colspan="2" />
<field name="is_material_ready" colspan="2"/>
<notebook colspan="4">
<page string="Materials">
<group>
@@ -210,9 +211,19 @@
<field name="sequence" position="after">
<field name="do_production" />
<field name="is_material_ready" />
</field>
</field>
</record>
<record model="ir.ui.view" id="mrp_production_workcenter_tree_view_inh_op_ext">
<field name="name">Workcenter line op ext</field>
<field name="model">mrp.production.workcenter.line</field>
<field name="inherit_id" ref="mrp_operations.mrp_production_workcenter_tree_view_inherit" />
<field name="arch" type="xml">
<field name="state" position="after">
<field name="production_state"/>
</field>
</field>
</record>
</data>
</openerp>