[FIX] changes made at merge time into the trunk - remove offending test

bzr revid: ls@numerigraphe.com-20140404123655-9ihrychuho6n6qt2
This commit is contained in:
Martin Trigaux 2014-04-04 14:36:55 +02:00 committed by Lionel Sausin
parent bae4c6ce40
commit af64d6cc97
2 changed files with 46 additions and 19 deletions

View File

@ -6,8 +6,14 @@
name: MRP Manager
login: mam
password: mam
email: mrp_manager@yourcompany.com
-
I added groups for MRP Manager.
-
!record {model: res.users, id: res_users_mrp_manager}:
groups_id:
- mrp.group_mrp_manager
- account.group_account_user
-
Create a user as 'MRP User'
-
@ -16,5 +22,10 @@
name: MRP User
login: mau
password: mau
email: mrp_user@yourcompany.com
-
I added groups for MRP User.
-
!record {model: res.users, id: res_users_mrp_user}:
groups_id:
- mrp.group_mrp_user
- mrp.group_mrp_user

View File

@ -1,5 +1,5 @@
-
MRP user can doing all process related to Production Order, so let's check data with giving the access rights of user.
MRP user can doing all process related to Production Order, so let's check data with giving the access rights of user.
-
!context
uid: 'res_users_mrp_user'
@ -19,7 +19,7 @@
Now I check workcenter lines.
-
!python {model: mrp.production}: |
from tools import float_compare
from openerp.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_test1"), context=context)
@ -28,6 +28,7 @@
I confirm the Production Order.
-
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_test1}
-
I check details of Produce Move of Production Order to trace Final Product.
-
@ -63,6 +64,16 @@
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 consume raw materials and put one material in scrap location due to waste it.
-
!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_test1"))
for move in order.move_lines:
if move.product_id.id == ref("product.product_product_6"):
move.action_scrap(5.0, scrap_location_id)
-
I check details of an Internal Shipment after confirmed production order to bring components in Raw Materials Location.
-
@ -99,6 +110,11 @@
procurement_ids = procurement.search(cr, uid, [('move_id','=',move_line.id)])
assert procurement_ids, "Procurement should be created for shipment line of raw materials."
shipment_procurement = procurement.browse(cr, uid, procurement_ids[0], context=context)
# procurement state should be `confirmed` at this stage, except if mrp_jit is installed, in which
# case it could already be in `running` or `exception` state (not enough stock)
expected_states = ('confirmed', 'running', 'exception')
assert shipment_procurement.state in expected_states, 'Procurement state is `%s` for %s, expected one of %s' % \
(shipment_procurement.state, shipment_procurement.product_id.name, expected_states)
assert shipment_procurement.date_planned == date_planned, "Planned date is not correspond in procurement."
assert shipment_procurement.product_id.id == order_line.product_id.id, "Product is not correspond in procurement."
assert shipment_procurement.product_qty == order_line.product_qty, "Qty is not correspond in procurement."
@ -155,17 +171,7 @@
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.
-
!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_test1"))
for move in order.move_lines:
move.action_consume(move.product_qty)
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}: |
@ -183,7 +189,10 @@
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.
I check Total Costs at End of Production as a manager.
-
!context
uid: 'res_users_mrp_manager'
-
!python {model: mrp.production}: |
order = self.browse(cr, uid, ref("mrp_production_test1"))
@ -217,19 +226,26 @@
assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM is not correspond."
-
I print a "BOM Structure".
-
!context
uid: 'res_users_mrp_user'
-
!python {model: mrp.production}: |
import netsvc, tools, os
import os
import openerp.report
from openerp import tools
order = self.browse(cr, uid, ref("mrp_production_test1"))
(data, format) = netsvc.LocalService('report.bom.structure').create(cr, uid, [order.bom_id.id], {}, {})
data, format = openerp.report.render_report(cr, uid, [order.bom_id.id], 'bom.structure', {}, {})
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_test1")], {}, {})
import os
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref("mrp_production_test1")], 'mrp.production.order', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'mrp-production_order_report.'+format), 'wb+').write(data)
-
@ -239,6 +255,6 @@
ctx = context.copy()
ctx.update({'model': 'mrp.workcenter','active_ids': [ref('mrp_workcenter_0'),ref('mrp_workcenter_1')]})
data_dict = {'time_unit': 'day', 'measure_unit': 'hours'}
from tools import test_reports
from openerp.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')