[MERGE]: Merged branch of mrp yamls improvements
bzr revid: rpa@tinyerp.com-20120731060216-0cj2p1i7ql6b3f8e
This commit is contained in:
@@ -1,25 +1,27 @@
|
||||
-
|
||||
I first confirm order for shirt.
|
||||
I first confirm order for PC Assemble SC349.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_shirt}
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_test1}
|
||||
-
|
||||
In order to cancel the production order, I first cancel its picking.
|
||||
-
|
||||
!function {model: stock.picking, name: action_cancel}:
|
||||
- model: mrp.production
|
||||
eval: "[obj(ref('mrp_production_shirt')).picking_id.id]"
|
||||
eval: "[obj(ref('mrp_production_test1')).picking_id.id]"
|
||||
-
|
||||
Now I cancel the production order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_cancel, ref: mrp_production_shirt}
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"), context=context)
|
||||
order.action_cancel(context=context)
|
||||
-
|
||||
Now I check that the production order is cancelled.
|
||||
-
|
||||
!assert {model: mrp.production, id: mrp_production_shirt}:
|
||||
!assert {model: mrp.production, id: mrp_production_test1}:
|
||||
- state == 'cancel'
|
||||
-
|
||||
I remove cancelled production order.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shirt"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"), context=context)
|
||||
self.unlink(cr, uid, [order.id])
|
||||
|
||||
@@ -1,27 +1,12 @@
|
||||
-
|
||||
In order to test process of production order, I create Bill of material of Shelf 100cm.
|
||||
I create Production Order of PC Assemble SC349 to produce 5.0 Unit.
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_defaultbomforshelfofcm0}:
|
||||
product_id: product.product_product_29
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_assemblysection1}:
|
||||
routing_id: mrp.mrp_routing_0
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_rearpanelarm1}:
|
||||
routing_id: mrp.mrp_routing_0
|
||||
-
|
||||
I create Production Order of Shelf 100cm to produce 5.0 Dozen Unit.
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_shelf100cm}:
|
||||
location_src_id: stock.stock_location_stock
|
||||
location_dest_id: stock.stock_location_output
|
||||
product_id: product.product_product_29
|
||||
bom_id: mrp_bom_defaultbomforshelfofcm0
|
||||
routing_id: mrp.mrp_routing_1
|
||||
product_uom: product.product_uom_dozen
|
||||
!record {model: mrp.production, id: mrp_production_test1}:
|
||||
product_id: product.product_product_4
|
||||
product_qty: 5.0
|
||||
-
|
||||
!record {model: mrp.workcenter, id: mrp_workcenter_0}:
|
||||
product_id: product.product_assembly
|
||||
|
||||
|
||||
location_src_id: stock.stock_location_14
|
||||
location_dest_id: stock.stock_location_output
|
||||
bom_id: mrp_bom_24
|
||||
routing_id: mrp.mrp_routing_1
|
||||
|
||||
|
||||
|
||||
@@ -2,54 +2,14 @@
|
||||
I compute the production order.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"), context=context)
|
||||
order.action_compute(context=context)
|
||||
-
|
||||
I check production lines after compute.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"), context=context)
|
||||
assert len(order.product_lines) == 5, "Production lines are not generated proper."
|
||||
factor = 12.0*5.0
|
||||
sidepanel = False
|
||||
woodlintelm = False
|
||||
woodmm0 = False
|
||||
woodmm10 = False
|
||||
metalcleats = False
|
||||
for line in order.product_lines:
|
||||
if line.product_id.id == ref('product.product_product_41'): #SIDEPAN 2 Unit
|
||||
assert not sidepanel, "Production line is already generated for SIDEPAN."
|
||||
assert line.product_qty == (2.0*factor), "Qty is not correspond."
|
||||
assert line.product_uom.id == ref('product.product_uom_unit'), "UOM is not correspond"
|
||||
sidepanel = True
|
||||
elif line.product_id.id == ref('product.product_product_45'): #LIN40 4*0.25 Meter
|
||||
assert not woodlintelm, "Production line is already generated for LIN40."
|
||||
assert line.product_qty == (4*0.25*factor), "Qty is not correspond."
|
||||
assert line.product_uom.id == ref('product.product_uom_meter'), "UOM is not correspond"
|
||||
woodlintelm = True
|
||||
elif line.product_id.id == ref('product.product_product_32'): #WOOD002 0.25 m
|
||||
assert not woodmm0, "Production line is already generated for WOOD002."
|
||||
assert line.product_qty == (0.25*factor), "Qty is not correspond."
|
||||
assert line.product_uom.id == ref('product.product_uom_meter'), "UOM is not correspond"
|
||||
woodmm0 = True
|
||||
elif line.product_id.id == ref('product.product_product_46'): #METC000 4*3 Unit
|
||||
assert not metalcleats, "Production line is already generated for METC000."
|
||||
assert line.product_qty == (4*3*factor), "Qty is not correspond."
|
||||
assert line.product_uom.id == ref('product.product_uom_unit'), "UOM is not correspond"
|
||||
metalcleats = True
|
||||
elif line.product_id.id == ref('product.product_product_34'): #WOOD010 0.083*3 m
|
||||
assert not woodmm10, "Production line is already generated for WOOD010."
|
||||
assert line.product_qty == (0.083*3*factor), "Qty is not correspond."
|
||||
assert line.product_uom.id == ref('product.product_uom_meter'), "UOM is not correspond"
|
||||
woodmm10 = True
|
||||
else:
|
||||
raise AssertionError('unknown order line: %s' % line)
|
||||
assert sidepanel, "Production line is not generated for SIDEPAN."
|
||||
assert woodlintelm, "Production line is not generated for LIN40."
|
||||
assert woodmm0, "Production line is not generated for WOOD002."
|
||||
assert metalcleats, "Production line is not generated for METC000."
|
||||
assert woodmm10, "Production line is not generated for WOOD010."
|
||||
|
||||
-
|
||||
Now I check workcenter lines.
|
||||
-
|
||||
@@ -57,40 +17,17 @@
|
||||
from tools import float_compare
|
||||
def assert_equals(value1, value2, msg, float_compare=float_compare):
|
||||
assert float_compare(value1, value2, precision_digits=2) == 0, msg
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"), context=context)
|
||||
assert len(order.workcenter_lines), "Workcenter lines are not generated proper."
|
||||
for line in order.workcenter_lines:
|
||||
wc = line.workcenter_id
|
||||
hours = ((wc.time_start or 0.0)+(wc.time_stop or 0.0)+line.cycle*(wc.time_cycle or 0.0)) * (wc.time_efficiency or 1.0)
|
||||
factor = 5*12
|
||||
d, m = divmod(factor, wc.capacity_per_cycle)
|
||||
cycle = (d + (m and 1.0 or 0.0))
|
||||
if line.name == "Short time assembly - Assembly Section":
|
||||
assert_equals(line.cycle, (4*cycle), "Computed cycles mismatch: %s" % (line.name))
|
||||
assert_equals(line.hour, (2*cycle*4 + hours), "Computed hours mismatch: %s"% (line.name))
|
||||
elif line.name == "Short time assembly - Rear Panel SHE100":
|
||||
assert_equals(line.cycle, (1*cycle), "Computed cycles mismatch: %s" % (line.name))
|
||||
assert_equals(line.hour, (2*cycle + hours), "Computed hours mismatch: %s"% (line.name))
|
||||
elif line.name == "long time assembly - Shelf of 100cm":
|
||||
assert_equals(line.cycle, (2*cycle), "Computed cycles mismatch: %s" % (line.name))
|
||||
assert_equals(line.hour, (5*cycle + hours), "Computed hours mismatch: %s"% (line.name))
|
||||
elif line.name == "Testing - Shelf of 100cm":
|
||||
assert_equals(line.cycle, (1*cycle), "Computed cycles mismatch: %s" % (line.name))
|
||||
assert_equals(line.hour, (1*cycle + hours), "Computed hours mismatch: %s"% (line.name))
|
||||
elif line.name == "Packing - Shelf of 100cm":
|
||||
assert_equals(line.cycle, (1*cycle), "Computed cycles mismatch: %s" % (line.name))
|
||||
assert_equals(line.hour, (0.5*cycle + hours), "Computed hours mismatch: %s"% (line.name))
|
||||
else:
|
||||
raise AssertionError('unknown workcenter line: %s' % line)
|
||||
-
|
||||
I confirm the Production Order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_shelf100cm}
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_test1}
|
||||
-
|
||||
I check details of Produce Move of Production Order to trace Final Product.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
assert order.state == 'confirmed', "Production order should be confirmed."
|
||||
assert order.move_created_ids, "Trace Record is not created for Final Product."
|
||||
move = order.move_created_ids[0]
|
||||
@@ -121,13 +58,12 @@
|
||||
assert move_line.product_uos.id == order_line.product_uos.id, "UOS is not correspond in 'To consume line'."
|
||||
assert move_line.location_id.id == routing_loc or order.location_src_id.id, "Source location is not correspond in 'To consume line'."
|
||||
assert move_line.location_dest_id.id == source_location_id, "Destination Location is not correspond in 'To consume line'."
|
||||
|
||||
-
|
||||
I check details of an Internal Shipment after confirmed production order to bring components in Raw Materials Location.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
procurement = self.pool.get('procurement.order')
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
assert order.picking_id, 'Internal Shipment should be created!'
|
||||
|
||||
routing_loc = None
|
||||
@@ -167,12 +103,11 @@
|
||||
assert shipment_procurement.product_uos.id == order_line.product_uos.id, "UOS is not correspond in procurement."
|
||||
assert shipment_procurement.location_id.id == order.location_src_id.id, "Location is not correspond in procurement."
|
||||
assert shipment_procurement.procure_method == order_line.product_id.procure_method, "Procure method is not correspond in procurement."
|
||||
|
||||
-
|
||||
I change production qty with 3 Dozen Shelf 100cm.
|
||||
I change production qty with 3 PC Assemble SC349.
|
||||
-
|
||||
!python {model: change.production.qty}: |
|
||||
context.update({'active_id': ref('mrp_production_shelf100cm')})
|
||||
context.update({'active_id': ref('mrp_production_test1')})
|
||||
-
|
||||
!record {model: change.production.qty, id: mrp_production_qty}:
|
||||
product_qty: 3.0
|
||||
@@ -183,7 +118,7 @@
|
||||
I check qty after changed in production order.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
assert order.product_qty == 3, "Qty is not changed in order."
|
||||
move = order.move_created_ids[0]
|
||||
assert move.product_qty == order.product_qty, "Qty is not changed in move line."
|
||||
@@ -196,23 +131,23 @@
|
||||
The production order is Waiting Goods, I forcefully done internal shipment.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
self.force_production(cr, uid, [ref("mrp_production_shelf100cm")])
|
||||
self.force_production(cr, uid, [ref("mrp_production_test1")])
|
||||
-
|
||||
I check that production order in ready state after forcefully done internal shipment.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
assert order.state == 'ready', 'Production order should be in Ready State.'
|
||||
assert order.picking_id.state == 'done', 'Internal shipment should be done.'
|
||||
-
|
||||
Now I start production.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_shelf100cm}
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_test1}
|
||||
-
|
||||
I check that production order in production state after start production.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
assert order.state == 'in_production', 'Production order should be in production State.'
|
||||
-
|
||||
I consume raw materials and put one material in scrap location due to waste it.
|
||||
@@ -220,16 +155,16 @@
|
||||
!python {model: mrp.production}: |
|
||||
scrap_location_ids = self.pool.get('stock.location').search(cr, uid, [('scrap_location','=',True)])
|
||||
scrap_location_id = scrap_location_ids[0]
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
for move in order.move_lines:
|
||||
move.action_consume(move.product_qty)
|
||||
if move.product_id.id == ref("product.product_product_46"):
|
||||
if move.product_id.id == ref("product.product_product_6"):
|
||||
move.action_scrap(5.0, scrap_location_id)
|
||||
-
|
||||
I produce product.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
context.update({'active_id': ref('mrp_production_shelf100cm')})
|
||||
context.update({'active_id': ref('mrp_production_test1')})
|
||||
-
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce1}:
|
||||
mode: 'consume_produce'
|
||||
@@ -240,13 +175,13 @@
|
||||
I check production order after produced.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
assert order.state == 'done', "Production order should be closed."
|
||||
-
|
||||
I check Total Costs at End of Production.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
account_analytic_line = self.pool.get('account.analytic.line')
|
||||
def rounding(f, r):
|
||||
import math
|
||||
@@ -275,28 +210,25 @@
|
||||
assert line.journal_id.id == wc.costs_journal_id.id, "Account Journal is not correspond."
|
||||
assert line.product_id.id == wc.product_id.id, "Product is not correspond."
|
||||
assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM is not correspond."
|
||||
|
||||
-
|
||||
I print a "BOM Structure".
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc, tools, os
|
||||
order = self.browse(cr, uid, ref("mrp_production_shelf100cm"))
|
||||
order = self.browse(cr, uid, ref("mrp_production_test1"))
|
||||
(data, format) = netsvc.LocalService('report.bom.structure').create(cr, uid, [order.bom_id.id], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'mrp-bom_structure_report.'+format), 'wb+').write(data)
|
||||
|
||||
-
|
||||
I print "Production Order".
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.mrp.production.order').create(cr, uid, [ref("mrp_production_shelf100cm")], {}, {})
|
||||
(data, format) = netsvc.LocalService('report.mrp.production.order').create(cr, uid, [ref("mrp_production_test1")], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'mrp-production_order_report.'+format), 'wb+').write(data)
|
||||
|
||||
-
|
||||
I print "Work Center Load Report".
|
||||
I print "Work Center Load Report".
|
||||
-
|
||||
!python {model: mrp.workcenter}: |
|
||||
ctx = context.copy()
|
||||
@@ -304,4 +236,4 @@
|
||||
data_dict = {'time_unit': 'day', 'measure_unit': 'hours'}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_mrp_workcenter_load_wizard',wiz_data=data_dict, context=ctx, our_module='mrp')
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
-
|
||||
In order to test mrp_jit module with OpenERP, I will create manufacturing order
|
||||
and check whether the procurement orders run without scheduler or not.
|
||||
In order to test mrp_jit module with OpenERP, I create procurement order for
|
||||
Computer Case product and check whether it runs without scheduler or not.
|
||||
-
|
||||
!record {model: procurement.order, id: mrp_production_mo0}:
|
||||
!record {model: procurement.order, id: procurement_order_test1}:
|
||||
company_id: base.main_company
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_id: stock.stock_location_stock
|
||||
name: PROC/TEST/0001
|
||||
product_id: product.product_product_4
|
||||
product_id: product.product_product_16
|
||||
product_qty: 10.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 0.0
|
||||
@@ -15,10 +15,10 @@
|
||||
|
|
||||
I confirm the procurement order PROC/TEST/0001.
|
||||
-
|
||||
!workflow {model: procurement.order, action: button_confirm, ref: mrp_production_mo0}
|
||||
!workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test1}
|
||||
-
|
||||
|
|
||||
I check that the procurement is scheduled automatically.
|
||||
-
|
||||
!assert {model: procurement.order, id: mrp_production_mo0, string: procstate}:
|
||||
!assert {model: procurement.order, id: procurement_order_test1, string: procstate}:
|
||||
- state<>'confirmed'
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
-
|
||||
In order to test mrp_operations with OpenERP, I refer created production order of PC Assemble SC349
|
||||
with routing - Manual Component's Assembly to test complete production process with respect of workcenter.
|
||||
-
|
||||
I compute the production order.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
order.action_compute(context=context)
|
||||
-
|
||||
I check planned date in workcenter lines of production order.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
for line in order.workcenter_lines:
|
||||
#TODO: to check start date of next line should be end of date of previous line.
|
||||
assert line.date_planned, "Planned Start date is not computed: %s" %(line)
|
||||
@@ -17,7 +20,7 @@
|
||||
-
|
||||
I confirm the Production Order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_shelf100cm}
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_1}
|
||||
-
|
||||
I run scheduler.
|
||||
-
|
||||
@@ -27,17 +30,17 @@
|
||||
I forcefully close internal shipment.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
self.force_production(cr, uid, [ref("mrp.mrp_production_shelf100cm")])
|
||||
self.force_production(cr, uid, [ref("mrp.mrp_production_1")])
|
||||
-
|
||||
I start production.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_shelf100cm}
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_1}
|
||||
-
|
||||
Production start on first work center, so I start work operation on first work center.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr)
|
||||
-
|
||||
@@ -45,16 +48,15 @@
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_pause', cr)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr)
|
||||
-
|
||||
I resume first work operation.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr)
|
||||
|
||||
@@ -63,32 +65,32 @@
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_cancel', cr)
|
||||
-
|
||||
I reset first work operation and start after resolve techninal fault of work center.
|
||||
I reset first work operation and start after resolving techninal fault of work center.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_draft', cr)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr)
|
||||
-
|
||||
Now Finished work of first work operation so I close that operation.
|
||||
I close first work operation as this work center completed its process.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_done', cr)
|
||||
-
|
||||
Now I close other operations after start one by one.
|
||||
Now I close other operations one by one which are in start state.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for work_line in order.workcenter_lines[1:]:
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', work_line.id, 'button_start_working', cr)
|
||||
@@ -98,8 +100,7 @@
|
||||
I check that the production order is now done.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
|
||||
print order.state
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
assert order.state == 'done', "Production should be closed after finished all operations."
|
||||
-
|
||||
I print a Barcode Report of Operation line.
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
-
|
||||
In order to test invoice type after repair.
|
||||
In order to test Invoice Method 'After Repair'.
|
||||
-
|
||||
I Confirm Repair order For Invoice Type After repair.
|
||||
I confirm Repair order taking Invoice Method 'After Repair'.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rmrp0}
|
||||
-
|
||||
I start the repairing process by click on "Start Repair" Button For Invoice Type After repair.
|
||||
I start the Repairing process by clicking on "Start Repair" button for Invoice Method 'After Repair'.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rmrp0}
|
||||
-
|
||||
I check that state is "Under Repair".
|
||||
I check the state is in "Under Repair".
|
||||
-
|
||||
!assert {model: mrp.repair, id: mrp_repair_rmrp0}:
|
||||
- state == 'under_repair'
|
||||
-
|
||||
Repairing Process for product is Done and I End Repair process by click on "End Repair" button.
|
||||
Repairing process for product is in Done state and I end Repair process by clicking on "End Repair" button.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rmrp0}
|
||||
-
|
||||
I define invoiced after repair option in this Repair order.
|
||||
so I create Invoice by click on "Make Invoice" wizard.
|
||||
I define Invoice Method 'After Repair' option in this Repair order.
|
||||
so I create invoice by clicking on "Make Invoice" wizard.
|
||||
-
|
||||
!record {model: mrp.repair.make_invoice, id: mrp_repair_make_invoice_0}:
|
||||
group: 1
|
||||
@@ -29,7 +29,7 @@
|
||||
!python {model: mrp.repair.make_invoice}: |
|
||||
self.make_invoices(cr, uid, [ref("mrp_repair_make_invoice_0")], {"active_ids": [ref("mrp_repair.mrp_repair_rmrp0")]})
|
||||
-
|
||||
I check that Invoice is created for this repair order.
|
||||
I check that invoice is created for this Repair order.
|
||||
-
|
||||
!python {model: mrp.repair}: |
|
||||
repair_id = self.browse(cr, uid, [ref('mrp_repair_rmrp0')], context=context)[0]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
-
|
||||
Now test invoice type before repair.
|
||||
Now I test for Invoice Method 'Before Repair'.
|
||||
-
|
||||
I Confirm Repair order For Invoice Type Before Repair.
|
||||
I confirm Repair order for Invoice Method 'Before Repair'.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rmrp2}
|
||||
-
|
||||
Repair order state to 'Ready'.
|
||||
I change Repair order state to 'Ready'.
|
||||
-
|
||||
!python {model: mrp.repair}: |
|
||||
self.action_repair_ready(cr, uid, [ref('mrp_repair_rmrp2')], context=None)
|
||||
@@ -14,16 +14,16 @@
|
||||
-
|
||||
!workflow {model: mrp.repair, action: action_invoice_create, ref: mrp_repair_rmrp2}
|
||||
-
|
||||
I check that Invoice is created for this repair order.
|
||||
I check that invoice is created for this Repair order.
|
||||
-
|
||||
!python {model: mrp.repair}: |
|
||||
repair_id = self.browse(cr, uid, [ref('mrp_repair_rmrp2')], context=context)[0]
|
||||
assert repair_id.invoice_id.id, _("No invoice exists for this repair order.")
|
||||
-
|
||||
I start the repairing process by click on "Start Repair" Button.
|
||||
I start the Repairing process by clicking on "Start Repair" button.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: action_repair_start, ref: mrp_repair_rmrp2}
|
||||
-
|
||||
Repairing Process for product is Done and I End Repair process by click on "End Repair" button For Invoice Type before repair.
|
||||
Repairing process for this product is in Done state and I end this process by clicking on "End Repair" button for Invoice Method 'Before Repair'.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rmrp2}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
-
|
||||
In order to test "mrp_repair" module, I start from confirm it, and start repair.
|
||||
In order to test "mrp_repair" module, I start with confirm state, and start repair.
|
||||
-
|
||||
I Confirm Repair order for Invoice Type 'None'.
|
||||
I confirm Repair order for Invoice Method 'No Invoice'.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rmrp1}
|
||||
-
|
||||
I start the repairing process by click on "Start Repair" Button For Invoice Type None.
|
||||
I start the repairing process by clicking on "Start Repair" button for Invoice Method 'No Invoice'.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rmrp1}
|
||||
-
|
||||
I check that state is "Under Repair".
|
||||
I check its state which is in "Under Repair".
|
||||
-
|
||||
!assert {model: mrp.repair, id: mrp_repair_rmrp1}:
|
||||
- state == 'under_repair'
|
||||
-
|
||||
Repairing Process for product is Done and I End Repair process by click on "End Repair" button.
|
||||
Repairing process for product is in Done state and I end this process by clicking on "End Repair" button.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rmrp1}
|
||||
-
|
||||
I define invoiced none option in this Repair order.
|
||||
I define Invoice Method 'No Invoice' option in this repair order.
|
||||
So, I check that Invoice should not be created for this repair order.
|
||||
-
|
||||
!python {model: mrp.repair}: |
|
||||
|
||||
@@ -47,7 +47,7 @@ With this module:
|
||||
],
|
||||
'demo_xml': [],
|
||||
'test': [
|
||||
#'test/mrp_subproduct.yml'
|
||||
'test/mrp_subproduct.yml'
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
In order to test mrp_subproduct with OpenERP, I add subproduct in bill of material.
|
||||
I make a production order, confirm it so stock moves for subproducts are generated.
|
||||
-
|
||||
I add a sub product in Bill of material for product Cabinet.
|
||||
I add a sub product in Bill of material for product External Hard Disk.
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_arm1}:
|
||||
!record {model: mrp.bom, id: mrp.mrp_bom_24}:
|
||||
product_id: product.product_product_28
|
||||
name: ARM100 + Subproduct
|
||||
name: External Hard Disk + Subproduct
|
||||
product_uom: product.product_uom_unit
|
||||
sub_products:
|
||||
- product_id: product.product_product_33
|
||||
@@ -14,13 +14,13 @@
|
||||
product_qty: 2.0
|
||||
subproduct_type: fixed
|
||||
-
|
||||
I create a production order for Cabinet.
|
||||
I create a production order for External Hard Disk.
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_mo0}:
|
||||
product_id: product.product_product_28
|
||||
product_qty: 10.0
|
||||
product_qty: 2.0
|
||||
product_uom: product.product_uom_unit
|
||||
bom_id: mrp_bom_arm1
|
||||
bom_id: mrp.mrp_bom_24
|
||||
location_src_id: stock.stock_location_stock
|
||||
-
|
||||
I compute the data of production order.
|
||||
@@ -30,8 +30,7 @@
|
||||
-
|
||||
I confirm the production order.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
self.action_confirm(cr, uid, [ref('mrp_production_mo0')])
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
|
||||
-
|
||||
I check production order state.
|
||||
-
|
||||
@@ -59,7 +58,7 @@
|
||||
I create record for selecting mode and quantity of products to produce.
|
||||
-
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce0}:
|
||||
product_qty: 10.00
|
||||
product_qty: 2.00
|
||||
mode: 'consume_produce'
|
||||
-
|
||||
I finish the production order.
|
||||
@@ -67,9 +66,10 @@
|
||||
!python {model: mrp.product.produce}: |
|
||||
self.do_produce(cr, uid, [ref("mrp_product_produce0")], {"active_model": "mrp.production", "active_ids":[ref("mrp_production_mo0")], "active_id": ref("mrp_production_mo0")})
|
||||
-
|
||||
I see that stock moves of Cabinet including Wooden Table are done now.
|
||||
I see that stock moves of External Hard Disk including Headset USB are done now.
|
||||
-
|
||||
!python {model: stock.move}: |
|
||||
move_ids = self.search(cr, uid, [('product_id','in',[ref("product.product_product_28"),ref("product.product_product_41")])])
|
||||
production_order = self.pool.get('mrp.production').browse(cr, uid, ref("mrp_production_mo0"))
|
||||
move_ids = self.search(cr, uid, [('origin','=',production_order.name), ('product_id','in',[ref("product.product_product_28"),ref("product.product_product_33")])])
|
||||
moves = self.browse(cr, uid, move_ids)
|
||||
assert all(move.state == 'done' for move in moves), 'Moves are not done!'
|
||||
|
||||
@@ -319,7 +319,13 @@ class procurement_order(osv.osv):
|
||||
if record.move_id and record.move_id.state == 'cancel':
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
#Initialize get_phantom_bom_id method as it is raising an error from yml of mrp_jit
|
||||
#when one install first mrp and after that, mrp_jit. get_phantom_bom_id defined in mrp module
|
||||
#which is not dependent for mrp_jit.
|
||||
def get_phantom_bom_id(self, cr, uid, ids, context=None):
|
||||
return False
|
||||
|
||||
def action_confirm(self, cr, uid, ids, context=None):
|
||||
""" Confirms procurement and writes exception message if any.
|
||||
@return: True
|
||||
|
||||
Reference in New Issue
Block a user