Add module crm_usability

This commit is contained in:
Alexis de Lattre
2016-11-07 19:05:25 +01:00
parent ef920f58f4
commit 4015f5b1c9
5 changed files with 87 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# @author Alexis de Lattre <alexis.delattre@akretion.com>
{
'name': 'CRM Usability',
'version': '8.0.1.0.0',
'category': 'Customer Relationship Management',
'license': 'AGPL-3',
'summary': 'CRM usability enhancements',
'description': """
CRM Usability
=============
Some enhancements in the *Merge Partners* wizard:
* take into account the unaccent option of the server config file
* add optional group by on 'customer' and 'supplier' (active by default)
This module has been written by Alexis de Lattre from Akretion
<alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['crm'],
'data': ['wizard/base_partner_merge_view.xml'],
'installable': True,
}

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import base_partner_merge

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# @author Alexis de Lattre <alexis.delattre@akretion.com>
from openerp import models, fields, tools
class MergePartnerAutomatic(models.TransientModel):
_inherit = 'base.partner.merge.automatic.wizard'
group_by_customer = fields.Boolean('Customer', default=True)
group_by_supplier = fields.Boolean('Supplier', default=True)
def _generate_query(self, fields, maximum_group=100):
sql = super(MergePartnerAutomatic, self)._generate_query(
fields, maximum_group=maximum_group)
name_sql_original = 'lower(name)'
if name_sql_original in sql:
if tools.config.get('unaccent', False):
sql = sql.replace(
name_sql_original,
"unaccent(lower(replace(name, ' ', '')))")
else:
sql = sql.replace(
name_sql_original,
"lower(replace(name, ' ', ''))")
return sql

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="base_partner_merge_automatic_wizard_form" model="ir.ui.view">
<field name="name">rvip.base.partner.merge.automatic.wizard.form</field>
<field name="model">base.partner.merge.automatic.wizard</field>
<field name="inherit_id" ref="crm.base_partner_merge_automatic_wizard_form"/>
<field name="arch" type="xml">
<field name="group_by_is_company" position="after">
<field name="group_by_customer"/>
<field name="group_by_supplier"/>
</field>
<xpath expr="//field[@name='partner_ids']/tree/field[@name='is_company']" position="after">
<field name="customer"/>
<field name="supplier"/>
</xpath>
</field>
</record>
</data>
</openerp>