[ADD] mrp: Added remaining wizard after converting to osv_memory wizard (Compute Procurement).
bzr revid: uco@tinyerp.co.in-20100329054425-lzfhfk05cvq4y6oq
This commit is contained in:
parent
b5c601d2db
commit
ccfb3bd4d1
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
@ -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>
|
|
@ -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:
|
||||
|
Loading…
Reference in New Issue