From f05356b2b01e8489873cdb88711d40615012f4a9 Mon Sep 17 00:00:00 2001 From: mreficent Date: Fri, 16 Nov 2018 12:39:37 +0100 Subject: [PATCH] [MIG] privacy_partner_report: Migration to 11.0 --- privacy_partner_report/README.rst | 2 +- privacy_partner_report/__init__.py | 1 - privacy_partner_report/__manifest__.py | 3 +-- .../controllers/__init__.py | 3 +-- .../readme/CONTRIBUTORS.rst | 1 + privacy_partner_report/readme/DESCRIPTION.rst | 2 ++ privacy_partner_report/readme/ROADMAP.rst | 1 + privacy_partner_report/readme/USAGE.rst | 5 ++++ privacy_partner_report/report/__init__.py | 1 - .../report/privacy_partner_xlsx.py | 23 ++++--------------- .../views/privacy_report.xml | 17 +++++++------- privacy_partner_report/wizard/__init__.py | 1 - .../wizard/privacy_report_partner.py | 15 ++++++------ 13 files changed, 32 insertions(+), 43 deletions(-) create mode 100644 privacy_partner_report/readme/CONTRIBUTORS.rst create mode 100644 privacy_partner_report/readme/DESCRIPTION.rst create mode 100644 privacy_partner_report/readme/ROADMAP.rst create mode 100644 privacy_partner_report/readme/USAGE.rst diff --git a/privacy_partner_report/README.rst b/privacy_partner_report/README.rst index beb439d..cb09b85 100644 --- a/privacy_partner_report/README.rst +++ b/privacy_partner_report/README.rst @@ -21,7 +21,7 @@ To use this module, you need to: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/263/10.0 + :target: https://runbot.odoo-community.org/runbot/263/11.0 Known issues / Roadmap ====================== diff --git a/privacy_partner_report/__init__.py b/privacy_partner_report/__init__.py index f07586e..807584d 100644 --- a/privacy_partner_report/__init__.py +++ b/privacy_partner_report/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from . import controllers from . import report from . import wizard diff --git a/privacy_partner_report/__manifest__.py b/privacy_partner_report/__manifest__.py index 51c92b6..396e9e2 100644 --- a/privacy_partner_report/__manifest__.py +++ b/privacy_partner_report/__manifest__.py @@ -1,9 +1,8 @@ -# -*- coding: utf-8 -*- # Copyright 2018 Eficent Business and IT Consulting Services S.L. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': 'Privacy Partner Report', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'category': 'GDPR', 'summary': 'Show the transactions that a specific partner is involved in.', 'author': "Eficent, " diff --git a/privacy_partner_report/controllers/__init__.py b/privacy_partner_report/controllers/__init__.py index 757b12a..8424b1e 100644 --- a/privacy_partner_report/controllers/__init__.py +++ b/privacy_partner_report/controllers/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- -from . import main +# from . import main diff --git a/privacy_partner_report/readme/CONTRIBUTORS.rst b/privacy_partner_report/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..2e34e21 --- /dev/null +++ b/privacy_partner_report/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Miquel Raïch diff --git a/privacy_partner_report/readme/DESCRIPTION.rst b/privacy_partner_report/readme/DESCRIPTION.rst new file mode 100644 index 0000000..1f0334f --- /dev/null +++ b/privacy_partner_report/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module helps a company to identify all the transactions that a specific +partner is involved in, with the possibility to export the associated data. diff --git a/privacy_partner_report/readme/ROADMAP.rst b/privacy_partner_report/readme/ROADMAP.rst new file mode 100644 index 0000000..8f001bc --- /dev/null +++ b/privacy_partner_report/readme/ROADMAP.rst @@ -0,0 +1 @@ +* Remove controller workaround if https://github.com/odoo/odoo/pull/24964 is merged. diff --git a/privacy_partner_report/readme/USAGE.rst b/privacy_partner_report/readme/USAGE.rst new file mode 100644 index 0000000..5b27d0e --- /dev/null +++ b/privacy_partner_report/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + +#. Go to menu of ``Privacy > Reports > Partner Report``. +#. Select a partner, and then wait some seconds until a list of models appear. +#. Click on ``Export XLSX``. diff --git a/privacy_partner_report/report/__init__.py b/privacy_partner_report/report/__init__.py index 38a00d0..c7f3d0d 100644 --- a/privacy_partner_report/report/__init__.py +++ b/privacy_partner_report/report/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- from . import privacy_partner_xlsx diff --git a/privacy_partner_report/report/privacy_partner_xlsx.py b/privacy_partner_report/report/privacy_partner_xlsx.py index 030afc9..4ae39eb 100644 --- a/privacy_partner_report/report/privacy_partner_xlsx.py +++ b/privacy_partner_report/report/privacy_partner_xlsx.py @@ -1,24 +1,16 @@ -# -*- coding: utf-8 -*- # Copyright 2018 Eficent Business and IT Consulting Services S.L. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html import logging -from odoo.report import report_sxw +from odoo import models from odoo.tools.translate import _ _logger = logging.getLogger(__name__) -try: - from openerp.addons.report_xlsx.report.report_xlsx import ReportXlsx -except ImportError: - _logger.debug("report_xlsx not installed, Excel export non functional") - class ReportXlsx(object): - def __init__(self, *args, **kwargs): - pass - - -class ReportPartnerXlsx(ReportXlsx): +class ReportPartnerXlsx(models.AbstractModel): + _name = 'report.privacy_partner_report.report_partner_xlsx' + _inherit = 'report.report_xlsx.abstract' def _search_longest_row(self, tables): res = 0 @@ -85,10 +77,3 @@ class ReportPartnerXlsx(ReportXlsx): j += 1 i += 2 first_row = i+2 - - -ReportPartnerXlsx( - 'report.privacy.report_partner_xlsx', - 'privacy.partner.report', - parser=report_sxw.rml_parse -) diff --git a/privacy_partner_report/views/privacy_report.xml b/privacy_partner_report/views/privacy_report.xml index ae11dbc..0596f7d 100644 --- a/privacy_partner_report/views/privacy_report.xml +++ b/privacy_partner_report/views/privacy_report.xml @@ -1,11 +1,12 @@ - - Privacy Partner Data - privacy.partner.report - ir.actions.report.xml - privacy.report_partner_xlsx - xlsx - - + diff --git a/privacy_partner_report/wizard/__init__.py b/privacy_partner_report/wizard/__init__.py index bcc6c24..f9e260f 100644 --- a/privacy_partner_report/wizard/__init__.py +++ b/privacy_partner_report/wizard/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- from . import privacy_report_partner diff --git a/privacy_partner_report/wizard/privacy_report_partner.py b/privacy_partner_report/wizard/privacy_report_partner.py index 8d50fab..f1680cd 100644 --- a/privacy_partner_report/wizard/privacy_report_partner.py +++ b/privacy_partner_report/wizard/privacy_report_partner.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2018 Eficent Business and IT Consulting Services S.L. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import api, fields, models, _ @@ -132,7 +131,7 @@ class PrivacyPartnerReport(models.TransientModel): def _get_default_table(self, name, data): if data: - data_type = data[0][4] + field_type = data[0][4] res = self.env[data[0][1]] for t in data: res |= self.env[t[1]].sudo().browse(t[3]) @@ -142,7 +141,7 @@ class PrivacyPartnerReport(models.TransientModel): 'model_id': self.env['ir.model'].sudo().search( [('model', '=', res._name)]).id, 'count_rows': len(res.ids), - 'type': data_type, + 'field_type': field_type, } return values return {} @@ -200,9 +199,9 @@ class PrivacyPartnerReport(models.TransientModel): records = self.env[data['model']].sudo().browse(data.get('ids', [])) processed_data = self.compute_data_for_report(data) if xlsx_report: - return self.env['report'].with_context(landscape=True).get_action( - records=records, report_name='privacy.report_partner_xlsx', - data=processed_data) + return self.env.ref('privacy_partner_report.report_partner_xlsx').\ + with_context(landscape=True).report_action( + records, data=processed_data) class PrivacyPartnerData(models.TransientModel): @@ -217,8 +216,8 @@ class PrivacyPartnerData(models.TransientModel): ondelete='cascade', string='Models', ) - type = fields.Char( - string="Type", + field_type = fields.Char( + string="Type", oldname='type', ) count_rows = fields.Integer( default=0,