Skip to content
Snippets Groups Projects
Commit 13ee5596 authored by Foram Katharotiya's avatar Foram Katharotiya Committed by Yannick Tivisse
Browse files

[IMP] base: Adapt address format for Japan.

Purpose
=======

ja_JP: the implemented language font in Odoo is not Japanese but Chinese.

In Japan address structure is different:
First: Postal code
Next: City +  ward (like a neighbourhoos name)
Next: Building (all buildings have names)
Name: Customer or Company

Specification
===========

New address structure for Japan:
%(zip)s
%(state_name)s %(city)s
%(street)s
%(street2)s
%(country_name)s

In Countries form view, add one selection field which set the customer name position in reports base on the customer country settings.
parent a5a10e75
No related branches found
No related tags found
No related merge requests found
<odoo>
<template id="contact_name">
<div t-if="'name' in fields">
<t t-if="object.name">
<span itemprop="name" t-esc="name"/>
</t>
<t t-if="not object.name and object.parent_name">
<span itemprop="name" t-esc="object.parent_name"/>
</t>
<div t-if="options.get('country_image') and 'country_id' in fields and object.country_id and object.country_id.image">
<span t-field="object.country_id.image" t-options='{"widget": "image", "class": "country_flag"}'/>
</div>
</div>
</template>
<template id="contact">
<address t-ignore="true" class="mb0" itemscope="itemscope" itemtype="http://schema.org/Organization">
<div t-if="not (('name' in fields) or (address and 'address' in fields) or (city and 'city' in fields) or (mobile and 'mobile' in fields) or (fax and 'fax' in fields) or (website and 'website' in fields) or (email and 'email' in fields))" class="css_non_editable_mode_hidden">
--<span class="text-muted" t-esc="name"/>--
</div>
<div t-if="'name' in fields">
<t t-if="object.name">
<span itemprop="name" t-esc="name"/>
</t>
<t t-if="not object.name and object.parent_name">
<span itemprop="name" t-esc="object.parent_name"/>
</t>
<t t-if="options.get('country_image') and 'country_id' in fields and object.country_id and object.country_id.image">
<span t-field="object.country_id.image" t-options='{"widget": "image", "class": "country_flag"}'/>
</t>
</div>
<t t-if="object.country_id.name_position != 'after'">
<t t-call="base.contact_name"/>
</t>
<div itemprop="address" itemscope="itemscope" itemtype="http://schema.org/PostalAddress">
<div t-if="address and 'address' in fields">
<i t-if="not options.get('no_marker')" class='fa fa-map-marker'/> <span itemprop="streetAddress" t-raw="address.replace('\n', options.get('no_tag_br') and ', ' or ('&lt;br/&gt;%s' % ('' if options.get('no_marker') else '&amp;nbsp; &amp;nbsp; ')))"/>
......@@ -33,6 +38,9 @@
</div>
<div t-if="email and 'email' in fields"><i t-if="not options.get('no_marker')" class='fa fa-envelope'/> <span itemprop="email" t-esc="email"/></div>
</div>
<t t-if="object.country_id and object.country_id.name_position == 'after'">
<t t-call="base.contact_name"/>
</t>
</address>
</template>
</odoo>
......@@ -59,6 +59,11 @@ class Country(models.Model):
country_group_ids = fields.Many2many('res.country.group', 'res_country_res_country_group_rel',
'res_country_id', 'res_country_group_id', string='Country Groups')
state_ids = fields.One2many('res.country.state', 'country_id', string='States')
name_position = fields.Selection([
('before', 'Before Address'),
('after', 'After Address'),
], string="Customer Name Position", default="before",
help="Determines where the customer/company name should be placed, i.e. after or before the address.")
_sql_constraints = [
('name_uniq', 'unique (name)',
......
......@@ -804,6 +804,8 @@
<field name="code">jp</field>
<field file="base/static/img/country_flags/jp.png" name="image" type="base64" />
<field name="currency_id" ref="JPY" />
<field name="address_format" eval="'%(zip)s\n%(state_name)s %(city)s\n%(street)s\n%(street2)\n%(country_name)s'"/>
<field name="name_position">after</field>
<field eval="81" name="phone_code" />
</record>
<record id="ke" model="res.country">
......
......@@ -37,6 +37,7 @@
<div colspan="2" class="text-muted">Choose a subview of partners that includes only address fields, to change the way users can input addresses.</div>
<field name="address_format" placeholder="Address format..."/>
<div colspan="2" name="div_address_format" class="text-muted">Change the way addresses are displayed in reports</div>
<field name="name_position"/>
</group>
</group>
<label for="state_ids"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment