Browse Source

[imp] allow to navigate to the individual records, so that the

data processor can optionally delete them.
pull/19/head
Jordi Ballester Alomar 6 years ago
committed by Aaron Henriquez
parent
commit
7dcbf8b7a7
  1. BIN
      privacy_partner_report/static/description/icon.png
  2. 19
      privacy_partner_report/wizard/privacy_report_partner.py
  3. 18
      privacy_partner_report/wizard/privacy_report_partner_wizard.xml

BIN
privacy_partner_report/static/description/icon.png

Before

Width: 128  |  Height: 128  |  Size: 9.2 KiB

After

Width: 128  |  Height: 128  |  Size: 2.1 KiB

19
privacy_partner_report/wizard/privacy_report_partner.py

@ -2,6 +2,7 @@
# 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, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
import ast
class PrivacyPartnerReport(models.TransientModel): class PrivacyPartnerReport(models.TransientModel):
@ -142,6 +143,7 @@ class PrivacyPartnerReport(models.TransientModel):
[('model', '=', res._name)]).id, [('model', '=', res._name)]).id,
'count_rows': len(res.ids), 'count_rows': len(res.ids),
'field_type': field_type, 'field_type': field_type,
'res_ids': res.ids,
} }
return values return values
return {} return {}
@ -223,3 +225,20 @@ class PrivacyPartnerData(models.TransientModel):
default=0, default=0,
string='Number of lines', string='Number of lines',
) )
res_ids = fields.Char('Related Document IDs', index=True,
help='List of Related Document IDs')
@api.multi
def action_view_records(self):
self.ensure_one()
response = {
'name': self.model_id.display_name,
'type': 'ir.actions.act_window',
'res_model': self.model_id.model,
'view_mode': 'tree,form',
'domain': [('id', 'in', ast.literal_eval(self.res_ids))],
'target': 'current',
'context': {'delete': True},
}
return response

18
privacy_partner_report/wizard/privacy_report_partner_wizard.xml

@ -8,6 +8,9 @@
<field name="model">privacy.partner.report</field> <field name="model">privacy.partner.report</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Report Options"> <form string="Report Options">
<header>
<button name="button_export_xlsx" string="Export XLSX" type="object" default_focus="1" class="oe_highlight"/>
</header>
<group groups="base.group_multi_company"> <group groups="base.group_multi_company">
<group> <group>
<span >Select a company</span><br/> <span >Select a company</span><br/>
@ -20,19 +23,17 @@
<field name="partner_id" options="{'no_create': True}" nolabel="1" domain="[('company_id', 'in', [False, company_id])]"/> <field name="partner_id" options="{'no_create': True}" nolabel="1" domain="[('company_id', 'in', [False, company_id])]"/>
</group> </group>
</group> </group>
<group attrs="{'invisible': [('partner_id', '=', False)]}" col="1">
<field name="table_ids" options="{'no_create': True}" editable="bottom">
<group string='Models with related partner data' attrs="{'invisible': [('partner_id', '=', False)]}" col="1">
<field name="table_ids" options="{'no_create': True}" editable="bottom" nolabel="1">
<tree> <tree>
<field name="model_id"/> <field name="model_id"/>
<field name="count_rows" text-align="right"/> <field name="count_rows" text-align="right"/>
<button name="action_view_records"
type="object" icon="fa-info-circle"
attrs="{'invisible': [('count_rows', '=', '0')]}" />
</tree> </tree>
</field> </field>
</group> </group>
<footer>
<button name="button_export_xlsx" string="Export XLSX" type="object" default_focus="1" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form> </form>
</field> </field>
</record> </record>
@ -44,8 +45,7 @@
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="view_id" ref="privacy_partner_report_wizard"/> <field name="view_id" ref="privacy_partner_report_wizard"/>
<field name="context">{}</field>
<field name="target">new</field>
<field name="target">current</field>
</record> </record>
</odoo> </odoo>
Loading…
Cancel
Save