Add module crm_usability
This commit is contained in:
3
crm_usability/__init__.py
Normal file
3
crm_usability/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import wizard
|
||||
29
crm_usability/__openerp__.py
Normal file
29
crm_usability/__openerp__.py
Normal 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,
|
||||
}
|
||||
3
crm_usability/wizard/__init__.py
Normal file
3
crm_usability/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import base_partner_merge
|
||||
29
crm_usability/wizard/base_partner_merge.py
Normal file
29
crm_usability/wizard/base_partner_merge.py
Normal 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
|
||||
23
crm_usability/wizard/base_partner_merge_view.xml
Normal file
23
crm_usability/wizard/base_partner_merge_view.xml
Normal 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>
|
||||
Reference in New Issue
Block a user