Browse Source

[MIG] privacy_partner_report: Migration to 11.0

pull/45/head
mreficent 6 years ago
committed by Mustufa Kantawala
parent
commit
f05356b2b0
  1. 2
      privacy_partner_report/README.rst
  2. 1
      privacy_partner_report/__init__.py
  3. 3
      privacy_partner_report/__manifest__.py
  4. 3
      privacy_partner_report/controllers/__init__.py
  5. 1
      privacy_partner_report/readme/CONTRIBUTORS.rst
  6. 2
      privacy_partner_report/readme/DESCRIPTION.rst
  7. 1
      privacy_partner_report/readme/ROADMAP.rst
  8. 5
      privacy_partner_report/readme/USAGE.rst
  9. 1
      privacy_partner_report/report/__init__.py
  10. 23
      privacy_partner_report/report/privacy_partner_xlsx.py
  11. 17
      privacy_partner_report/views/privacy_report.xml
  12. 1
      privacy_partner_report/wizard/__init__.py
  13. 15
      privacy_partner_report/wizard/privacy_report_partner.py

2
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 .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :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 Known issues / Roadmap
====================== ======================

1
privacy_partner_report/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers from . import controllers
from . import report from . import report
from . import wizard from . import wizard

3
privacy_partner_report/__manifest__.py

@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Eficent Business and IT Consulting Services S.L. # Copyright 2018 Eficent Business and IT Consulting Services S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{ {
'name': 'Privacy Partner Report', 'name': 'Privacy Partner Report',
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'category': 'GDPR', 'category': 'GDPR',
'summary': 'Show the transactions that a specific partner is involved in.', 'summary': 'Show the transactions that a specific partner is involved in.',
'author': "Eficent, " 'author': "Eficent, "

3
privacy_partner_report/controllers/__init__.py

@ -1,2 +1 @@
# -*- coding: utf-8 -*-
from . import main
# from . import main

1
privacy_partner_report/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Miquel Raïch <miquel.raich@eficent.com>

2
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.

1
privacy_partner_report/readme/ROADMAP.rst

@ -0,0 +1 @@
* Remove controller workaround if https://github.com/odoo/odoo/pull/24964 is merged.

5
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``.

1
privacy_partner_report/report/__init__.py

@ -1,2 +1 @@
# -*- coding: utf-8 -*-
from . import privacy_partner_xlsx from . import privacy_partner_xlsx

23
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. # Copyright 2018 Eficent Business and IT Consulting Services S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import logging import logging
from odoo.report import report_sxw
from odoo import models
from odoo.tools.translate import _ from odoo.tools.translate import _
_logger = logging.getLogger(__name__) _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): def _search_longest_row(self, tables):
res = 0 res = 0
@ -85,10 +77,3 @@ class ReportPartnerXlsx(ReportXlsx):
j += 1 j += 1
i += 2 i += 2
first_row = i+2 first_row = i+2
ReportPartnerXlsx(
'report.privacy.report_partner_xlsx',
'privacy.partner.report',
parser=report_sxw.rml_parse
)

17
privacy_partner_report/views/privacy_report.xml

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="action_report_partner_data_xlsx" model="ir.actions.report.xml">
<field name="name">Privacy Partner Data</field>
<field name="model">privacy.partner.report</field>
<field name="type">ir.actions.report.xml</field>
<field name="report_name">privacy.report_partner_xlsx</field>
<field name="report_type">xlsx</field>
<field name="auto" eval="False"/>
</record>
<report
id="report_partner_xlsx"
model="privacy.partner.report"
string="Privacy Partner Data"
report_type="xlsx"
name="privacy_partner_report.report_partner_xlsx"
file="privacy_partner_report"
attachment_use="False"
/>
</odoo> </odoo>

1
privacy_partner_report/wizard/__init__.py

@ -1,2 +1 @@
# -*- coding: utf-8 -*-
from . import privacy_report_partner from . import privacy_report_partner

15
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. # Copyright 2018 Eficent Business and IT Consulting Services S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, fields, models, _ from odoo import api, fields, models, _
@ -132,7 +131,7 @@ class PrivacyPartnerReport(models.TransientModel):
def _get_default_table(self, name, data): def _get_default_table(self, name, data):
if data: if data:
data_type = data[0][4]
field_type = data[0][4]
res = self.env[data[0][1]] res = self.env[data[0][1]]
for t in data: for t in data:
res |= self.env[t[1]].sudo().browse(t[3]) 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_id': self.env['ir.model'].sudo().search(
[('model', '=', res._name)]).id, [('model', '=', res._name)]).id,
'count_rows': len(res.ids), 'count_rows': len(res.ids),
'type': data_type,
'field_type': field_type,
} }
return values return values
return {} return {}
@ -200,9 +199,9 @@ class PrivacyPartnerReport(models.TransientModel):
records = self.env[data['model']].sudo().browse(data.get('ids', [])) records = self.env[data['model']].sudo().browse(data.get('ids', []))
processed_data = self.compute_data_for_report(data) processed_data = self.compute_data_for_report(data)
if xlsx_report: 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): class PrivacyPartnerData(models.TransientModel):
@ -217,8 +216,8 @@ class PrivacyPartnerData(models.TransientModel):
ondelete='cascade', ondelete='cascade',
string='Models', string='Models',
) )
type = fields.Char(
string="Type",
field_type = fields.Char(
string="Type", oldname='type',
) )
count_rows = fields.Integer( count_rows = fields.Integer(
default=0, default=0,

Loading…
Cancel
Save