From a382e0cc2e5e2e20c73d8a0aa576bc50afaf46ea Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 12 Nov 2013 16:17:47 +0100 Subject: [PATCH] [FIX] procurement: magic bypass transition was incomplete and preventing pulled flows from working The procurement workflow has a magic `bypass` transition that acts as a fallback for MTO procurements in case the necessary modules are not (yet) installed. For example it will consider a MTO+Buy procurement directly satisfied if the Purchase module is not yet installed. However this bypass transition did not properly take "internal pulled flows" into account, which are added by the `stock_location` module as a third kind of procurement type. In this case the bypass would match and never give stock_location the chance to run. In order to be consistent with the other procurement methods, the bypass transition needs to be adapted. Also updated the check_move() method to make it more explicit rather than a side-effect. bzr revid: odo@openerp.com-20131112151747-da67h4yavhz3k29c --- addons/procurement/procurement.py | 10 ++++++---- addons/procurement/procurement_workflow.xml | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 66024256f9a..badd0c7498f 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -182,10 +182,6 @@ class procurement_order(osv.osv): """ return all(procurement.move_id.state == 'cancel' for procurement in self.browse(cr, uid, ids, context=context)) - #This Function is create to avoid a server side Error Like 'ERROR:tests.mrp:name 'check_move' is not defined' - def check_move(self, cr, uid, ids, context=None): - pass - def check_move_done(self, cr, uid, ids, context=None): """ Checks if move is done or not. @return: True or False. @@ -298,6 +294,12 @@ class procurement_order(osv.osv): """ return False + def check_move(self, cr, uid, ids, context=None): + """ Check whether the given procurement can be satisfied by an internal move, + typically a pulled flow. By default, it's False. Overwritten by the `stock_location` module. + """ + return False + def check_conditions_confirm2wait(self, cr, uid, ids): """ condition on the transition to go from 'confirm' activity to 'confirm_wait' activity """ return not self.test_cancel(cr, uid, ids) diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index fce74af4f1c..d4068a6eada 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -147,9 +147,11 @@