65 lines
2.5 KiB
YAML
65 lines
2.5 KiB
YAML
-
|
|
I create Bill of Materials with one service type product and one consumable product.
|
|
-
|
|
!record {model: mrp.bom, id: mrp_bom_test1}:
|
|
company_id: base.main_company
|
|
name: PC Assemble SC234
|
|
product_tmpl_id: product.product_product_3_product_template
|
|
product_id: product.product_product_3
|
|
product_uom: product.product_uom_unit
|
|
product_qty: 1.0
|
|
type: normal
|
|
bom_line_ids:
|
|
- product_id: product.product_product_2
|
|
product_uom: product.product_uom_unit
|
|
product_qty: 1.0
|
|
- product_id: product.product_product_44
|
|
product_uom: product.product_uom_unit
|
|
product_qty: 1.0
|
|
-
|
|
I make the production order using BoM having one service type product and one consumable product.
|
|
-
|
|
!record {model: mrp.production, id: mrp_production_servicetype_mo1}:
|
|
product_id: product.product_product_3
|
|
product_qty: 1.0
|
|
bom_id: mrp_bom_test1
|
|
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_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.
|
|
-
|
|
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_servicetype_mo1}
|
|
-
|
|
I reserved the product.
|
|
-
|
|
!python {model: mrp.production}: |
|
|
order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
|
|
assert order.state == 'confirmed', "Production order should be confirmed."
|
|
self.force_production(cr, uid, [order.id])
|
|
|
|
-
|
|
I produce product.
|
|
-
|
|
!python {model: mrp.product.produce}: |
|
|
context.update({'active_id': ref('mrp_production_servicetype_mo1')})
|
|
-
|
|
!record {model: mrp.product.produce, id: mrp_product_produce_1, view: mrp.view_mrp_product_produce_wizard}:
|
|
mode: 'consume_produce'
|
|
-
|
|
!python {model: mrp.product.produce}: |
|
|
lines = self.on_change_qty(cr, uid, [ref('mrp_product_produce_1')], 1.0, [], context=context)
|
|
self.write(cr, uid, [ref('mrp_product_produce_1')], lines['value'], context=context)
|
|
self.do_produce(cr, uid, [ref('mrp_product_produce_1')], context=context)
|
|
-
|
|
I check production order after produced.
|
|
-
|
|
!python {model: mrp.production}: |
|
|
order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
|
|
assert order.state == 'done', "Production order should be closed."
|