From 2c959b6e81ba4fb0cab45d2ab839b43ccdf74dd4 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 10 Jul 2013 17:38:55 +0200 Subject: [PATCH] [WIP] mrp_jit bzr revid: qdp-launchpad@openerp.com-20130710153855-jceozpqwf4m89btq --- addons/mrp_jit/__init__.py | 3 ++- addons/mrp_jit/__openerp__.py | 4 ++-- addons/mrp_jit/mrp_jit.py | 34 +++++++++++++++++++++++++++++++ addons/mrp_jit/mrp_jit.xml | 14 ------------- addons/mrp_jit/test/mrp_jit.yml | 11 ++-------- addons/procurement/procurement.py | 2 +- 6 files changed, 41 insertions(+), 27 deletions(-) create mode 100644 addons/mrp_jit/mrp_jit.py delete mode 100644 addons/mrp_jit/mrp_jit.xml diff --git a/addons/mrp_jit/__init__.py b/addons/mrp_jit/__init__.py index 2aefd8b3c11..f20e93e1624 100644 --- a/addons/mrp_jit/__init__.py +++ b/addons/mrp_jit/__init__.py @@ -19,5 +19,6 @@ # ############################################################################## -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +import mrp_jit +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp_jit/__openerp__.py b/addons/mrp_jit/__openerp__.py index 9af20c7d4a7..945ad269db9 100644 --- a/addons/mrp_jit/__openerp__.py +++ b/addons/mrp_jit/__openerp__.py @@ -40,9 +40,9 @@ In that case, you can not use priorities any more on the different picking. """, 'author': 'OpenERP SA', 'depends': ['procurement'], - 'data': [], #'mrp_jit.xml' + 'data': [], 'demo': [], - 'test': [], #'test/mrp_jit.yml' + 'test': ['test/mrp_jit.yml'], 'installable': True, 'auto_install': False, } diff --git a/addons/mrp_jit/mrp_jit.py b/addons/mrp_jit/mrp_jit.py new file mode 100644 index 00000000000..4ad5cca5f20 --- /dev/null +++ b/addons/mrp_jit/mrp_jit.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2013 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +from openerp.osv import osv + +class procurement_order(osv.osv): + _inherit = "procurement.order" + + def create(self, cr, uid, vals, context=None): + procurement_id = super(procurement_order, self).create(cr, uid, vals, context=context) + self.run(cr, uid, [procurement_id], context=context) + self.check(cr, uid, [procurement_id], context=context) + return procurement_id + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp_jit/mrp_jit.xml b/addons/mrp_jit/mrp_jit.xml deleted file mode 100644 index c00393ac04d..00000000000 --- a/addons/mrp_jit/mrp_jit.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - check_conditions_confirm2wait() - - - - diff --git a/addons/mrp_jit/test/mrp_jit.yml b/addons/mrp_jit/test/mrp_jit.yml index 4b847c4608d..1a50fcbe0c2 100644 --- a/addons/mrp_jit/test/mrp_jit.yml +++ b/addons/mrp_jit/test/mrp_jit.yml @@ -5,20 +5,13 @@ !record {model: procurement.order, id: procurement_order_test1}: company_id: base.main_company date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_id: stock.stock_location_stock name: PROC/TEST/0001 product_id: product.product_product_16 product_qty: 10.0 product_uom: product.product_uom_unit product_uos_qty: 0.0 - - | - I confirm the procurement order PROC/TEST/0001. -- - !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test1} -- - | - I check that the procurement is scheduled automatically. + I check that the procurement is automatically in exception because nothing is configured to handle this procurement. - !assert {model: procurement.order, id: procurement_order_test1, string: procstate}: - - state<>'confirmed' + - state == 'exception' diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 1cf884dc78e..dbbd2f482d3 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -196,7 +196,7 @@ class procurement_order(osv.osv): :param procurement: browse record :rtype: boolean ''' - return True + return False # # Scheduler