[ADD] mrp: Added an osv_memory wizard 'Product Cost Structure' for opening reports.

bzr revid: uco@tinyerp.co.in-20100318130834-cwqtjfk8rlu834mk
This commit is contained in:
uco (OpenERP) 2010-03-18 18:38:34 +05:30
parent 671324860c
commit f9dd534a59
5 changed files with 72 additions and 32 deletions

View File

@ -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',

View File

@ -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>

View File

@ -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

View File

@ -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:

View File

@ -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>