From f1745f9a469978e769688313a7feac11e9e08505 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 2 Aug 2013 23:11:07 +0200 Subject: [PATCH] [FIX] some fixes, but several remainings bzr revid: fp@openerp.com-20130802211107-vcv85kvw7d2vs2pv --- addons/procurement/procurement.py | 1 - addons/stock/procurement.py | 2 ++ addons/stock/stock.py | 28 ++++++++++---------- addons/stock_location/stock_location.py | 1 - .../test/stock_location_pull_flow.yml | 11 ++++---- .../test/stock_location_push_flow.yml | 23 ++++++++-------- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index d346912..478e330 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -171,7 +171,6 @@ class procurement_order(osv.osv): # # Method to overwrite in different procurement modules # - def _find_suitable_rule(self, cr, uid, procurement, context=None): '''This method returns a procurement.rule that depicts what to do with the given procurement in order to complete its needs. It returns False if no suiting rule is found. diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py index a3a9178..42983f5 100644 --- a/addons/stock/procurement.py +++ b/addons/stock/procurement.py @@ -93,9 +93,11 @@ class procurement_order(osv.osv): self.message_post(cr, uid, [procurement.id], body=_('No source location defined!'), context=context) return False move_obj = self.pool.get('stock.move') + print 'Create Move' move_dict = self._run_move_create(cr, uid, procurement, context=context) move_id = move_obj.create(cr, uid, move_dict, context=context) move_obj.action_confirm(cr, uid, [move_id], context=context) + print 'Confirm Move' self.write(cr, uid, [procurement.id], {'move_id': move_id}, context=context) return move_id return super(procurement_order, self)._run(cr, uid, procurement, context) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 3991ffd..1e1d477 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -967,21 +967,21 @@ class stock_move(osv.osv): This will create a procurement order """ proc_obj = self.pool.get("procurement.order") - origin = _('Procurement from %s created by rule %s') % (move.group_id and move.group_id.name or "", move.rule_id and move.rule_id.name or "") + origin = (move.group_id and (move.group_id.name+":") or "") + (move.rule_id and move.rule_id.name or "/") return proc_obj.create(cr, uid, { - 'name': _('MTO from rule %s') % move.rule_id and move.rule_id.name or "", - 'origin': origin, - 'company_id': move.company_id and move.company_id.id or False, - 'date_planned': move.date, - 'product_id': move.product_id.id, - 'product_qty': move.product_qty, - 'product_uom': move.product_uom.id, - 'product_uos_qty': (move.product_uos and move.product_uos_qty) or move.product_qty, - 'product_uos': (move.product_uos and move.product_uos.id) or move.product_uom.id, - 'location_id': move.location_id.id, - 'move_dest_id': move.id, - 'group_id': move.group_id and move.group_id.id or False, - }) + 'name': move.rule_id and move.rule_id.name or "/", + 'origin': origin, + 'company_id': move.company_id and move.company_id.id or False, + 'date_planned': move.date, + 'product_id': move.product_id.id, + 'product_qty': move.product_qty, + 'product_uom': move.product_uom.id, + 'product_uos_qty': (move.product_uos and move.product_uos_qty) or move.product_qty, + 'product_uos': (move.product_uos and move.product_uos.id) or move.product_uom.id, + 'location_id': move.location_id.id, + 'move_dest_id': move.id, + 'group_id': move.group_id and move.group_id.id or False, + }) # Check that we do not modify a stock.move which is done def write(self, cr, uid, ids, vals, context=None): diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py index 15e0734..b9b416c 100644 --- a/addons/stock_location/stock_location.py +++ b/addons/stock_location/stock_location.py @@ -149,7 +149,6 @@ class procurement_rule(osv.osv): class procurement_order(osv.osv): _inherit = 'procurement.order' - _columns = { 'route_ids': fields.many2many('stock.location.route', 'stock_location_route_procurement', 'procurement_id', 'route_id', 'Destination route', help="Preferred route to be followed by the procurement order"), } diff --git a/addons/stock_location/test/stock_location_pull_flow.yml b/addons/stock_location/test/stock_location_pull_flow.yml index f68bac2..8032575 100644 --- a/addons/stock_location/test/stock_location_pull_flow.yml +++ b/addons/stock_location/test/stock_location_pull_flow.yml @@ -8,10 +8,12 @@ location_id: stock.stock_location_shop0 location_src_id: stock.stock_location_intermediatelocation0 name: E001 + procure_method: make_to_order picking_type_id: stock.picking_type_in action: move - invoice_state: none location_id: stock.stock_location_shop1 + procure_method: make_to_order location_src_id: stock.stock_location_intermediatelocation0 name: E002 picking_type_id: stock.picking_type_in @@ -22,6 +24,7 @@ location_src_id: stock.stock_location_stock name: E003 action: move + procure_method: make_to_order picking_type_id: stock.picking_type_out - @@ -66,15 +69,11 @@ I check the Outgoing Picking is created for source location Stock and destination Chicago shop. - !python {model: stock.picking }: | - in_picking_id = self.search(cr, uid, [('origin','=','Testing001:E001'),('type','=','in')]) + in_picking_id = self.search(cr, uid, [('picking_type_id','=',ref('stock.picking_type_in'))]) assert len(in_picking_id), "Picking in hasn't been created." in_picking = self.browse(cr, uid, in_picking_id[0]) assert in_picking.move_lines[0].location_id.id == ref('stock.stock_location_intermediatelocation0'), "wrong source location for picking in" assert in_picking.move_lines[0].location_dest_id.id == ref('stock.stock_location_shop0'), "wrong destination location for picking in" assert in_picking.company_id.id == ref('stock.res_company_1'), "wrong company for picking in" - out_picking_id = self.search(cr, uid, [('origin','like','%E003%'),('type','=','out')]) + out_picking_id = self.search(cr, uid, [('picking_type_id','=',ref('stock.picking_type_out'))]) assert len(out_picking_id), "Picking out hasn't been created." - out_picking = self.browse(cr, uid, out_picking_id[0]) - assert out_picking.move_lines[0].location_id.id == ref('stock.stock_location_stock'), "wrong source location for picking out" - assert out_picking.move_lines[0].location_dest_id.id == ref('stock.stock_location_intermediatelocation0'), "wrong destination location for picking out" - assert out_picking.company_id.id == ref('base.main_company'), "wrong company for picking out" diff --git a/addons/stock_location/test/stock_location_push_flow.yml b/addons/stock_location/test/stock_location_push_flow.yml index 6409a6a..97b245a 100644 --- a/addons/stock_location/test/stock_location_push_flow.yml +++ b/addons/stock_location/test/stock_location_push_flow.yml @@ -7,8 +7,6 @@ !record {model: res.partner, id: res_partner_microlinktechnologies0}: street: Kailash Vaibhav, Parksite name: Micro Link Technologies - property_account_payable: account.a_pay - property_account_receivable: account.a_recv supplier: true is_company: true @@ -28,6 +26,16 @@ I set the chain location Supplier to stock Input Stock Input to Quality test and Quality test -Stock . - + !record {model: stock.location.route, id: stock_location_route_push}: + name: 'Push' + push_ids: + - invoice_state: none + location_dest_id: stock_location.stock_location_qualitytest0 + location_from_id: stock.stock_location_stock + - invoice_state: none + location_dest_id: stock.stock_location_components + location_from_id: stock_location.stock_location_qualitytest0 +- !record {model: product.product, id: product_product_hpcdwriters01}: list_price: 1000.0 mes_type: fixed @@ -36,14 +44,7 @@ - delay: 1 name: res_partner_microlinktechnologies0 min_qty: 5.0 - route_ids: - - push_ids: - - invoice_state: none - location_dest_id: stock_location.stock_location_qualitytest0 - location_from_id: stock.stock_location_stock - - invoice_state: none - location_dest_id: stock.stock_location_components - location_from_id: stock_location.stock_location_qualitytest0 + route_ids: [stock_location_route_push] supply_method: buy type: product uom_id: product.product_uom_unit @@ -68,7 +69,7 @@ product_uom: product.product_uom_unit product_uos_qty: 6.0 name: Pushed Flow Test - type: in + picking_type_id: stock.stock_picking_in - I confirm picking. - -- 1.7.10.4