Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

working on create

  • Loading branch information...
commit bfb44e36759a6d71aa8ee6fdaba786ad042cff9b 1 parent 306e3a3
@mtwebster authored
Showing with 4 additions and 49 deletions.
  1. +0 −47 mrp_operations.py
  2. +4 −2 mrp_operations_view.xml
View
47 mrp_operations.py
@@ -578,53 +578,6 @@ def initialize_workflow_instance(self, cr, uid, context=None):
-class mrp_production(osv.osv):
- _inherit = 'mrp.production'
-
-
- def action_compute1(self, cr, uid, ids, properties=[], context=None):
- """ Computes bills of material of a product.
- @param properties: List containing dictionaries of properties.
- @return: No. of products.
- """
- results = []
- bom_obj = self.pool.get('mrp.bom')
- uom_obj = self.pool.get('product.uom')
- prod_line_obj = self.pool.get('mrp.production.product.line')
- workcenter_line_obj = self.pool.get('mrp.production.workcenter.line')
- for production in self.browse(cr, uid, ids):
- cr.execute('delete from mrp_production_product_line where production_id=%s', (production.id,))
- cr.execute('delete from mrp_production_workcenter_line where production_id=%s', (production.id,))
- bom_point = production.bom_id
- bom_id = production.bom_id.id
- if not bom_point:
- bom_id = bom_obj._bom_find(cr, uid, production.product_id.id, production.product_uom.id, properties)
- if bom_id:
- bom_point = bom_obj.browse(cr, uid, bom_id)
- routing_id = bom_point.routing_id.id or False
- self.write(cr, uid, [production.id], {'bom_id': bom_id, 'routing_id': routing_id})
- if not bom_id:
- raise osv.except_osv(_('Error'), _("Couldn't find a bill of material for this product."))
- factor = uom_obj._compute_qty(cr, uid, production.product_uom.id, production.product_qty, bom_point.product_uom.id)
- res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, properties, routing_id=production.routing_id.id)
- results = res[0]
- results2 = res[1]
- for line in results:
- line['production_id'] = production.id
- prod_line_obj.create(cr, uid, line)
- for line in results2:
- line['production_id'] = production.id
- line['order_name'] = production.x_order_name
- line['order_due'] = production.x_order_due
- workcenter_line_obj.create(cr, uid, line)
- return len(results)
-
-
-
-
-
-mrp_production()
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
View
6 mrp_operations_view.xml
@@ -46,11 +46,10 @@
<field name="type">tree</field>
<field name="inherit_id" eval="False"/>
<field name="arch" type="xml">
- <tree string="Work Orders" colors="gray:state in ('done','cancel');black:state in ('draft','startworking') and date_planned&gt;=current_date;red:date_planned&lt;current_date and state in ('draft', 'confirmed', 'ready')">
+ <tree string="Work Orders" colors="gray:state in ('done','cancel');black:state in ('draft','startworking') and order_due&gt;=current_date;red:order_due&lt;current_date and state in ('draft', 'confirmed', 'ready')">
<field name="production_id"/>
<field name="order_name"/>
<field name="order_due"/>
- <field name="product"/>
<field name="qty"/>
<field name="uom"/>
<field name="name"/>
@@ -74,6 +73,8 @@
<field name="arch" type="xml">
<form string="Work Orders">
<group col="6" colspan="4">
+ <field colspan="2" name="order_name"/>
+ <field name="order_due"/>
<field colspan="4" name="name" select="1"/>
<field name="workcenter_id" select="1" widget="selection"/>
<field name="production_id"/>
@@ -142,6 +143,7 @@
help="Production started late" />
<separator orientation="vertical"/>
<field name="name"/>
+ <field name="order_name"/>
<field name="workcenter_id" widget="selection"/>
<field name="production_id" />
<field name="state" />
Please sign in to comment.
Something went wrong with that request. Please try again.