diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py
index b2ed22ba7d4..23b23563d44 100644
--- a/addons/crm/models/crm_lead.py
+++ b/addons/crm/models/crm_lead.py
@@ -10,8 +10,6 @@ from odoo.tools.translate import _
from odoo.tools import email_re, email_split
from odoo.exceptions import UserError, AccessError
-from odoo.addons.base.res.res_partner import FormatAddress
-
from . import crm_stage
_logger = logging.getLogger(__name__)
@@ -51,11 +49,11 @@ CRM_LEAD_FIELDS_TO_MERGE = [
'partner_name']
-class Lead(FormatAddress, models.Model):
+class Lead(models.Model):
_name = "crm.lead"
_description = "Lead/Opportunity"
_order = "priority desc,activity_date_deadline,id desc"
- _inherit = ['mail.thread', 'mail.activity.mixin', 'utm.mixin']
+ _inherit = ['mail.thread', 'mail.activity.mixin', 'utm.mixin', 'format.address.mixin']
_mail_mass_mailing = _('Leads / Opportunities')
def _default_probability(self):
@@ -311,15 +309,15 @@ class Lead(FormatAddress, models.Model):
return super(Lead, self.with_context(context)).copy(default=default)
@api.model
- def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
+ def _fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
if self._context.get('opportunity_id'):
opportunity = self.browse(self._context['opportunity_id'])
action = opportunity.get_formview_action()
if action.get('views') and any(view_id for view_id in action['views'] if view_id[1] == view_type):
view_id = next(view_id[0] for view_id in action['views'] if view_id[1] == view_type)
- res = super(Lead, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
+ res = super(Lead, self)._fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
if view_type == 'form':
- res['arch'] = self.fields_view_get_address(res['arch'])
+ res['arch'] = self._fields_view_get_address(res['arch'])
return res
# ----------------------------------------
diff --git a/addons/web/static/src/less/form_view.less b/addons/web/static/src/less/form_view.less
index 8ce02b636b3..a8422938b2e 100644
--- a/addons/web/static/src/less/form_view.less
+++ b/addons/web/static/src/less/form_view.less
@@ -433,7 +433,7 @@
}
}
&.o_form_editable .o_address_format {
- input.o_address_city {
+ .o_address_city {
width: 38%;
}
div.o_address_state {
diff --git a/odoo/addons/base/res/res_country.py b/odoo/addons/base/res/res_country.py
index 8b7f82d04b8..c36aaff8ad0 100644
--- a/odoo/addons/base/res/res_country.py
+++ b/odoo/addons/base/res/res_country.py
@@ -32,17 +32,27 @@ class Country(models.Model):
_description = 'Country'
_order = 'name'
- name = fields.Char(string='Country Name', required=True, translate=True, help='The full name of the country.')
- code = fields.Char(string='Country Code', size=2,
- help='The ISO country code in two chars. \nYou can use this field for quick search.')
- address_format = fields.Text(help="""You can state here the usual format to use for the \
-addresses belonging to this country.\n\nYou can use the python-style string patern with all the field of the address \
-(for example, use '%(street)s' to display the field 'street') plus
- \n%(state_name)s: the name of the state
- \n%(state_code)s: the code of the state
- \n%(country_name)s: the name of the country
- \n%(country_code)s: the code of the country""",
- default='%(street)s\n%(street2)s\n%(city)s %(state_code)s %(zip)s\n%(country_name)s')
+ name = fields.Char(
+ string='Country Name', required=True, translate=True, help='The full name of the country.')
+ code = fields.Char(
+ string='Country Code', size=2,
+ help='The ISO country code in two chars. \nYou can use this field for quick search.')
+ address_format = fields.Text(
+ help="Display format to use for addresses belonging to this country.\n\n"
+ "You can use python-style string pattern with all the fields of the address "
+ "(for example, use '%(street)s' to display the field 'street') plus"
+ "\n%(state_name)s: the name of the state"
+ "\n%(state_code)s: the code of the state"
+ "\n%(country_name)s: the name of the country"
+ "\n%(country_code)s: the code of the country",
+ default='%(street)s\n%(street2)s\n%(city)s %(state_code)s %(zip)s\n%(country_name)s')
+ address_view_id = fields.Many2one(
+ comodel_name='ir.ui.view', string="Address View",
+ domain=[('model', '=', 'res.partner'), ('type', '=', 'form')],
+ help="Use this field if you want to replace the usual way to encode a complete address. "
+ "Note that the address_format field is used to modify the way to display addresses "
+ "(in reports for example), while this field is used to modify the input form for "
+ "addresses.")
currency_id = fields.Many2one('res.currency', string='Currency')
image = fields.Binary(attachment=True)
phone_code = fields.Integer(string='Country Calling Code')
diff --git a/odoo/addons/base/res/res_country_view.xml b/odoo/addons/base/res/res_country_view.xml
index f5a40b540f3..4b7c2f5055f 100644
--- a/odoo/addons/base/res/res_country_view.xml
+++ b/odoo/addons/base/res/res_country_view.xml
@@ -20,6 +20,8 @@
res.country