[ADD] mrp: Added an osv_memory wizard 'Work Center Load' for opening reports.

bzr revid: uco@tinyerp.co.in-20100318132519-dzzzb9943gujjmdj
This commit is contained in:
uco (OpenERP) 2010-03-18 18:55:19 +05:30
parent f9dd534a59
commit 38c671e458
6 changed files with 94 additions and 63 deletions

View File

@ -65,6 +65,7 @@
'wizard/change_production_qty_view.xml',
'wizard/orderpoint_procurement_view.xml',
'wizard/mrp_price_view.xml',
'wizard/mrp_workcenter_load_view.xml',
'mrp_view.xml',
'wizard/schedulers_all_view.xml',
'mrp_wizard.xml',

View File

@ -2,16 +2,6 @@
<openerp>
<data>
<wizard id="wizard_workcenter_load" model="mrp.workcenter" name="mrp.workcenter.load" string="Work Center load"/>
<!-- <wizard id="wizard_price" menu="False" model="product.product" name="product_price" string="Product Cost Structure"/>-->
<!-- <record id="ir_project_cost_structure" model="ir.values">-->
<!-- <field eval="'client_print_multi'" name="key2"/>-->
<!-- <field eval="'product.product'" name="model"/>-->
<!-- <field name="name">Product Cost Structure</field>-->
<!-- <field eval="'ir.actions.wizard,%d'%wizard_price" name="value"/>-->
<!-- <field eval="True" name="object"/>-->
<!-- </record>-->
</data>
</openerp>

View File

@ -24,7 +24,7 @@ import orderpoint_procurement
import wizard_procurement
import schedulers_all
import mrp_price
import wizard_workcenter_load
import mrp_workcenter_load
import wizard_track_prod
import change_production_qty
import make_procurement_product

View File

@ -0,0 +1,57 @@
# -*- 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/>.
#
##############################################################################
from osv import fields, osv
class mrp_workcenter_load(osv.osv_memory):
_name = 'mrp.workcenter.load'
_description = 'Workcenter Load'
_columns = {
'time_unit': fields.selection([('day', 'Day by day'),('week', 'Per week'),('month', 'Per month')],'Type of period', required=True),
'measure_unit': fields.selection([('hours', 'Amount in hours'),('cycles', 'Amount in cycles')],'Amount measuring unit', required=True),
}
def print_report(self, cr, uid, ids, context=None):
"""
To print the report of Work Center Load
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : Report
"""
datas = {'ids' : context.get('active_ids',[])}
res = self.read(cr, uid, ids, ['time_unit','measure_unit'])
res = res and res[0] or {}
datas['form'] = res
return {
'type' : 'ir.actions.report.xml',
'report_name':'mrp.workcenter.load',
'datas' : datas,
}
mrp_workcenter_load()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Work Center Load Report -->
<record id="view_mrp_workcenter_load_wizard" model="ir.ui.view">
<field name="name">Work Center Load</field>
<field name="model">mrp.workcenter.load</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select time unit">
<field name="time_unit"/>
<newline/>
<field name="measure_unit"/>
<newline/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="print_report" string="Print"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<act_window name="Work Center Load"
res_model="mrp.workcenter.load"
src_model="mrp.workcenter"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_mrp_workcenter_load_wizard"/>
</data>
</openerp>

View File

@ -1,52 +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
_time_unit_form = '''<?xml version="1.0"?>
<form string="Select time unit">
<field name="time_unit"/>
<newline/>
<field name="measure_unit"/>
</form>'''
_time_unit_fields = {
'time_unit': {'string':'Type of period', 'type':'selection', 'selection':[('day', 'Day by day'),('week', 'Per week'),('month', 'Per month')], 'required':True},
'measure_unit': {'string':'Amount measuring unit', 'type':'selection', 'selection':[('hours', 'Amount in hours'),('cycles', 'Amount in cycles')], 'required':True},
}
class wizard_mrp_workcenter(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':_time_unit_form, 'fields':_time_unit_fields, 'state':[('end','Cancel'),('report','Print') ]},
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'mrp.workcenter.load', 'state':'end'},
},
}
wizard_mrp_workcenter('mrp.workcenter.load')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: