diff options
| author | uco (OpenERP) <uco@tinyerp.co.in> | 2010-03-18 18:55:19 +0530 |
|---|---|---|
| committer | uco (OpenERP) <uco@tinyerp.co.in> | 2010-03-18 18:55:19 +0530 |
| commit | 38c671e45816da3d9960d751caf2e644b3d384b7 (patch) | |
| tree | a1ee615d24081911ce85b7b01a5a1e63011111e1 /addons/mrp | |
| parent | f9dd534a595e097e46b9160e56b90a364def05e7 (diff) | |
[ADD] mrp: Added an osv_memory wizard 'Work Center Load' for opening reports.
bzr revid: uco@tinyerp.co.in-20100318132519-dzzzb9943gujjmdj
Diffstat (limited to 'addons/mrp')
| -rw-r--r-- | addons/mrp/__terp__.py | 1 | ||||
| -rw-r--r-- | addons/mrp/mrp_wizard.xml | 10 | ||||
| -rw-r--r-- | addons/mrp/wizard/__init__.py | 2 | ||||
| -rw-r--r-- | addons/mrp/wizard/mrp_workcenter_load.py | 57 | ||||
| -rw-r--r-- | addons/mrp/wizard/mrp_workcenter_load_view.xml | 35 | ||||
| -rw-r--r-- | addons/mrp/wizard/wizard_workcenter_load.py | 52 |
6 files changed, 94 insertions, 63 deletions
diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py index 762e89c4614..acf25b160e0 100644 --- a/addons/mrp/__terp__.py +++ b/addons/mrp/__terp__.py @@ -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', diff --git a/addons/mrp/mrp_wizard.xml b/addons/mrp/mrp_wizard.xml index 88e4e047e50..f7bfdcd7395 100644 --- a/addons/mrp/mrp_wizard.xml +++ b/addons/mrp/mrp_wizard.xml @@ -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> diff --git a/addons/mrp/wizard/__init__.py b/addons/mrp/wizard/__init__.py index 5cf8a7187eb..043cdc94465 100644 --- a/addons/mrp/wizard/__init__.py +++ b/addons/mrp/wizard/__init__.py @@ -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 diff --git a/addons/mrp/wizard/mrp_workcenter_load.py b/addons/mrp/wizard/mrp_workcenter_load.py new file mode 100644 index 00000000000..1b5478dcbeb --- /dev/null +++ b/addons/mrp/wizard/mrp_workcenter_load.py @@ -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: diff --git a/addons/mrp/wizard/mrp_workcenter_load_view.xml b/addons/mrp/wizard/mrp_workcenter_load_view.xml new file mode 100644 index 00000000000..a6b7a4f987d --- /dev/null +++ b/addons/mrp/wizard/mrp_workcenter_load_view.xml @@ -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> diff --git a/addons/mrp/wizard/wizard_workcenter_load.py b/addons/mrp/wizard/wizard_workcenter_load.py deleted file mode 100644 index 6465622c421..00000000000 --- a/addons/mrp/wizard/wizard_workcenter_load.py +++ /dev/null @@ -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: - |
