Open Wizard On Click Menu
<report
id="abc_abc_report"
string="ABC"
model="abc.abc"
report_type="qweb-pdf"
file="modulename.report_id"
name="modulename.report_id"
menu='False'
/>
Add one py file for add field in wizard object.
like below code.
from openerp import models, fields, api, _
from openerp.exceptions import Warning
import datetime
class abc_abc_wizard(models.TransientModel):
_name = "abc.abc"
start_date = fields.Date('Start Date')
end_date = fields.Date('End Date')
@api.multi
def get_abc_abc(self):
return self.env['report'].get_action(self, 'module_name.abc_abc_report_template')
Add wizard view and menu.
<?xml version="1.0"?>
<openerp>
<data>
<record id="abc_abc_form_view" model="ir.ui.view">
<field name="name">abc_abc</field>
<field name="model">abc.abc</field>
<field name="arch" type="xml">
<form string="ABC">
<group>
<field name="start_date"/>
<field name="end_date"/>
</group>
<footer>
<button name="get_abc_abc" string="ABC" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_highlight" special="cancel" />
</footer>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="abc_abc_action">
<field name="name">ABC</field>
<field name="res_model">abc.abc</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="abc_abc_form_view"/>
<field name="target">new</field>
</record>
<menuitem name="Report" id="report_reporting" parent="base.menu_reporting" sequence="500"/>
<menuitem name="ABC" id="abc_abc_reporting" parent="report_reporting" action="abc_abc_action" sequence="510"/>
</data>
</openerp>
Create Template for report.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_id">
<t t-foreach="docs" t-as="o">
<t t-call="report.external_layout">
<div class="page">
<br /><br /><br />
<div class="row">
<strong style="text-align:center;display:block;">ABC</strong>
<br/>
<table border="1" class="table table-condensed">
</table>
</div>
</div>
</t>
</t>
</template>
</data>
<report
id="abc_abc_report"
string="ABC"
model="abc.abc"
report_type="qweb-pdf"
file="modulename.report_id"
name="modulename.report_id"
menu='False'
/>
Add one py file for add field in wizard object.
like below code.
from openerp import models, fields, api, _
from openerp.exceptions import Warning
import datetime
class abc_abc_wizard(models.TransientModel):
_name = "abc.abc"
start_date = fields.Date('Start Date')
end_date = fields.Date('End Date')
@api.multi
def get_abc_abc(self):
return self.env['report'].get_action(self, 'module_name.abc_abc_report_template')
Add wizard view and menu.
<?xml version="1.0"?>
<openerp>
<data>
<record id="abc_abc_form_view" model="ir.ui.view">
<field name="name">abc_abc</field>
<field name="model">abc.abc</field>
<field name="arch" type="xml">
<form string="ABC">
<group>
<field name="start_date"/>
<field name="end_date"/>
</group>
<footer>
<button name="get_abc_abc" string="ABC" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_highlight" special="cancel" />
</footer>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="abc_abc_action">
<field name="name">ABC</field>
<field name="res_model">abc.abc</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="abc_abc_form_view"/>
<field name="target">new</field>
</record>
<menuitem name="Report" id="report_reporting" parent="base.menu_reporting" sequence="500"/>
<menuitem name="ABC" id="abc_abc_reporting" parent="report_reporting" action="abc_abc_action" sequence="510"/>
</data>
</openerp>
Create Template for report.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_id">
<t t-foreach="docs" t-as="o">
<t t-call="report.external_layout">
<div class="page">
<br /><br /><br />
<div class="row">
<strong style="text-align:center;display:block;">ABC</strong>
<br/>
<table border="1" class="table table-condensed">
</table>
</div>
</div>
</t>
</t>
</template>
</data>
Bad Report ReferenceThis report is not loaded into the database: moduletest.abc_abc_report_template.
ReplyDeleteThanks for this article.
ReplyDeleteHey buddy!! What amazing and useful information you are sharing here, thanks for sharing. I would love to share this information on mine post also so that the visitors of my blog also get a chance to become familiar with this information.
ReplyDeleteOdoo Development Company India |
Hire Odoo developers India