summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruco (OpenERP) <uco@tinyerp.co.in>2010-03-29 11:14:25 +0530
committeruco (OpenERP) <uco@tinyerp.co.in>2010-03-29 11:14:25 +0530
commitccfb3bd4d178b56ea65b59a42d7e47b910b072a9 (patch)
tree718653eaf2ba36dcd520fef5aeda99b8500d30ed
parentb5c601d2db69c843c2a65903aa0f139595e01ed8 (diff)
[ADD] mrp: Added remaining wizard after converting to osv_memory wizard (Compute Procurement).
bzr revid: uco@tinyerp.co.in-20100329054425-lzfhfk05cvq4y6oq
-rw-r--r--addons/mrp/__terp__.py1
-rw-r--r--addons/mrp/wizard/__init__.py2
-rw-r--r--addons/mrp/wizard/mrp_procurement.py45
-rw-r--r--addons/mrp/wizard/mrp_procurement_view.xml34
-rw-r--r--addons/mrp/wizard/wizard_procurement.py64
5 files changed, 81 insertions, 65 deletions
diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py
index acf25b160e0..10fadb00bc6 100644
--- a/addons/mrp/__terp__.py
+++ b/addons/mrp/__terp__.py
@@ -62,6 +62,7 @@
'mrp_data.xml',
'wizard/mrp_product_produce_view.xml',
'wizard/make_procurement_view.xml',
+ 'wizard/mrp_procurement_view.xml',
'wizard/change_production_qty_view.xml',
'wizard/orderpoint_procurement_view.xml',
'wizard/mrp_price_view.xml',
diff --git a/addons/mrp/wizard/__init__.py b/addons/mrp/wizard/__init__.py
index 043cdc94465..012677a9ca0 100644
--- a/addons/mrp/wizard/__init__.py
+++ b/addons/mrp/wizard/__init__.py
@@ -21,7 +21,7 @@
import mrp_product_produce
import orderpoint_procurement
-import wizard_procurement
+import mrp_procurement
import schedulers_all
import mrp_price
import mrp_workcenter_load
diff --git a/addons/mrp/wizard/mrp_procurement.py b/addons/mrp/wizard/mrp_procurement.py
new file mode 100644
index 00000000000..77728c05517
--- /dev/null
+++ b/addons/mrp/wizard/mrp_procurement.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import threading
+from osv import osv, fields
+
+class procurement_compute(osv.osv_memory):
+ _name = 'mrp.procurement.compute'
+ _description = 'Compute Procurement'
+
+ def _procure_calculation_procure(self, cr, uid, ids, context):
+ try:
+ proc_obj = self.pool.get('mrp.procurement')
+ proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context)
+ finally:
+ cr.close()
+ return {}
+
+ def procure_calculation(self, cr, uid, ids, context):
+ threaded_calculation = threading.Thread(target=self._procure_calculation_procure, args=(cr, uid, ids, context))
+ threaded_calculation.start()
+ return {}
+
+procurement_compute()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/mrp/wizard/mrp_procurement_view.xml b/addons/mrp/wizard/mrp_procurement_view.xml
new file mode 100644
index 00000000000..6d78f89793d
--- /dev/null
+++ b/addons/mrp/wizard/mrp_procurement_view.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <!-- Compute Procurement -->
+
+ <record id="view_compute_procurment_wizard" model="ir.ui.view">
+ <field name="name">Compute Procurements</field>
+ <field name="model">mrp.procurement.compute</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Parameters">
+ <label string="This wizard will schedule procurements." colspan="4" align="0.0"/>
+ <newline/>
+ <group col="2" colspan="4">
+ <button icon='gtk-cancel' special="cancel"
+ string="Cancel" />
+ <button name="procure_calculation" string="Compute Requisitions"
+ colspan="1" type="object" icon="gtk-ok" />
+ </group>
+ </form>
+ </field>
+ </record>
+
+<!-- <act_window name="Compute Procurements" -->
+<!-- res_model="mrp.procurement.compute"-->
+<!-- src_model="mrp.procurement"-->
+<!-- view_mode="form"-->
+<!-- target="new" -->
+<!-- key2="client_action_multi" -->
+<!-- id="act_compute_procurement"/> -->
+
+ </data>
+</openerp>
diff --git a/addons/mrp/wizard/wizard_procurement.py b/addons/mrp/wizard/wizard_procurement.py
deleted file mode 100644
index af43437cc52..00000000000
--- a/addons/mrp/wizard/wizard_procurement.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# 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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import wizard
-import threading
-import pooler
-
-parameter_form = '''<?xml version="1.0"?>
-<form string="Parameters" colspan="4">
- <label string="This wizard will schedule procurements." colspan="4" align="0.0"/>
-</form>'''
-
-parameter_fields = {
-}
-
-def _procure_calculation_procure(self, db_name, uid, data, context):
- db, pool = pooler.get_db_and_pool(db_name)
- cr = db.cursor()
- try:
- proc_obj = pool.get('mrp.procurement')
- proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context)
- finally:
- cr.close()
- return {}
-
-def _procure_calculation(self, cr, uid, data, context):
- threaded_calculation = threading.Thread(target=_procure_calculation_procure, args=(self, cr.dbname, uid, data, context))
- threaded_calculation.start()
- return {}
-
-class procurement_compute(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':parameter_form, 'fields': parameter_fields, 'state':[('end','Cancel'),('compute','Compute Requisitions') ]}
- },
- 'compute': {
- 'actions': [_procure_calculation],
- 'result': {'type': 'state', 'state':'end'}
- },
- }
-procurement_compute('mrp.procurement.compute')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-