diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml index 4b4ebdb7323..9c953482f53 100644 --- a/addons/account_anglo_saxon/test/anglo_saxon.yml +++ b/addons/account_anglo_saxon/test/anglo_saxon.yml @@ -103,7 +103,7 @@ I configure the product with required accounts, and cost method = standard - !python {model: product.product}: | - self.write(cr, uid, [ref('product.product_product_3')], {'list_price': 20.00,'standard_price': 9,'categ_id': ref('product.product_category_4'),'valuation': 'real_time', + self.write(cr, uid, [ref('product.product_product_10')], {'list_price': 20.00,'standard_price': 9,'categ_id': ref('product.product_category_4'),'valuation': 'real_time', 'property_account_income': ref('account_anglo_income'),'property_account_expense': ref('account_anglo_cogs'), 'property_account_creditor_price_difference': ref('account_anglo_price_difference'),'property_stock_account_input': ref('account_anglo_stock_input'), 'property_stock_account_output': ref('account_anglo_stock_output'), 'cost_method': 'standard'}) @@ -115,7 +115,7 @@ location_id: stock.stock_location_stock pricelist_id: 1 order_line: - - product_id: product.product_product_3 + - product_id: product.product_product_10 product_qty: 1 price_unit: 10 date_planned: !eval "'%s' % (time.strftime('%Y-%m-%d'))" @@ -194,7 +194,7 @@ move_lines: - company_id: base.main_company location_id: stock.stock_location_stock - product_id: product.product_product_3 + product_id: product.product_product_10 product_uom_qty: 1.0 product_uom: product.product_uom_unit location_dest_id: stock.stock_location_customers diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index dc4e84f11ee..7a69d7a71b2 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1035,11 +1035,12 @@ class mrp_production(osv.osv): 'location_dest_id': destination_location_id, 'move_dest_id': production.move_prod_id.id, 'company_id': production.company_id.id, + 'production_id': production.id, } move_id = stock_move.create(cr, uid, data, context=context) - stock_move.action_confirm(cr, uid, [move_id], context=context) - production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context) - return move_id + #a phantom bom cannot be used in mrp order so it's ok to assume the list returned by action_confirm + #is 1 element long, so we can take the first. + return stock_move.action_confirm(cr, uid, [move_id], context=context)[0] def _make_production_consume_line(self, cr, uid, production_line, parent_move_id, source_location_id=False, context=None): stock_move = self.pool.get('stock.move') @@ -1062,10 +1063,10 @@ class mrp_production(osv.osv): 'location_dest_id': destination_location_id, 'company_id': production.company_id.id, 'procure_method': 'make_to_order', + 'raw_material_production_id': production.id, }) stock_move.action_confirm(cr, uid, [move_id], context=context) - production.write({'move_lines': [(4, move_id)]}, context=context) - return move_id + return True def action_confirm(self, cr, uid, ids, context=None): """ Confirms production order. diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 338191a1215..7cdd489d9c5 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -687,7 +687,7 @@ - +