[MIG] base_usability: Migration to 12.0
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from . import users
|
from . import users
|
||||||
from . import partner
|
from . import partner
|
||||||
from . import company
|
from . import company
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# © 2014-2016 Akretion (http://www.akretion.com)
|
# © 2014-2016 Akretion (http://www.akretion.com)
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Base Usability',
|
'name': 'Base Usability',
|
||||||
'version': '10.0.0.1.0',
|
'version': '12.0.0.1.0',
|
||||||
'category': 'Partner',
|
'category': 'Partner',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Better usability in base module',
|
'summary': 'Better usability in base module',
|
||||||
@@ -17,19 +16,19 @@ This module adds *track_visibility='onchange'* on all the important fields of th
|
|||||||
|
|
||||||
By default, Odoo doesn't display the title field on all the partner form views. This module fixes it (it replaces the module base_title_on_partner).
|
By default, Odoo doesn't display the title field on all the partner form views. This module fixes it (it replaces the module base_title_on_partner).
|
||||||
|
|
||||||
By default, users in the Partner Contact group also have create/write access on Countries and States. This module removes that: only the users in the *Administration > Configuration* group have create/write/delete access on those objects.
|
|
||||||
|
|
||||||
It also adds a log message at INFO level when sending an email via SMTP.
|
It also adds a log message at INFO level when sending an email via SMTP.
|
||||||
|
|
||||||
It displays the local modules with installable filter.
|
It displays the local modules with installable filter.
|
||||||
A group by 'State' is added to module search view.
|
A group by 'State' is added to module search view.
|
||||||
|
|
||||||
|
It provides a _display_report_header method on the res.company object and
|
||||||
|
_display_full_address on res.partner which are useful for reporting.
|
||||||
""",
|
""",
|
||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['base'],
|
'depends': ['base'],
|
||||||
'data': [
|
'data': [
|
||||||
'security/group.xml',
|
'security/group.xml',
|
||||||
'security/ir.model.access.csv',
|
|
||||||
'partner_view.xml',
|
'partner_view.xml',
|
||||||
'partner_bank_view.xml',
|
'partner_bank_view.xml',
|
||||||
'users_view.xml',
|
'users_view.xml',
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
@@ -19,14 +18,14 @@ class ResCompany(models.Model):
|
|||||||
value = field[0]
|
value = field[0]
|
||||||
label = field[1]
|
label = field[1]
|
||||||
uicon = False
|
uicon = False
|
||||||
elif isinstance(field, (str, unicode)) and field in options:
|
elif isinstance(field, str) and field in options:
|
||||||
value = options[field]['value']
|
value = options[field]['value']
|
||||||
label = options[field].get('label')
|
label = options[field].get('label')
|
||||||
uicon = options[field].get('icon')
|
uicon = options[field].get('icon')
|
||||||
if value:
|
if value:
|
||||||
prefix = icon and uicon or label
|
prefix = icon and uicon or label
|
||||||
if prefix:
|
if prefix:
|
||||||
content.append(u'%s %s' % (prefix, value))
|
content.append('%s %s' % (prefix, value))
|
||||||
else:
|
else:
|
||||||
content.append(value)
|
content.append(value)
|
||||||
line = separator.join(content)
|
line = separator.join(content)
|
||||||
@@ -39,21 +38,16 @@ class ResCompany(models.Model):
|
|||||||
'phone': {
|
'phone': {
|
||||||
'value': self.phone,
|
'value': self.phone,
|
||||||
# http://www.fileformat.info/info/unicode/char/1f4de/index.htm
|
# http://www.fileformat.info/info/unicode/char/1f4de/index.htm
|
||||||
'icon': u'\U0001F4DE',
|
'icon': '\U0001F4DE',
|
||||||
'label': _('Tel:')},
|
'label': _('Tel:')},
|
||||||
'fax': {
|
|
||||||
'value': self.fax,
|
|
||||||
# http://www.fileformat.info/info/unicode/char/1f5b7/index.htm
|
|
||||||
'icon': u'\U0001F5B7',
|
|
||||||
'label': _('Fax:')},
|
|
||||||
'email': {
|
'email': {
|
||||||
'value': self.email,
|
'value': self.email,
|
||||||
# http://www.fileformat.info/info/unicode/char/2709/index.htm
|
# http://www.fileformat.info/info/unicode/char/2709/index.htm
|
||||||
'icon': u'\u2709',
|
'icon': '\u2709',
|
||||||
'label': _('E-mail:')},
|
'label': _('E-mail:')},
|
||||||
'website': {
|
'website': {
|
||||||
'value': self.website,
|
'value': self.website,
|
||||||
'icon': u'\U0001f310',
|
'icon': '\U0001f310',
|
||||||
'label': _('Website:')},
|
'label': _('Website:')},
|
||||||
'vat': {
|
'vat': {
|
||||||
'value': self.vat,
|
'value': self.vat,
|
||||||
@@ -69,14 +63,14 @@ class ResCompany(models.Model):
|
|||||||
# for reports
|
# for reports
|
||||||
@api.multi
|
@api.multi
|
||||||
def _display_report_header(
|
def _display_report_header(
|
||||||
self, line_details=[['phone', 'fax', 'website'], ['vat']],
|
self, line_details=[['phone', 'website'], ['vat']],
|
||||||
icon=True, line_separator=' - '):
|
icon=True, line_separator=' - '):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
res = u''
|
res = ''
|
||||||
address = self.partner_id._display_address(without_company=True)
|
address = self.partner_id._display_address(without_company=True)
|
||||||
address = address.replace('\n', u' - ')
|
address = address.replace('\n', ' - ')
|
||||||
|
|
||||||
line1 = u'%s - %s' % (self._report_company_legal_name(), address)
|
line1 = '%s - %s' % (self._report_company_legal_name(), address)
|
||||||
lines = [line1]
|
lines = [line1]
|
||||||
options = self._prepare_header_options()
|
options = self._prepare_header_options()
|
||||||
for details in line_details:
|
for details in line_details:
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, api
|
from odoo import models, api
|
||||||
from odoo.addons.base.ir.ir_mail_server import extract_rfc2822_addresses
|
from odoo.addons.base.models.ir_mail_server import extract_rfc2822_addresses
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -16,7 +15,7 @@ class IrMailServer(models.Model):
|
|||||||
def send_email(
|
def send_email(
|
||||||
self, message, mail_server_id=None, smtp_server=None,
|
self, message, mail_server_id=None, smtp_server=None,
|
||||||
smtp_port=None, smtp_user=None, smtp_password=None,
|
smtp_port=None, smtp_user=None, smtp_password=None,
|
||||||
smtp_encryption=None, smtp_debug=False):
|
smtp_encryption=None, smtp_debug=False, smtp_session=None):
|
||||||
# Start copy from native method
|
# Start copy from native method
|
||||||
smtp_from = message['Return-Path'] or\
|
smtp_from = message['Return-Path'] or\
|
||||||
self._get_default_bounce_address() or message['From']
|
self._get_default_bounce_address() or message['From']
|
||||||
@@ -32,4 +31,5 @@ class IrMailServer(models.Model):
|
|||||||
message, mail_server_id=mail_server_id,
|
message, mail_server_id=mail_server_id,
|
||||||
smtp_server=smtp_server, smtp_port=smtp_port,
|
smtp_server=smtp_server, smtp_port=smtp_port,
|
||||||
smtp_user=smtp_user, smtp_password=smtp_password,
|
smtp_user=smtp_user, smtp_password=smtp_password,
|
||||||
smtp_encryption=smtp_encryption, smtp_debug=smtp_debug)
|
smtp_encryption=smtp_encryption, smtp_debug=smtp_debug,
|
||||||
|
smtp_session=smtp_session)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ class ResPartner(models.Model):
|
|||||||
if partner.lang:
|
if partner.lang:
|
||||||
partner_lg = partner.with_context(lang=partner.lang)
|
partner_lg = partner.with_context(lang=partner.lang)
|
||||||
title = partner_lg.title.shortcut or partner_lg.title.name
|
title = partner_lg.title.shortcut or partner_lg.title.name
|
||||||
name_title = u' '.join([title, name_title])
|
name_title = ' '.join([title, name_title])
|
||||||
partner.name_title = name_title
|
partner.name_title = name_title
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@@ -63,7 +62,7 @@ class ResPartner(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def _display_full_address(
|
def _display_full_address(
|
||||||
self, details=[
|
self, details=[
|
||||||
'company', 'name', 'address', 'phone', 'fax',
|
'company', 'name', 'address', 'phone',
|
||||||
'mobile', 'email'],
|
'mobile', 'email'],
|
||||||
icon=True):
|
icon=True):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
@@ -87,31 +86,25 @@ class ResPartner(models.Model):
|
|||||||
'phone': {
|
'phone': {
|
||||||
'value': self.phone,
|
'value': self.phone,
|
||||||
# http://www.fileformat.info/info/unicode/char/1f4de/index.htm
|
# http://www.fileformat.info/info/unicode/char/1f4de/index.htm
|
||||||
'icon': u'\U0001F4DE',
|
'icon': '\U0001F4DE',
|
||||||
'label': _('Tel:'),
|
'label': _('Tel:'),
|
||||||
},
|
},
|
||||||
'fax': {
|
|
||||||
'value': self.fax,
|
|
||||||
# http://www.fileformat.info/info/unicode/char/1f5b7/index.htm
|
|
||||||
'icon': u'\U0001F5B7',
|
|
||||||
'label': _('Fax:'),
|
|
||||||
},
|
|
||||||
'mobile': {
|
'mobile': {
|
||||||
'value': self.mobile,
|
'value': self.mobile,
|
||||||
# http://www.fileformat.info/info/unicode/char/1f4f1/index.htm
|
# http://www.fileformat.info/info/unicode/char/1f4f1/index.htm
|
||||||
'icon': u'\U0001F4F1',
|
'icon': '\U0001F4F1',
|
||||||
'label': _('Mobile:'),
|
'label': _('Mobile:'),
|
||||||
},
|
},
|
||||||
'email': {
|
'email': {
|
||||||
'value': self.email,
|
'value': self.email,
|
||||||
# http://www.fileformat.info/info/unicode/char/2709/index.htm
|
# http://www.fileformat.info/info/unicode/char/2709/index.htm
|
||||||
'icon': u'\u2709',
|
'icon': '\u2709',
|
||||||
'label': _('E-mail:'),
|
'label': _('E-mail:'),
|
||||||
},
|
},
|
||||||
'website': {
|
'website': {
|
||||||
'value': self.website,
|
'value': self.website,
|
||||||
# http://www.fileformat.info/info/unicode/char/1f310/index.htm
|
# http://www.fileformat.info/info/unicode/char/1f310/index.htm
|
||||||
'icon': u'\U0001f310',
|
'icon': '\U0001f310',
|
||||||
'label': _('Website:'),
|
'label': _('Website:'),
|
||||||
},
|
},
|
||||||
'address': {
|
'address': {
|
||||||
@@ -124,9 +117,9 @@ class ResPartner(models.Model):
|
|||||||
entry = options[detail]
|
entry = options[detail]
|
||||||
prefix = icon and entry.get('icon') or entry.get('label')
|
prefix = icon and entry.get('icon') or entry.get('label')
|
||||||
if prefix:
|
if prefix:
|
||||||
res.append(u'%s %s' % (prefix, entry['value']))
|
res.append('%s %s' % (prefix, entry['value']))
|
||||||
else:
|
else:
|
||||||
res.append(u'%s' % entry['value'])
|
res.append('%s' % entry['value'])
|
||||||
res = '\n'.join(res)
|
res = '\n'.join(res)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, api
|
from odoo import models, api
|
||||||
from odoo.report import report_sxw
|
from odoo.tools import misc
|
||||||
from openerp.tools import float_compare
|
from odoo.tools import float_compare
|
||||||
|
|
||||||
|
|
||||||
class BaseUsabilityInstalled(models.AbstractModel):
|
class BaseUsabilityInstalled(models.AbstractModel):
|
||||||
_name = "base.usability.installed"
|
_name = "base.usability.installed"
|
||||||
|
|
||||||
|
|
||||||
formatLang_original = report_sxw.rml_parse.formatLang
|
formatLang_original = misc.formatLang
|
||||||
|
|
||||||
|
def formatLang(self, value, digits=None, grouping=True, monetary=False,
|
||||||
def formatLang(
|
dp=False, currency_obj=False, int_no_digits=True):
|
||||||
self, value, digits=None, date=False, date_time=False, grouping=True,
|
|
||||||
monetary=False, dp=False, currency_obj=False, int_no_digits=True):
|
|
||||||
with api.Environment.manage():
|
with api.Environment.manage():
|
||||||
env = api.Environment(self.cr, self.uid, {})
|
env = api.Environment(self.cr, self.uid, {})
|
||||||
if (
|
if (
|
||||||
@@ -30,9 +27,9 @@ def formatLang(
|
|||||||
digits = 0
|
digits = 0
|
||||||
dp = False
|
dp = False
|
||||||
res = formatLang_original(
|
res = formatLang_original(
|
||||||
self, value, digits=digits, date=date, date_time=date_time,
|
self, value, digits=digits, grouping=grouping, monetary=monetary,
|
||||||
grouping=grouping, monetary=monetary, dp=dp, currency_obj=currency_obj)
|
dp=dp, currency_obj=currency_obj)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
report_sxw.rml_parse.formatLang = formatLang
|
misc.formatLang = formatLang
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
|
||||||
base.access_res_country_group_user,Full access on res.country to Settings group,base.model_res_country,base.group_system,1,1,1,1
|
|
||||||
base.access_res_country_state_group_user,Full access on res.country.state to Settings group,base.model_res_country_state,base.group_system,1,1,1,1
|
|
||||||
base.access_res_country_group_group_user,Full access on res.country.group to Settings group,base.model_res_country_group,base.group_system,1,1,1,1
|
|
||||||
base.access_res_partner_title_group_user,Full access on res.partner.title,base.model_res_partner_title,base.group_system,1,1,1,1
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
# Copyright 2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user