oihane
10 years ago
committed by
Alex Comba
8 changed files with 164 additions and 26 deletions
-
10base_report_auto_create_qweb/README.rst
-
1base_report_auto_create_qweb/__init__.py
-
5base_report_auto_create_qweb/__openerp__.py
-
94base_report_auto_create_qweb/models/report_xml.py
-
19base_report_auto_create_qweb/views/report_xml_view.xml
-
6base_report_auto_create_qweb/wizard/__init__.py
-
22base_report_auto_create_qweb/wizard/report_duplicate.py
-
33base_report_auto_create_qweb/wizard/report_duplicate_view.xml
@ -0,0 +1,19 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<openerp> |
|||
<data> |
|||
<record model="ir.ui.view" id="ir_actions_report_xml_form_view"> |
|||
<field name="name">ir.actions.report.xml.form</field> |
|||
<field name="model">ir.actions.report.xml</field> |
|||
<field name="priority" eval="5" /> |
|||
<field name="inherit_id" ref="base.act_report_xml_view" /> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//form/group" position="before"> |
|||
<header> |
|||
<button name="%(ir_actions_report_xml_duplicate_action)d" |
|||
string="Duplicate Report" class="oe_highlight" type="action"/> |
|||
</header> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,6 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# For copyright and license notices, see __openerp__.py file in root directory |
|||
############################################################################## |
|||
|
|||
from . import report_duplicate |
@ -0,0 +1,22 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# For copyright and license notices, see __openerp__.py file in root directory |
|||
############################################################################## |
|||
|
|||
from openerp import api, fields, models |
|||
|
|||
|
|||
class IrActionsReportDuplicate(models.TransientModel): |
|||
_name = 'ir.actions.report.xml.duplicate' |
|||
|
|||
suffix = fields.Char( |
|||
string='Suffix', help='This suffix will be added to the report') |
|||
|
|||
@api.one |
|||
def duplicate_report(self): |
|||
active_id = self.env.context.get('active_id') |
|||
model = self.env.context.get('active_model') |
|||
if model: |
|||
object = self.env[model].browse(active_id) |
|||
object.with_context(suffix=self.suffix).copy() |
|||
return {} |
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<openerp> |
|||
<data> |
|||
<record model="ir.ui.view" id="ir_actions_report_xml_duplicate_form_view"> |
|||
<field name="name">ir.actions.report.xml.duplicate.form</field> |
|||
<field name="model">ir.actions.report.xml.duplicate</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Report duplication"> |
|||
<group> |
|||
<field name="suffix" /> |
|||
</group> |
|||
<footer> |
|||
<button class="oe_highlight" name="duplicate_report" |
|||
string="Duplicate" type="object" /> |
|||
or |
|||
<button class="oe_link" special="cancel" |
|||
string="Cancel" /> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.actions.act_window" id="ir_actions_report_xml_duplicate_action"> |
|||
<field name="name">Report duplication</field> |
|||
<field name="res_model">ir.actions.report.xml.duplicate</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="ir_actions_report_xml_duplicate_form_view" /> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue