I have my own custom module, named master.py
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp import tools
import datetime
import itertools
class mmr_brand(osv.osv):
_name = "mmr.brand"
_description = "Brand Module for PT.MMR, for easier input and prevent duplication."
_columns = {
'name': fields.char("Brand", required=True),
'notes' : fields.char("Notes"),
}
mmr_brand()
class mmr_unit(osv.osv):
_name = "mmr.unit"
_description = "Unit Module for PT.MMR, for easier input and prevent duplication."
_columns = {
'name': fields.char("Unit", required=True),
'notes' : fields.char("Notes"),
}
mmr_unit()
class mmr_product(osv.osv):
_name = "mmr.product"
_description = "Product Module for PT.MMR, refer to Product doc."
_columns = {
'brand': fields.many2one("mmr.brand", "Brand", required=True),
'name': fields.char("Name", required=True),
'unit': fields.many2one("mmr.unit", "Unit", required=True),
'minimumSellPrice': fields.float("Minimum sell price"),
}
mmr_product()
With view named master,
<openerp>
<data>
<record id="mmr_product_list" model="ir.ui.view">
<field name="name">mmr.product.list</field>
<field name="model">mmr.product</field>
<field name="arch" type="xml">
<tree string="Product" version="7.0">
<field name="brand" />
<field name="name" />
<field name="unit" />
<field name="minimumSellPrice" />
</tree>
</field>
</record>
<record id="mmr_product_form" model="ir.ui.view">
<field name="name">mmr.product.form</field>
<field name="model">mmr.product</field>
<field name="arch" type="xml">
<form string="Product" version="7.0" >
<header>
<button name="%(report_example)d" string="Print" type="action"/>
</header>
<group>
<field name="brand" />
<field name="name" />
<field name="unit" />
<field name="minimumSellPrice" />
</group>
</form>
</field>
</record>
<record id="mmr_brand_list" model="ir.ui.view">
<field name="name">mmr.brand.list</field>
<field name="model">mmr.brand</field>
<field name="arch" type="xml">
<tree string="Brand" version="7.0">
<field name="name" />
<field name="notes" />
</tree>
</field>
</record>
<record id="mmr_brand_form" model="ir.ui.view">
<field name="name">mmr.brand.form</field>
<field name="model">mmr.brand</field>
<field name="arch" type="xml">
<form string="Brand" version="7.0" >
<group>
<field name="name" />
<field name="notes" />
</group>
</form>
</field>
</record>
</data>
</openerp>
And Menu named menu_master,
<openerp>
<data>
<record id="multi_action_master_mmr_product" model="ir.actions.act_window">
<field name="name">Product</field>
<field name="res_model">mmr.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="mmr_menu" name="MMR" sequence="111" groups="base.group_user"/>
<menuitem id="mmr_menu_product" name="Product" parent="mmr_menu" sequence="1" />
<menuitem id="multi_menu_master_product" action="multi_action_master_mmr_product" name="Product" parent="mmr_menu_product" sequence="1" />
</data>
</openerp>
I also have created xml containing report template, i named the file reportExample.xml and placed it in view folder
<?xml version="1.0" encoding="utf-8"?>
<!--Custom report.-->
<openerp>
<data>
<template id="report_example">
<t t-call="report.external_layout">
<div class="page">
<div class="row">
<h3>Title</h3>
</div>
</div>
</t>
</template>
</data>
</openerp>
Then I also create xml named MMR_report.xml, containing
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
id="custom_report_example"
model="mmr.product"
string="Example"
report_type="qweb-pdf"
name="mmr.report_example"
attachment_use="False"
file="mmr.report_example"
/>
</data>
</openerp>
Also, I already noticed __openerp__ file about my new report
'update_xml': [
'view/reportExample.xml',
'view/master.xml',
'menu/menu_master.xml',
],
As you can see, I already insert button which I expect to show my custom report page when i pressed it. Unfortunately it doesn't work. Can someone explain what wrong with it?