Browse Source

[FIX] beta pylint + templates from oca

pull/438/head
Damien Crier 8 years ago
parent
commit
1ab28a2fd1
  1. 29
      base_report_auto_create_qweb/README.rst
  2. 8
      base_report_auto_create_qweb/__init__.py
  3. 21
      base_report_auto_create_qweb/__openerp__.py
  4. 8
      base_report_auto_create_qweb/models/__init__.py
  5. 10
      base_report_auto_create_qweb/models/report_xml.py
  6. 38
      base_report_auto_create_qweb/views/report_xml_view.xml
  7. 8
      base_report_auto_create_qweb/wizard/__init__.py
  8. 11
      base_report_auto_create_qweb/wizard/report_duplicate.py

29
base_report_auto_create_qweb/README.rst

@ -1,6 +1,8 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
===========================
Report qweb auto generation
===========================
@ -16,17 +18,32 @@ system is used this will add 'copy' as suffix.
Be careful with this option as it can create many unnecessary Qweb views because
it duplicates all the related files to the report you are copying.
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch}
.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/server-tools/issues/new?body=module:%20base_report_auto_create_qweb%0Aversion:%20{version}%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
@ -47,4 +64,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.

8
base_report_auto_create_qweb/__init__.py

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# Authors: See README.RST
# Copyright 2016 See README.rst for Authors
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
from . import wizard

21
base_report_auto_create_qweb/__openerp__.py

@ -1,20 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
##############################################################################
# -*- coding: utf-8 -*-
# Authors: See README.RST
# Copyright 2016 See README.rst for Authors
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Report qweb auto generation",

8
base_report_auto_create_qweb/models/__init__.py

@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# Authors: See README.RST
# Copyright 2016 See README.rst for Authors
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import report_xml

10
base_report_auto_create_qweb/models/report_xml.py

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# Authors: See README.RST
# Copyright 2016 See README.rst for Authors
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api, exceptions, _
import logging
@ -92,7 +92,7 @@ class IrActionsReport(models.Model):
report_xml._create_qweb(name, report_name, module, model, arch)
return report_xml
@api.one
@api.multi
def copy(self, default=None):
if not self.env.context.get('enable_duplication', False):
return super(IrActionsReport, self).copy(default=default)

38
base_report_auto_create_qweb/views/report_xml_view.xml

@ -1,23 +1,23 @@
<?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="report.act_report_xml_view_inherit" />
<field name="arch" type="xml">
<xpath expr="//button[@name='unlink_action']" position="after">
<button name="%(ir_actions_report_xml_duplicate_action)d"
string="Duplicate Report" class="oe_highlight" type="action"/>
</xpath>
<button name="associated_view" position="after">
<button type="object" class="oe_link" name="button_create_qweb"
string="Create QWeb view" colspan="2"
attrs="{'invisible':[('report_type', 'not in', ['qweb-pdf', 'qweb-html'])]}" />
</button>
<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="report.act_report_xml_view_inherit" />
<field name="arch" type="xml">
<xpath expr="//button[@name='unlink_action']" position="after">
<button name="%(ir_actions_report_xml_duplicate_action)d"
string="Duplicate Report" class="oe_highlight" type="action"/>
</xpath>
<button name="associated_view" position="after">
<button type="object" class="oe_link" name="button_create_qweb"
string="Create QWeb view" colspan="2"
attrs="{'invisible':[('report_type', 'not in', ['qweb-pdf', 'qweb-html'])]}" />
</button>
</field>
</record>
</data>
</field>
</record>
</data>
</openerp>

8
base_report_auto_create_qweb/wizard/__init__.py

@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# Authors: See README.RST
# Copyright 2016 See README.rst for Authors
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import report_duplicate

11
base_report_auto_create_qweb/wizard/report_duplicate.py

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# Authors: See README.RST
# Copyright 2016 See README.rst for Authors
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
@ -12,8 +12,9 @@ class IrActionsReportDuplicate(models.TransientModel):
suffix = fields.Char(
string='Suffix', help='This suffix will be added to the report')
@api.one
@api.multi
def duplicate_report(self):
self.ensure_one()
active_id = self.env.context.get('active_id')
model = self.env.context.get('active_model')
if model:

Loading…
Cancel
Save