diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index b0463957e9a..2cfa8a01726 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -155,7 +155,7 @@
-
+
diff --git a/addons/purchase_double_validation/__init__.py b/addons/purchase_double_validation/__init__.py
new file mode 100644
index 00000000000..f3c3af5ba22
--- /dev/null
+++ b/addons/purchase_double_validation/__init__.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import purchase_double_validation_installer
+
+
diff --git a/addons/purchase_double_validation/__openerp__.py b/addons/purchase_double_validation/__openerp__.py
new file mode 100644
index 00000000000..6a02ad2f9b5
--- /dev/null
+++ b/addons/purchase_double_validation/__openerp__.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+{
+ "name" : "purchase_double_validation",
+ "version" : "1.1",
+ "category": 'Generic Modules/Sales & Purchases',
+ "depends" : ["base","purchase"],
+ "author" : "Tiny",
+ "description": """
+ This module modifies purchase workflow in order to validate purchases that exceeds minimum amount set by wizard
+ """,
+ 'author': 'OpenERP SA',
+ 'website': 'http://www.openerp.com',
+
+ 'init_xml': [],
+ 'update_xml': [
+ 'purchase_double_validation_view.xml',
+ 'purchase_double_validation_workflow.xml',
+ 'purchase_double_validation_installer.xml', ],
+ 'demo_xml': [],
+ 'installable': True,
+ 'active': False,
+
+}
diff --git a/addons/purchase_double_validation/purchase_double_validation_installer.py b/addons/purchase_double_validation/purchase_double_validation_installer.py
new file mode 100644
index 00000000000..7ec602b10a2
--- /dev/null
+++ b/addons/purchase_double_validation/purchase_double_validation_installer.py
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import time
+from osv import fields, osv
+
+class purchase_double_validation_installer(osv.osv_memory):
+ _name = 'purchase.double.validation.installer'
+ _inherit = 'res.config'
+
+ _columns = {
+ 'limit_amount': fields.integer('Limit Amount', required=True, help="Minimum amount after which validation of purchase is required"),
+ }
+
+ _defaults = {
+ 'limit_amount': 1000,
+ }
+
+ def execute(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids, context=context)
+ amt = data[0]['limit_amount']
+ data_pool = self.pool.get('ir.model.data')
+ transition_obj = self.pool.get('workflow.transition')
+ waiting = data_pool._get_id(cr, uid, 'purchase_double_validation', 'trans_router1_waiting')
+ waiting_id = data_pool.browse(cr, uid, waiting, context=context).res_id
+ confirm = data_pool._get_id(cr, uid, 'purchase', 'trans_draft_confirmed')
+ confirm_id = data_pool.browse(cr, uid, confirm, context=context).res_id
+ transition_obj.write(cr, uid, waiting_id, {'condition': 'amount_total>%s' % (amt), 'signal': False})
+ transition_obj.write(cr, uid, confirm_id, {'condition': 'amount_total<=%s' % (amt), 'signal': False})
+ return {}
+
+purchase_double_validation_installer()
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/purchase_double_validation/purchase_double_validation_installer.xml b/addons/purchase_double_validation/purchase_double_validation_installer.xml
new file mode 100644
index 00000000000..1ee4420bc13
--- /dev/null
+++ b/addons/purchase_double_validation/purchase_double_validation_installer.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+ Configure Limit Amount for Purchase
+ purchase.double.validation.installer
+ form
+
+
+
+
+
+ Configure Limit Amount for Purchase
+
+
+ Define minimum amount after which puchase is needed to be validated.
+
+
+ 15
+
+
+
+
+
+
+
+
+
+
+
+ Configure Limit Amount for Purchase
+ ir.actions.act_window
+ purchase.double.validation.installer
+
+ form
+ form
+ new
+
+
+
+
+
+ onskip
+
+
+
+
+
diff --git a/addons/purchase_double_validation/purchase_double_validation_view.xml b/addons/purchase_double_validation/purchase_double_validation_view.xml
new file mode 100644
index 00000000000..5136ffef0e3
--- /dev/null
+++ b/addons/purchase_double_validation/purchase_double_validation_view.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ purchase.order.form.inherit
+ purchase.order
+
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/purchase_double_validation/purchase_double_validation_workflow.xml b/addons/purchase_double_validation/purchase_double_validation_workflow.xml
new file mode 100644
index 00000000000..8e23f252a87
--- /dev/null
+++ b/addons/purchase_double_validation/purchase_double_validation_workflow.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+ waiting
+ function
+ write({'state':'wait'})
+
+
+
+
+ router1
+ OR
+ dummy
+
+
+
+
+
+ True
+ draft_router1
+
+
+
+
+
+ True
+
+
+
+
+
+
+ True
+
+
+
+
+
+ True
+ waiting_confirmed
+
+
+
+
\ No newline at end of file