--- /dev/null
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import wizard
+import purchase_double_validation
+
+
--- /dev/null
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+ "name" : "purchase_double_validation",
+ "version" : "1.1",
+ "category": "Generic Modules/ Purchases Double Validation ",
+ "depends" : ["base","purchase"],
+ "author" : "Tiny",
+ "description": """
+ Subject,Date,Status
+ """,
+ 'author': 'Tiny',
+ 'website': 'http://www.openerp.com',
+
+ 'init_xml': [],
+ 'update_xml': [
+ 'purchase_double_validation_view.xml',
+ 'purchase_double_validation_workflow.xml',
+ 'wizard/purchase_double_validation_wizard_view.xml', ],
+ 'demo_xml': [],
+ 'installable': True,
+ 'active': False,
+
+}
--- /dev/null
+#!/usr/bin/python
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import time
+from osv import fields, osv
+
+
+class purchase_double_validation(osv.osv):
+ _name = "purchase.double.validation"
+ _description = "purchase double validation"
+
+ _columns = {
+ 'state': fields.selection([
+ ('draft', 'Request for Quotation'),
+ ('wait', 'Waiting'),
+ ('confirmed', 'Waiting Supplier Ack'),
+ ('approved', 'Approved'),
+ ('validate', 'Validate'),
+ ('except_picking', 'Shipping Exception'),
+ ('except_invoice', 'Invoice Exception'),
+ ('done', 'Done'),
+ ('cancel', 'Cancelled')
+ ], 'State', readonly=True, select=True),
+
+ }
+
+ _defaults = {
+ 'state': lambda *args: 'draft',
+ }
+
+ def action_validate(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state': 'validate'})
+ return True
+
+ def action_limit(self, cr, uid, ids, context=None):
+ amount_obj = self.pool.get('purchase.order').browse(cr, uid, uid, context)
+ amount = amount_obj.amount_total
+
+purchase_double_validation()
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="view_purchase_form_inherit" model="ir.ui.view">
+ <field name="name">purchase.order.form.inherit</field>
+ <field name="model">purchase.order</field>
+ <field name="inherit_id" ref="purchase.purchase_order_form"/>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <xpath expr="//button[@string='Convert to Purchase Order']" position="replace">
+
+ <button name="draft_router1" states="draft" string="To Validate" icon="gtk-go-forward"/>
+ </xpath>
+
+ <xpath expr="//button[@string='Approve Purchase']" position="after">
+
+ <button name="validate_confirmed" states="validate" string="Convert to Purchase Order" icon="gtk-go-forward"/>
+ </xpath>
+
+
+
+ </field>
+ </record>
+
+
+ </data>
+</openerp>
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="act_validate" model="workflow.activity">
+ <field name="wkf_id" ref="purchase.purchase_order"/>
+ <field name="name">Validate</field>
+ <field name="kind">function</field>
+ <field name="action">write({'state':'validate'})</field>
+ </record>
+
+ <record id="act_router1" model="workflow.activity">
+ <field name="wkf_id" ref="purchase.purchase_order"/>
+ <field name="name">router1</field>
+ <field name="split_mode">OR</field>
+ <field name="kind">dummy</field>
+ </record>
+
+
+
+
+
+ <record id="trans_draft_router1" model="workflow.transition">
+ <field name="act_from" ref="purchase.act_draft"/>
+ <field name="act_to" ref="act_router1"/>
+ <field name="condition">True</field>
+ <field name="signal">draft_router1</field>
+ </record>
+
+ <record id="trans_router1_validate" model="workflow.transition">
+ <field name="act_from" ref="act_router1"/>
+ <field name="act_to" ref="act_validate"/>
+ <field name="condition">True</field>
+ <field name="signal">router1_validate</field>
+ </record>
+
+ <record id="purchase.trans_draft_confirmed" model="workflow.transition">
+ <field name="act_from" ref="act_router1"/>
+ <field name="act_to" ref="purchase.act_confirmed"/>
+ <field name="condition">True</field>
+ <field name="signal">router1_confirmed</field>
+ </record>
+
+ <record id="trans_validate_confirmed" model="workflow.transition">
+ <field name="act_from" ref="act_validate"/>
+ <field name="act_to" ref="purchase.act_confirmed"/>
+ <field name="condition">True</field>
+ <field name="signal">validate_confirmed</field>
+ </record>
+
+ </data>
+</openerp>
--- /dev/null
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import purchase_double_validation_wizard
+
--- /dev/null
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+from tools import config
+import time
+from tools.translate import _
+import netsvc
+
+
+
+
+class purchase_double_validation_wizard(osv.osv_memory):
+ _name = 'purchase.double.validation.wizard'
+
+
+ _columns = {
+ 'limit_amount': fields.float('Limit Amount', required=True),
+
+ }
+ _defaults = {
+ 'limit_amount': 100,
+
+ }
+
+
+ def set_limit(self, cr, uid, ids, context=None):
+ pur_id = self.pool.get(purchase.order).search(cr, uid, [])
+ amount_obj = self.pool.get('purchase.order').browse(cr, uid, pur_id, context)
+ amount = amount_obj.amount_total
+ return {}
+# limit = limit_obj.limit_amount
+#
+# return {
+# 'view_type': 'form',
+# "view_mode": 'form',
+# 'res_model': 'ir.actions.configuration.wizard',
+# 'type': 'ir.actions.act_window',
+# 'target': 'new',
+# }
+
+ def action_cancel(self,cr,uid,ids,conect=None):
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.actions.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
+
+purchase_double_validation_wizard()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="view_purchase_double_validation_wizard" model="ir.ui.view">
+ <field name="name">Configure Limit Amount</field>
+ <field name="model">purchase.double.validation.wizard</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Limint Amount Configuration">
+ <field name="limit_amount"/>
+ <newline/>
+ <group col="4" colspan="4">
+ <button icon="gtk-cancel" name="action_cancel" type="object" special="cancel" string="Cancel"/>
+ <button icon="gtk-ok" name="set_limit" string="Set Limit Amount" type="object"/>
+ </group>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_purchase_double_validation_wizard" model="ir.actions.act_window">
+ <field name="name">Configure Limit Amount</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">purchase.double.validation.wizard</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+
+ <record id="config_purchase_double_validation_wizard" model="ir.actions.todo">
+ <field name="name">Configure Limit Amount</field>
+ <field name="note">This Configuration step use to setLimit Amount</field>
+ <field name="action_id" ref="action_purchase_double_validation_wizard"/>
+ </record>
+
+
+ </data>
+</openerp>
\ No newline at end of file