From ef0b59cb8506bb55724326a8dfd94cc0355c7c81 Mon Sep 17 00:00:00 2001 From: Arnaud Pineux Date: Fri, 7 Dec 2012 12:53:04 +0100 Subject: [PATCH 01/15] [FIX] WORKFLOW: avoid overwriting transitions for clean uninstallation bzr revid: api@openerp.com-20121207115304-3uhsbnhv8i3g4qdx --- .../hr_payroll_account_workflow.xml | 31 ------------------ addons/mrp/mrp_workflow.xml | 8 +++-- addons/mrp_jit/mrp_jit.xml | 6 ++-- addons/procurement/procurement_workflow.xml | 32 +++++++++++++++++-- addons/purchase/purchase_workflow.xml | 17 +++++----- 5 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 addons/hr_payroll_account/hr_payroll_account_workflow.xml diff --git a/addons/hr_payroll_account/hr_payroll_account_workflow.xml b/addons/hr_payroll_account/hr_payroll_account_workflow.xml deleted file mode 100644 index ff627f2619d..00000000000 --- a/addons/hr_payroll_account/hr_payroll_account_workflow.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - account_check - account_check_sheet() - function - - - - - - True - account_verify_sheet - - - - - - True - final_verify_sheet - - - - - - cancel_sheet - - - diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml index 365c1195c44..a1fe71fd750 100644 --- a/addons/mrp/mrp_workflow.xml +++ b/addons/mrp/mrp_workflow.xml @@ -136,14 +136,16 @@ subflow.cancel - + subflow.done - - not test_cancel() and not get_phantom_bom_id() + + + + not get_phantom_bom_id() diff --git a/addons/mrp_jit/mrp_jit.xml b/addons/mrp_jit/mrp_jit.xml index 99f74a19517..688f43e8bdb 100644 --- a/addons/mrp_jit/mrp_jit.xml +++ b/addons/mrp_jit/mrp_jit.xml @@ -2,8 +2,10 @@ - - + + + + not test_cancel() diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index 53b6608fa6f..4215f9b0ac5 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -31,6 +31,12 @@ confirm_wait function write({'state':'exception'}) + AND + + + + confirm_temp + OR @@ -40,6 +46,16 @@ confirm_mto + + + buy + OR + + + + buy_end + AND + make_to_stock @@ -106,10 +122,14 @@ - + button_check not test_cancel() + + + + @@ -142,9 +162,17 @@ - + check_buy() + + + + + + + + diff --git a/addons/purchase/purchase_workflow.xml b/addons/purchase/purchase_workflow.xml index 212ce304e07..2ddc96b800e 100644 --- a/addons/purchase/purchase_workflow.xml +++ b/addons/purchase/purchase_workflow.xml @@ -201,28 +201,27 @@ - + - buy + buy_subflows subflow action_po_assign() - - - - check_buy() + + + - - + + subflow.delivery_done - + subflow.cancel From 7414ce209f98cf8120dabef5044fd33cc1f74cab Mon Sep 17 00:00:00 2001 From: Arnaud Pineux Date: Mon, 10 Dec 2012 10:18:41 +0100 Subject: [PATCH 02/15] [FIX] Workflow clean uninstallation bzr revid: api@openerp.com-20121210091841-42xxklcqfktl4le7 --- addons/mrp/mrp_workflow.xml | 6 +++--- addons/mrp_jit/mrp_jit.xml | 2 +- addons/procurement/procurement_workflow.xml | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml index a1fe71fd750..6bde1143993 100644 --- a/addons/mrp/mrp_workflow.xml +++ b/addons/mrp/mrp_workflow.xml @@ -143,9 +143,9 @@ - - - not get_phantom_bom_id() + + + not test_cancel() and not get_phantom_bom_id() diff --git a/addons/mrp_jit/mrp_jit.xml b/addons/mrp_jit/mrp_jit.xml index 688f43e8bdb..32e09175da2 100644 --- a/addons/mrp_jit/mrp_jit.xml +++ b/addons/mrp_jit/mrp_jit.xml @@ -4,7 +4,7 @@ - + not test_cancel() diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index 4215f9b0ac5..1e2f58a0236 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -25,6 +25,7 @@ confirm function action_confirm() + OR From 724b34b3b3dc9f735cdcc75dafb1423772bf7d8b Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 14 Dec 2012 15:23:05 +0100 Subject: [PATCH 03/15] [REF] procurement: changed the method check_product() into is_product(), which is more meaningful + replaced weird code with a raise to see if it is used somewhere (i doubt) bzr revid: qdp-launchpad@openerp.com-20121214142305-2jhdu8fbhshfh4f4 --- addons/procurement/procurement.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index c166f79e524..935feea0f23 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -153,9 +153,9 @@ class procurement_order(osv.osv): return {'value': v} return {} - def check_product(self, cr, uid, ids, context=None): - """ Checks product type. - @return: True or False + def is_product(self, cr, uid, ids, context=None): + """ Checks product type to decide which transition of the workflow to follow. + @return: True if all product ids received in argument are of type 'product' or 'consummable'. False if any is of type 'service' """ return all(proc.product_id.type in ('product', 'consu') for proc in self.browse(cr, uid, ids, context=context)) @@ -264,10 +264,6 @@ class procurement_order(osv.osv): product = procurement.product_id #TOFIX: if product type is 'service' but supply_method is 'buy'. if product.supply_method <> 'produce': - supplier = product.seller_id - if supplier and user.company_id and user.company_id.partner_id: - if supplier.id == user.company_id.partner_id.id: - continue return False if product.type=='service': res = self.check_produce_service(cr, uid, procurement, context) @@ -300,7 +296,7 @@ class procurement_order(osv.osv): return False if user.company_id and user.company_id.partner_id: if partner.id == user.company_id.partner_id.id: - return False + raise osv.except_osv(_('Configuration Error!'), _('The product "%s" has been defined with your company as reseller which seems to be a configuration error!' % procurement.product_id.name)) address_id = partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery'] if not address_id: From a26b04c9211c66ffb00090942bc62fe696384976 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 14 Dec 2012 15:58:33 +0100 Subject: [PATCH 04/15] [FIX] procurement, mrp, project_mrp: refactored the worflow in order to fix the case where mrp wasn't installed and we configured a product as mto with type=='produce' bzr revid: qdp-launchpad@openerp.com-20121214145833-32q17yb2gw5rlhed --- addons/mrp/mrp_workflow.xml | 34 +++++++++------- addons/mrp/procurement.py | 23 ++++++----- addons/procurement/procurement.py | 2 +- addons/procurement/procurement_workflow.xml | 43 +++------------------ addons/project_mrp/project_mrp_workflow.xml | 21 ++++++++++ 5 files changed, 62 insertions(+), 61 deletions(-) diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml index 6bde1143993..ad1cac64345 100644 --- a/addons/mrp/mrp_workflow.xml +++ b/addons/mrp/mrp_workflow.xml @@ -116,6 +116,10 @@ + + + need_production + produce @@ -123,30 +127,34 @@ action_produce_assign_product() - + + + + + check_produce() + - + - check_product() + is_product() and check_bom_exists() - - - - - subflow.cancel - - - + + subflow.done - + not test_cancel() and not get_phantom_bom_id() - + + + + subflow.cancel + + diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index e2ba45ee230..00d0cc00fd7 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -33,19 +33,24 @@ class procurement_order(osv.osv): 'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'), 'production_id': fields.many2one('mrp.production', 'Manufacturing Order'), } - + def check_produce_product(self, cr, uid, procurement, context=None): + return True + + def check_bom_exists(self, cr, uid, ids, context=None): """ Finds the bill of material for the product from procurement order. @return: True or False """ - properties = [x.id for x in procurement.property_ids] - bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties) - if not bom_id: - cr.execute('update procurement_order set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id)) - for (id, name) in self.name_get(cr, uid, procurement.id): - message = _("Procurement '%s' has an exception: 'No BoM defined for this product !'") % name - self.message_post(cr, uid, [procurement.id], body=message, context=context) - return False + for procurement in self.browse(cr, uid, ids, context=context): + product = procurement.product_id + properties = [x.id for x in procurement.property_ids] + bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties) + if not bom_id: + cr.execute('update procurement_order set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id)) + for (id, name) in self.name_get(cr, uid, procurement.id): + message = _("Procurement '%s' has an exception: 'No BoM defined for this product !'") % name + self.message_post(cr, uid, [procurement.id], body=message, context=context) + return False return True def get_phantom_bom_id(self, cr, uid, ids, context=None): diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 935feea0f23..ea396b61491 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -241,7 +241,7 @@ class procurement_order(osv.osv): @param procurement: Current procurement. @return: True or False. """ - return True + return False def check_make_to_stock(self, cr, uid, ids, context=None): """ Checks product type. diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index 1e2f58a0236..1ac0453b0c5 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -63,17 +63,6 @@ function action_move_assigned() - - - produce_check - - - - - produce_service - function - action_produce_assign_service() - @@ -189,12 +178,13 @@ check_make_to_stock() - + + - - check_produce() + + not check_produce() - + @@ -202,29 +192,6 @@ - - - - - - - - not check_product() - - - - - subflow.cancel - - - - - diff --git a/addons/project_mrp/project_mrp_workflow.xml b/addons/project_mrp/project_mrp_workflow.xml index 18962cde0ee..b1ad8411dc2 100644 --- a/addons/project_mrp/project_mrp_workflow.xml +++ b/addons/project_mrp/project_mrp_workflow.xml @@ -1,6 +1,27 @@ + + + produce_service + function + action_produce_assign_service() + + + + + + not is_product() + + + + + + + + + subflow.cancel + From 65eb409d7d70c51dcd294cb65e83186cdf21e42a Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 14 Dec 2012 16:34:02 +0100 Subject: [PATCH 05/15] [FIX] mrp, project_mrp: fixed the refences to procurement workflow bzr revid: qdp-launchpad@openerp.com-20121214153402-ckufkt6003hy7mv1 --- addons/mrp/mrp_workflow.xml | 2 +- addons/project_mrp/project_mrp_workflow.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml index ad1cac64345..e590c47380b 100644 --- a/addons/mrp/mrp_workflow.xml +++ b/addons/mrp/mrp_workflow.xml @@ -117,7 +117,7 @@ - + need_production diff --git a/addons/project_mrp/project_mrp_workflow.xml b/addons/project_mrp/project_mrp_workflow.xml index b1ad8411dc2..d6b4130b21f 100644 --- a/addons/project_mrp/project_mrp_workflow.xml +++ b/addons/project_mrp/project_mrp_workflow.xml @@ -2,7 +2,7 @@ - + produce_service function action_produce_assign_service() From 3c7cd8f24d4282a284bb967ef9d2c7ddd5b8839e Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 14 Dec 2012 17:07:21 +0100 Subject: [PATCH 06/15] [FIX] project_mrp: fixed wrong refence in procurement workflow bzr revid: qdp-launchpad@openerp.com-20121214160721-tqmrqyh45d0kly8t --- addons/project_mrp/project_mrp_workflow.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_mrp/project_mrp_workflow.xml b/addons/project_mrp/project_mrp_workflow.xml index d6b4130b21f..11eac835ba1 100644 --- a/addons/project_mrp/project_mrp_workflow.xml +++ b/addons/project_mrp/project_mrp_workflow.xml @@ -9,7 +9,7 @@ - + not is_product() From 0c0c0816762185bf7153f052d186cf00910617e1 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 14 Dec 2012 17:39:21 +0100 Subject: [PATCH 07/15] [FIX] purchase, procurement: workflow of procurement order fixed bzr revid: qdp-launchpad@openerp.com-20121214163921-hevj7um2n7jf8e1p --- addons/procurement/procurement.py | 32 ++---------------- addons/procurement/procurement_workflow.xml | 26 ++------------- addons/purchase/purchase.py | 37 +++++++++++++++++++++ addons/purchase/purchase_workflow.xml | 25 +++++++------- 4 files changed, 55 insertions(+), 65 deletions(-) diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index ea396b61491..68360152399 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -274,37 +274,9 @@ class procurement_order(osv.osv): return True def check_buy(self, cr, uid, ids): - """ Checks product type. - @return: True or Product Id. + """ability of the workflow to manage the supply_method == 'buy'. """ - user = self.pool.get('res.users').browse(cr, uid, uid) - partner_obj = self.pool.get('res.partner') - for procurement in self.browse(cr, uid, ids): - if procurement.product_id.product_tmpl_id.supply_method <> 'buy': - return False - if not procurement.product_id.seller_ids: - message = _('No supplier defined for this product !') - self.message_post(cr, uid, [procurement.id], body=message) - cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id)) - return False - partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement. - - if not partner: - message = _('No default supplier defined for this product') - self.message_post(cr, uid, [procurement.id], body=message) - cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id)) - return False - if user.company_id and user.company_id.partner_id: - if partner.id == user.company_id.partner_id.id: - raise osv.except_osv(_('Configuration Error!'), _('The product "%s" has been defined with your company as reseller which seems to be a configuration error!' % procurement.product_id.name)) - - address_id = partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery'] - if not address_id: - message = _('No address defined for the supplier') - self.message_post(cr, uid, [procurement.id], body=message) - cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id)) - return False - return True + return False def test_cancel(self, cr, uid, ids): """ Tests whether state of move is cancelled or not. diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index 1ac0453b0c5..12c20393310 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -34,6 +34,7 @@ write({'state':'exception'}) AND + confirm_temp @@ -47,16 +48,6 @@ confirm_mto - - - buy - OR - - - - buy_end - AND - make_to_stock @@ -116,6 +107,7 @@ button_check not test_cancel() + @@ -150,18 +142,6 @@ button_cancel - - - - check_buy() - - - - - - - - @@ -182,7 +162,7 @@ - not check_produce() + not check_produce() and not check_buy() diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 5a12b17333a..47ae0eaa325 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1041,6 +1041,43 @@ class procurement_order(osv.osv): 'purchase_id': fields.many2one('purchase.order', 'Purchase Order'), } + def check_buy(self, cr, uid, ids): + ''' return True if the supply method of the mto product is 'buy' + ''' + user = self.pool.get('res.users').browse(cr, uid, uid) + partner_obj = self.pool.get('res.partner') + for procurement in self.browse(cr, uid, ids): + if procurement.product_id.product_tmpl_id.supply_method <> 'buy': + return False + return True + + def check_supplier_info(self, cr, uid, ids, context=None): + for procurement in self.browse(cr, uid, ids, context=context): + if not procurement.product_id.seller_ids: + message = _('No supplier defined for this product !') + self.message_post(cr, uid, [procurement.id], body=message) + cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id)) + return False + partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement. + + if not partner: + message = _('No default supplier defined for this product') + self.message_post(cr, uid, [procurement.id], body=message) + cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id)) + return False + if user.company_id and user.company_id.partner_id: + if partner.id == user.company_id.partner_id.id: + raise osv.except_osv(_('Configuration Error!'), _('The product "%s" has been defined with your company as reseller which seems to be a configuration error!' % procurement.product_id.name)) + + address_id = partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery'] + if not address_id: + message = _('No address defined for the supplier') + self.message_post(cr, uid, [procurement.id], body=message) + cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id)) + return False + return True + + def action_po_assign(self, cr, uid, ids, context=None): """ This is action which call from workflow to assign purchase order to procurements @return: True diff --git a/addons/purchase/purchase_workflow.xml b/addons/purchase/purchase_workflow.xml index be2313a151a..11936db0bed 100644 --- a/addons/purchase/purchase_workflow.xml +++ b/addons/purchase/purchase_workflow.xml @@ -201,29 +201,30 @@ - + - + - buy_subflows + buy subflow action_po_assign() - - - - + + + + + check_buy() and check_supplier_info() - + - - + + subflow.delivery_done - + - + subflow.cancel From 7b126c9ff45825f010e1d0fe605ca3aa912a985b Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 14 Dec 2012 19:44:46 +0100 Subject: [PATCH 08/15] [FIX] procurement: xml tag mismatch fixed bzr revid: qdp-launchpad@openerp.com-20121214184446-lfckoyd9hio2c1vk --- addons/procurement/procurement_workflow.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index 12c20393310..ff17c2e6b73 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -142,7 +142,6 @@ button_cancel - From 82eb22c536a4d543e80c431180a0b070498aecdb Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 14 Dec 2012 20:11:23 +0100 Subject: [PATCH 09/15] [FIX] purchase: fix bzr revid: qdp-launchpad@openerp.com-20121214191123-uj8bvvp18kive0aw --- addons/purchase/purchase.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 47ae0eaa325..ba7ea4ea5e9 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1041,17 +1041,18 @@ class procurement_order(osv.osv): 'purchase_id': fields.many2one('purchase.order', 'Purchase Order'), } - def check_buy(self, cr, uid, ids): + def check_buy(self, cr, uid, ids, context=None): ''' return True if the supply method of the mto product is 'buy' ''' - user = self.pool.get('res.users').browse(cr, uid, uid) + user = self.pool.get('res.users').browse(cr, uid, uid, context=context) partner_obj = self.pool.get('res.partner') - for procurement in self.browse(cr, uid, ids): + for procurement in self.browse(cr, uid, ids, context=context): if procurement.product_id.product_tmpl_id.supply_method <> 'buy': return False return True def check_supplier_info(self, cr, uid, ids, context=None): + user = self.pool.get('res.users').browse(cr, uid, uid, context=context) for procurement in self.browse(cr, uid, ids, context=context): if not procurement.product_id.seller_ids: message = _('No supplier defined for this product !') From d1458e2620639ee4b236779696ae7e9aeee2ae73 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Dec 2012 09:13:51 +0100 Subject: [PATCH 10/15] [FIX] purchase: fixed bad split of methods bzr revid: qdp-launchpad@openerp.com-20121217081351-ye786a737n5a5bys --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index ba7ea4ea5e9..d7c5b4ac5fe 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1045,13 +1045,13 @@ class procurement_order(osv.osv): ''' return True if the supply method of the mto product is 'buy' ''' user = self.pool.get('res.users').browse(cr, uid, uid, context=context) - partner_obj = self.pool.get('res.partner') for procurement in self.browse(cr, uid, ids, context=context): if procurement.product_id.product_tmpl_id.supply_method <> 'buy': return False return True def check_supplier_info(self, cr, uid, ids, context=None): + partner_obj = self.pool.get('res.partner') user = self.pool.get('res.users').browse(cr, uid, uid, context=context) for procurement in self.browse(cr, uid, ids, context=context): if not procurement.product_id.seller_ids: From f97ff9210e7c83c73465e4420cc5aa8a589557ba Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Dec 2012 11:30:26 +0100 Subject: [PATCH 11/15] [FIX] project_mrp: fixed module dependancies bzr revid: qdp-launchpad@openerp.com-20121217103026-wcnd7ol265tcjnkp --- addons/project_mrp/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_mrp/__openerp__.py b/addons/project_mrp/__openerp__.py index 91212b92c1d..4b7b687f638 100644 --- a/addons/project_mrp/__openerp__.py +++ b/addons/project_mrp/__openerp__.py @@ -49,7 +49,7 @@ task is completed. 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', 'images': ['images/product.jpeg', 'images/task_from_SO.jpeg'], - 'depends': ['project', 'procurement', 'sale', 'mrp_jit'], + 'depends': ['project', 'procurement', 'sale', 'mrp', 'mrp_jit'], 'data': ['project_mrp_workflow.xml', 'process/project_mrp_process.xml', 'project_mrp_view.xml'], 'demo': ['project_mrp_demo.xml'], 'test': ['test/project_task_procurement.yml'], From 4dd9751d5eb97a782e87c99873e39437c8f445af Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Dec 2012 11:31:04 +0100 Subject: [PATCH 12/15] [IMP] mrp, procurement: procurement workflow documented bzr revid: qdp-launchpad@openerp.com-20121217103104-vrlm8z02ha6cpa13 --- addons/mrp/procurement.py | 1 + addons/procurement/procurement.py | 11 +++++++---- addons/procurement/procurement_workflow.xml | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index 00d0cc00fd7..7064589b1ee 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -35,6 +35,7 @@ class procurement_order(osv.osv): } def check_produce_product(self, cr, uid, procurement, context=None): + ''' Depict the capacity of the procurement workflow to produce products (not services)''' return True def check_bom_exists(self, cr, uid, ids, context=None): diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 68360152399..29fe7881db2 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -234,12 +234,14 @@ class procurement_order(osv.osv): return False def check_produce_service(self, cr, uid, procurement, context=None): + """ Depicts the capacity of the procurement workflow to deal with production of services. + By default, it's False. Overwritten by project_mrp module. + """ return False def check_produce_product(self, cr, uid, procurement, context=None): - """ Finds BoM of a product if not found writes exception message. - @param procurement: Current procurement. - @return: True or False. + """ Depicts the capacity of the procurement workflow to deal with production of products. + By default, it's False. Overwritten by mrp module. """ return False @@ -274,7 +276,8 @@ class procurement_order(osv.osv): return True def check_buy(self, cr, uid, ids): - """ability of the workflow to manage the supply_method == 'buy'. + """ Depicts the capacity of the procurement workflow to manage the supply_method == 'buy'. + By default, it's False. Overwritten by purchase module. """ return False diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index ff17c2e6b73..d5708e23382 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -159,6 +159,11 @@ + not check_produce() and not check_buy() From 2c77d3178e1eb0198bd35c10803589cc1ec208f6 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Dec 2012 11:46:13 +0100 Subject: [PATCH 13/15] [FIX] procurement, mrp_jit: removed useless workflow activities to manage the 'just in time' bzr revid: qdp-launchpad@openerp.com-20121217104613-x3wpr2e4vg4itczl --- addons/mrp_jit/mrp_jit.xml | 6 ++++-- addons/procurement/procurement_workflow.xml | 14 +------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/addons/mrp_jit/mrp_jit.xml b/addons/mrp_jit/mrp_jit.xml index 32e09175da2..aae3f44ff23 100644 --- a/addons/mrp_jit/mrp_jit.xml +++ b/addons/mrp_jit/mrp_jit.xml @@ -2,9 +2,11 @@ - + + - + not test_cancel() diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index d5708e23382..ba960c55ee7 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -32,13 +32,6 @@ confirm_wait function write({'state':'exception'}) - AND - - - - - confirm_temp - OR @@ -103,15 +96,10 @@ - + button_check not test_cancel() - - - - - From 73a9e83274b822472e7cb07971ee1783c003d454 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Dec 2012 14:43:26 +0100 Subject: [PATCH 14/15] [IMP] mrp, project_mrp: removed dependancy of mrp in project_mrp bzr revid: qdp-launchpad@openerp.com-20121217134326-akrijtur8tg0frl1 --- addons/mrp/mrp_workflow.xml | 11 +---------- addons/project_mrp/__openerp__.py | 2 +- addons/project_mrp/project_mrp_workflow.xml | 4 ++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml index e590c47380b..fd4327815ac 100644 --- a/addons/mrp/mrp_workflow.xml +++ b/addons/mrp/mrp_workflow.xml @@ -116,10 +116,6 @@ - - - need_production - produce @@ -130,13 +126,8 @@ - - check_produce() - - - - is_product() and check_bom_exists() + check_produce() and is_product() and check_bom_exists() diff --git a/addons/project_mrp/__openerp__.py b/addons/project_mrp/__openerp__.py index 4b7b687f638..91212b92c1d 100644 --- a/addons/project_mrp/__openerp__.py +++ b/addons/project_mrp/__openerp__.py @@ -49,7 +49,7 @@ task is completed. 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', 'images': ['images/product.jpeg', 'images/task_from_SO.jpeg'], - 'depends': ['project', 'procurement', 'sale', 'mrp', 'mrp_jit'], + 'depends': ['project', 'procurement', 'sale', 'mrp_jit'], 'data': ['project_mrp_workflow.xml', 'process/project_mrp_process.xml', 'project_mrp_view.xml'], 'demo': ['project_mrp_demo.xml'], 'test': ['test/project_task_procurement.yml'], diff --git a/addons/project_mrp/project_mrp_workflow.xml b/addons/project_mrp/project_mrp_workflow.xml index 11eac835ba1..f8decb98623 100644 --- a/addons/project_mrp/project_mrp_workflow.xml +++ b/addons/project_mrp/project_mrp_workflow.xml @@ -9,9 +9,9 @@ - + - not is_product() + check_produce() and not is_product() From 6c98483d6fdd809c767b94924d043f83330ef441 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Dec 2012 15:41:36 +0100 Subject: [PATCH 15/15] [FIX] mrp, mrp_jit, procurement: fix of the procurement order workflow bzr revid: qdp-launchpad@openerp.com-20121217144136-hen0i0op21f4z1y1 --- addons/mrp/mrp_workflow.xml | 5 ----- addons/mrp/procurement.py | 7 ++++++- addons/mrp_jit/mrp_jit.xml | 2 +- addons/procurement/procurement.py | 4 ++++ addons/procurement/procurement_workflow.xml | 3 +-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml index fd4327815ac..a0943628fc8 100644 --- a/addons/mrp/mrp_workflow.xml +++ b/addons/mrp/mrp_workflow.xml @@ -136,11 +136,6 @@ subflow.done - - - - not test_cancel() and not get_phantom_bom_id() - diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index 7064589b1ee..b2277374f5a 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -53,7 +53,12 @@ class procurement_order(osv.osv): self.message_post(cr, uid, [procurement.id], body=message, context=context) return False return True - + + def check_conditions_confirm2wait(self, cr, uid, ids): + """ condition on the transition to go from 'confirm' activity to 'confirm_wait' activity """ + res = super(procurement_order, self).check_conditions_confirm2wait(cr, uid, ids) + return res and not self.get_phantom_bom_id(cr, uid, ids) + def get_phantom_bom_id(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): if procurement.move_id and procurement.move_id.product_id.supply_method=='produce' \ diff --git a/addons/mrp_jit/mrp_jit.xml b/addons/mrp_jit/mrp_jit.xml index aae3f44ff23..c00393ac04d 100644 --- a/addons/mrp_jit/mrp_jit.xml +++ b/addons/mrp_jit/mrp_jit.xml @@ -7,7 +7,7 @@ but, this time, without the signal --> - not test_cancel() + check_conditions_confirm2wait() diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 29fe7881db2..e28cb007e65 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -281,6 +281,10 @@ class procurement_order(osv.osv): """ 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) + def test_cancel(self, cr, uid, ids): """ Tests whether state of move is cancelled or not. @return: True or False diff --git a/addons/procurement/procurement_workflow.xml b/addons/procurement/procurement_workflow.xml index ba960c55ee7..76b54370ef2 100644 --- a/addons/procurement/procurement_workflow.xml +++ b/addons/procurement/procurement_workflow.xml @@ -25,7 +25,6 @@ confirm function action_confirm() - OR @@ -98,7 +97,7 @@ button_check - not test_cancel() + check_conditions_confirm2wait()