fix chinese address

This commit is contained in:
ivan deng
2023-04-02 18:57:06 +08:00
parent efec723018
commit 7ae27d516e
4 changed files with 53 additions and 115 deletions

View File

@@ -56,6 +56,7 @@
'post_init_hook': 'post_init_hook', 'post_init_hook': 'post_init_hook',
'depends': [ 'depends': [
'app_base', 'app_base',
'base_address_extended',
'account', 'account',
'sales_team', 'sales_team',
'stock', 'stock',

View File

@@ -3,7 +3,9 @@
<data noupdate="1"> <data noupdate="1">
<!-- Country --> <!-- Country -->
<record id="base.cn" model="res.country"> <record id="base.cn" model="res.country">
<field name="enforce_cities" eval="True"/>
<field name="address_format" eval="'%(country_name)s%(state_name)s%(city)s%(street)s\n%(street2)s'"/> <field name="address_format" eval="'%(country_name)s%(state_name)s%(city)s%(street)s\n%(street2)s'"/>
<field name="address_view_id" ref="app_base_chinese.app_view_partner_form_chinese"/>
</record> </record>
</data> </data>
</odoo> </odoo>

View File

@@ -1,26 +1,27 @@
.o_form_view .o_address_format { .o_form_view .o_address_format.o_address_chinese {
.o_address_country { .o_address_country {
display: -webkit-inline-flex; display: -webkit-inline-flex;
display: inline-flex; display: inline-flex;
width: 48%; width: 38%;
margin-right: 2%; margin-right: 2%;
} }
} }
.o_form_view.o_form_editable .o_address_format {
div.o_address_state { .o_form_view .o_form_editable .o_address_format.o_address_chinese {
width: 50%; .o_address_zip{
margin-right: 0; width: 38%;
margin-right: 2%;
}
.o_address_state {
width: 38%;
margin-right: 2%;
} }
.o_address_city{ .o_address_city{
width: 48%; width: 38%;
margin-right: 2%; margin-right: 2%;
} }
.o_address_city_id{ .o_address_city_id{
width: 48%; width: 38%;
margin-right: 2%; margin-right: 2%;
} }
input.o_address_zip{
width: 50%;
margin-right: 0;
}
} }

View File

@@ -11,126 +11,59 @@
<!--<xpath expr="//field[@name='type']" position="after">--> <!--<xpath expr="//field[@name='type']" position="after">-->
<!--<xpath expr="//field[@name='ref']" position="move"/>--> <!--<xpath expr="//field[@name='ref']" position="move"/>-->
<!--</xpath>--> <!--</xpath>-->
<xpath expr="//field[@name='type']" position="after"> <xpath expr="//field[@name='function']" position="before">
<field name="short_name"/> <field name="short_name"/>
</xpath> </xpath>
<!-- 信用额度 --> <!--res.partner客户细节调整至 app_base_chinese_city 中处理 -->
<xpath expr="//field[@name='category_id']" position="after">
<field name="credit_limit"/>
</xpath>
<!--res.partner客户 地址中国化 -->
<xpath expr="//field[@name='street']" position="before"> <xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='country_id']" position="move"/> <xpath expr="//div[@name='partner_address_country']" position="move"/>
</xpath> </xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='state_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='city']" position="move"/>
</xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='zip']" position="move"/>
</xpath>
<!-- res.partner联系人 form -->
<!--联系人,如果是个人类型,不允许其下再有联系人-->
<!--调整,电商情况,一个人有多个地址-->
<!-- <xpath expr="//notebook/page[1]" position="attributes">-->
<!-- <attribute name="attrs">{'invisible': [('is_company','!=', True)]}</attribute>-->
<!-- </xpath>-->
<!-- 所有类型联系人都要填姓名 -->
<xpath expr="//page//field[@name='child_ids']//form[1]//field[@name='name']" position="attributes"> <xpath expr="//page//field[@name='child_ids']//form[1]//field[@name='name']" position="attributes">
<attribute name="required">1</attribute> <attribute name="required">1</attribute>
</xpath> </xpath>
<!-- 联系人也显示地址,中国格式 -->
<!--res.partner客户 地址中国化 -->
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='street']" position="before">
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='country_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='street']" position="before">
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='state_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='street']" position="before">
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='city']" position="move"/>
</xpath>
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='street']" position="before">
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='zip']" position="move"/>
</xpath>
<xpath expr="//field[@name='child_ids']//form[1]//field[@name='email']" position="before"> <xpath expr="//field[@name='child_ids']//form[1]//field[@name='email']" position="before">
<field name="category_id" widget="many2many_tags"/> <field name="category_id" widget="many2many_tags"/>
</xpath> </xpath>
<!-- res.partner联系人 kanban --> <!-- res.partner联系人 kanban -->
<!-- 显示类型和地址等 --> <!-- 显示类型和地址等 -->
<xpath expr="//field[@name='child_ids']//kanban[1]//templates//field[@name='name']" position="before"> <xpath expr="//field[@name='child_ids']//kanban[1]//templates//field[@name='name']" position="before">
<t t-if="record.ref and record.ref.raw_value">[<field name="ref"/>]</t> <t t-if="record.ref and record.ref.raw_value">[<field name="ref"/>]
</t>
</xpath> </xpath>
<xpath expr="//field[@name='child_ids']//kanban[1]//templates//field[@name='name']" position="after"> <xpath expr="//field[@name='child_ids']//kanban[1]//templates//field[@name='name']" position="after">
<div t-if="record.type and record.type.raw_value"><field name="type"/></div> <div t-if="record.type and record.type.raw_value">
<div t-if="record.category_id and record.category_id.raw_value"><field name="category_id" widget="many2many_tags"/></div> <field name="type"/>
</xpath> </div>
</field> <div t-if="record.category_id and record.category_id.raw_value">
</record>
<!--res.partner open地址中国化 -->
<record id="app_view_partner_address_form" model="ir.ui.view">
<field name="name">app.res.partner.form.address</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_address_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='country_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='state_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='city']" position="move"/>
</xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='zip']" position="move"/>
</xpath>
<xpath expr="//field[@name='website']" position="after">
<field name="category_id" widget="many2many_tags"/> <field name="category_id" widget="many2many_tags"/>
</div>
</xpath> </xpath>
</field> </field>
</record> </record>
<!--res.partner open地址中国化 --> <!-- 指定的中国地址格式-->
<record id="app_view_partner_short_form" model="ir.ui.view"> <record id="app_view_partner_form_chinese" model="ir.ui.view">
<field name="name">app.res.partner.form</field> <field name="name">app.res.partner.form.chinese</field>
<field name="model">res.partner</field> <field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/> <field name="priority" eval="900"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='street']" position="before"> <div class="o_address_format o_address_chinese">
<xpath expr="//field[@name='country_id']" position="move"/> <field name="country_enforce_cities" invisible="1"/>
</xpath> <field name="parent_id" invisible="1"/>
<xpath expr="//field[@name='street']" position="before"> <field name="type" invisible="1"/>
<xpath expr="//field[@name='state_id']" position="move"/> <div name="partner_address_country" class="d-flex">
</xpath> <field name="country_id" placeholder="Country" class="o_address_country"
<xpath expr="//field[@name='street']" position="before"> options="{&quot;no_open&quot;: True, &quot;no_create&quot;: True}"/>
<xpath expr="//field[@name='city']" position="move"/> <field name="zip" placeholder="ZIP" class="o_address_zip"/>
</xpath> </div>
<xpath expr="//field[@name='street']" position="before"> <field name="state_id" class="o_address_state" placeholder="State" options='{"no_open": True, "no_create": True}'
<xpath expr="//field[@name='zip']" position="move"/> context="{'country_id': country_id, 'default_country_id': country_id, 'zip': zip}"/>
</xpath> <field name="city_id" placeholder="City" class="o_address_city"
</field> options='{"no_open": True, "no_create": True}'
</record> context="{'default_country_id': country_id, 'default_state_id': state_id,}"/>
<!--res.partner 私人地址中国化 --> <field name="city" placeholder="City" invisible="1"/>
<record id="app_res_partner_view_form_private" model="ir.ui.view"> <field name="street" placeholder="Street..." class="o_address_street"/>
<field name="name">app.res.partner.view.form.private</field> <field name="street2" placeholder="Street 2..." class="o_address_street"/>
<field name="model">res.partner</field> </div>
<field name="inherit_id" ref="base.res_partner_view_form_private"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='country_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='state_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='city']" position="move"/>
</xpath>
<xpath expr="//field[@name='street']" position="before">
<xpath expr="//field[@name='zip']" position="move"/>
</xpath>
</field> </field>
</record> </record>
@@ -156,7 +89,8 @@
</xpath> </xpath>
<xpath expr="//div[hasclass('oe_kanban_details')]/div/ul" position="inside"> <xpath expr="//div[hasclass('oe_kanban_details')]/div/ul" position="inside">
<li t-if="record.credit_limit and record.credit_limit.raw_value"> <li t-if="record.credit_limit and record.credit_limit.raw_value">
Credit<field name="credit_limit"/> Credit
<field name="credit_limit"/>
</li> </li>
</xpath> </xpath>
</field> </field>