diff options
| author | uco (OpenERP) <uco@tinyerp.co.in> | 2010-03-18 18:38:34 +0530 |
|---|---|---|
| committer | uco (OpenERP) <uco@tinyerp.co.in> | 2010-03-18 18:38:34 +0530 |
| commit | f9dd534a595e097e46b9160e56b90a364def05e7 (patch) | |
| tree | 29678e9ea523b62239c7e7e776391fd08394a442 | |
| parent | 671324860c3a8ad1d4dcec4770007d0b39ea6640 (diff) | |
[ADD] mrp: Added an osv_memory wizard 'Product Cost Structure' for opening reports.
bzr revid: uco@tinyerp.co.in-20100318130834-cwqtjfk8rlu834mk
| -rw-r--r-- | addons/mrp/__terp__.py | 1 | ||||
| -rw-r--r-- | addons/mrp/mrp_wizard.xml | 16 | ||||
| -rw-r--r-- | addons/mrp/wizard/__init__.py | 2 | ||||
| -rw-r--r-- | addons/mrp/wizard/mrp_price.py (renamed from addons/mrp/wizard/wizard_price.py) | 54 | ||||
| -rw-r--r-- | addons/mrp/wizard/mrp_price_view.xml | 33 |
5 files changed, 73 insertions, 33 deletions
diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py index 9e0a65718fa..762e89c4614 100644 --- a/addons/mrp/__terp__.py +++ b/addons/mrp/__terp__.py @@ -64,6 +64,7 @@ 'wizard/make_procurement_view.xml', 'wizard/change_production_qty_view.xml', 'wizard/orderpoint_procurement_view.xml', + 'wizard/mrp_price_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 f42409559ba..88e4e047e50 100644 --- a/addons/mrp/mrp_wizard.xml +++ b/addons/mrp/mrp_wizard.xml @@ -4,14 +4,14 @@ <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> +<!-- <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 b18384fd0b2..5cf8a7187eb 100644 --- a/addons/mrp/wizard/__init__.py +++ b/addons/mrp/wizard/__init__.py @@ -23,7 +23,7 @@ import mrp_product_produce import orderpoint_procurement import wizard_procurement import schedulers_all -import wizard_price +import mrp_price import wizard_workcenter_load import wizard_track_prod import change_production_qty diff --git a/addons/mrp/wizard/wizard_price.py b/addons/mrp/wizard/mrp_price.py index dd84ad23be2..5d3c16cbaa5 100644 --- a/addons/mrp/wizard/wizard_price.py +++ b/addons/mrp/wizard/mrp_price.py @@ -19,31 +19,37 @@ # ############################################################################## -import wizard +from osv import fields, osv -price_form = '''<?xml version="1.0"?> -<form string="Paid ?"> - <field name="number"/> -</form>''' - -price_fields = { - 'number': {'string':'Number of products to produce', 'type':'integer', 'required':True}, -} - -class wizard_price(wizard.interface): - states = { - 'init': { - 'actions': [], - 'result': {'type':'form', 'arch':price_form, 'fields':price_fields, 'state':[('end','Cancel'),('price','Print product price') ]} - }, - 'price': { - 'actions': [], - 'result': {'type':'print', 'report':'product.price', 'state':'end'} - } +class mrp_price(osv.osv_memory): + _name = 'mrp.product_price' + _description = 'Product Price' + _columns = { + 'number': fields.integer('Number of products to produce', required=True), } -wizard_price('product_price') - - + + def print_report(self, cr, uid, ids, context=None): + """ + To print the report of Product cost structure + + @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, ['number']) + res = res and res[0] or {} + datas['form'] = res + + return { + 'type' : 'ir.actions.report.xml', + 'report_name':'product.price', + 'datas' : datas, + } + +mrp_price() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/mrp/wizard/mrp_price_view.xml b/addons/mrp/wizard/mrp_price_view.xml new file mode 100644 index 00000000000..e2e294c5739 --- /dev/null +++ b/addons/mrp/wizard/mrp_price_view.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <!-- Product Cost Structure Report --> + + <record id="view_mrp_product_price_wizard" model="ir.ui.view"> + <field name="name">Product Cost Structure</field> + <field name="model">mrp.product_price</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Paid ?"> + <field name="number"/> + <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="Product Cost Structure" + res_model="mrp.product_price" + src_model="product.product" + view_mode="form" + target="new" + key2="client_action_multi" + id="action_view_mrp_product_price_wizard"/> + </data> +</openerp> |
