[FIX] mrp: removed picking_id field on mrp.production

bzr revid: jke@openerp.com-20131016071209-pryay03jucyezjje
This commit is contained in:
jke-openerp 2013-10-16 09:12:09 +02:00
parent c076e83b08
commit 18a9318cfd
4 changed files with 8 additions and 16 deletions

View File

@ -511,8 +511,8 @@ class mrp_production(osv.osv):
help="Bill of Materials allow you to define the list of required raw materials to make a finished product."),
'routing_id': fields.many2one('mrp.routing', string='Routing', on_delete='set null', readonly=True, states={'draft':[('readonly',False)]},
help="The list of operations (list of work centers) to produce the finished product. The routing is mainly used to compute work center costs during operations and to plan future loads on work centers based on production plannification."),
'picking_id': fields.many2one('stock.picking', 'Picking List', readonly=True, ondelete="restrict",
help="This is the Internal Picking List that brings the finished product to the production plan"),
# 'picking_id': fields.many2one('stock.picking', 'Picking List', readonly=True, ondelete="restrict",
# help="This is the Internal Picking List that brings the finished product to the production plan"),
'move_prod_id': fields.many2one('stock.move', 'Product Move', readonly=True),
'move_lines': fields.one2many('stock.move', 'raw_material_production_id', 'Products to Consume',
domain=[('state','not in', ('done', 'cancel'))], readonly=True, states={'draft':[('readonly',False)]}),
@ -717,10 +717,10 @@ class mrp_production(osv.osv):
context = {}
move_obj = self.pool.get('stock.move')
for production in self.browse(cr, uid, ids, context=context):
if production.state == 'confirmed' and production.picking_id.state not in ('draft', 'cancel'):
raise osv.except_osv(
_('Cannot cancel manufacturing order!'),
_('You must first cancel related internal picking attached to this manufacturing order.'))
if production.state == 'confirmed': #and production.picking_id.state not in ('draft', 'cancel'):
raise osv.except_osv(
_('Cannot cancel manufacturing order!'),
_('You must first cancel related internal picking attached to this manufacturing order.'))
if production.move_created_ids:
move_obj.action_cancel(cr, uid, [x.id for x in production.move_created_ids])
move_obj.action_cancel(cr, uid, [x.id for x in production.move_lines])

View File

@ -788,8 +788,7 @@
<field name="date_finished" invisible="1"/>
</group>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="picking_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="move_prod_id" groups="stock.group_locations"/>
</group>
</group>

View File

@ -7,12 +7,6 @@
I first confirm order for PC Assemble SC349.
-
!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_test1')).picking_id.id]"
-
Now I cancel the production order.
-

View File

@ -47,8 +47,7 @@ class TestMrpMulticompany(common.TransactionCase):
cr, uid, context = self.cr, self.multicompany_user_id, {}
fields = ['location_src_id', 'location_dest_id']
defaults = self.stock_location.default_get(cr, uid, ['location_id', 'location_dest_id', 'type'], context)
for field in fields:
print field, uid, defaults
for field in fields:
if defaults.get(field):
try:
self.stock_location.check_access_rule(cr, uid, [defaults[field]], 'read', context)