[IMP] Added another testcase for 2 service type product
And improved code for bom product with service type product used in SO doesnt link the project perfectly. bzr revid: psa@tinyerp.com-20130912110454-x9tidij14xj09joz
This commit is contained in:
parent
8985dda550
commit
000ca6103d
|
@ -864,6 +864,9 @@ class mrp_production(osv.osv):
|
|||
|
||||
def _get_auto_picking(self, cr, uid, production):
|
||||
return True
|
||||
|
||||
def _hook_create_post_procurement(self, cr, uid, production, procurement_id, context=None):
|
||||
return True
|
||||
|
||||
def _make_production_line_procurement(self, cr, uid, production_line, shipment_move_id, context=None):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
@ -886,6 +889,7 @@ class mrp_production(osv.osv):
|
|||
'move_id': shipment_move_id,
|
||||
'company_id': production.company_id.id,
|
||||
})
|
||||
self._hook_create_post_procurement(cr, uid, production, procurement_id, context=context)
|
||||
wf_service.trg_validate(uid, procurement_order._name, procurement_id, 'button_confirm', cr)
|
||||
return procurement_id
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
I compute the data of production order.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
self.action_compute(cr, uid, [ref("mrp_production_servicetype_mo1")], {"lang": "en_US", "tz": False, "search_default_Current":
|
||||
1, "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")],
|
||||
self.action_compute(cr, uid, [ref("mrp_production_servicetype_mo1")], {"lang": "en_US", "tz": False, "search_default_Current": 1,
|
||||
"active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")],
|
||||
"active_id": ref("mrp.menu_mrp_production_action"), })
|
||||
-
|
||||
I confirm the production order.
|
||||
|
@ -68,3 +68,67 @@
|
|||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
|
||||
assert order.state == 'done', "Production order should be closed."
|
||||
-
|
||||
I create Bill of Materials with two service type products.
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_test_2}:
|
||||
company_id: base.main_company
|
||||
name: PC Assemble SC234
|
||||
product_id: product.product_product_3
|
||||
product_qty: 1.0
|
||||
type: normal
|
||||
bom_lines:
|
||||
- company_id: base.main_company
|
||||
name: On Site Monitoring
|
||||
product_id: product.product_product_1
|
||||
product_qty: 1.0
|
||||
- company_id: base.main_company
|
||||
name: On Site Assistance
|
||||
product_id: product.product_product_2
|
||||
product_qty: 1.0
|
||||
-
|
||||
I make the production order using BoM having two service type products.
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_servicetype_2}:
|
||||
product_id: product.product_product_5
|
||||
product_qty: 1.0
|
||||
bom_id: mrp_bom_test_2
|
||||
date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
-
|
||||
I compute the data of production order.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
self.action_compute(cr, uid, [ref("mrp_production_servicetype_2")], {"lang": "en_US", "tz": False, "search_default_Current": 1,
|
||||
"active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")],
|
||||
"active_id": ref("mrp.menu_mrp_production_action"), })
|
||||
-
|
||||
I confirm the production order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_servicetype_2}
|
||||
-
|
||||
Now I start production.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_servicetype_2}
|
||||
-
|
||||
I check that production order in production state after start production.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_servicetype_2"))
|
||||
assert order.state == 'in_production', 'Production order should be in production State.'
|
||||
-
|
||||
I produce product.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
context.update({'active_id': ref('mrp_production_servicetype_2')})
|
||||
-
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce_2}:
|
||||
mode: 'consume_produce'
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
self.do_produce(cr, uid, [ref('mrp_product_produce_2')], context=context)
|
||||
-
|
||||
I check production order after produced.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_servicetype_2"))
|
||||
assert order.state == 'done', "Production order should be closed."
|
||||
|
|
|
@ -109,4 +109,15 @@ class sale_order(osv.osv):
|
|||
}
|
||||
|
||||
sale_order()
|
||||
|
||||
class mrp_production(osv.osv):
|
||||
_inherit = 'mrp.production'
|
||||
|
||||
def _hook_create_post_procurement(self, cr, uid, production, procurement_id, context=None):
|
||||
res = super(mrp_production, self)._hook_create_post_procurement(cr, uid, production, procurement_id, context)
|
||||
procurement_order = self.pool.get('procurement.order')
|
||||
procurement_order.write(cr, uid, procurement_id, {'sale_line_id': production.move_prod_id and production.move_prod_id.sale_line_id and production.move_prod_id.sale_line_id.id})
|
||||
return procurement_id
|
||||
|
||||
mrp_production()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue