udpate base chinese

This commit is contained in:
ivan deng
2023-02-10 14:53:21 +08:00
parent 070a45004b
commit 0b871bb647
15 changed files with 157 additions and 40 deletions

View File

@@ -18,7 +18,7 @@
{
'name': "App base chinese中国化基本模块增强",
'version': '14.21.03.22',
'version': '14.23.02.02',
'author': 'Sunpop.cn',
'category': 'Base',
'website': 'https://www.sunpop.cn',
@@ -49,6 +49,7 @@
12. 翻译导出默认中文默认po
13. 在 base 模型增加 name_en_US 字段,赋值后同时改翻译值
14. 常用小数精度调整
15. 销售团队改为中国
21. todo:中文演示数据(只有demo模式才加载)
""",
'pre_init_hook': 'pre_init_hook',
@@ -56,6 +57,7 @@
'depends': [
'app_base',
'account',
'sales_team',
'stock',
],
'images': ['static/description/banner.jpg'],
@@ -65,6 +67,7 @@
'views/sale_order_views.xml',
'views/account_move_views.xml',
'views/ir_default_views.xml',
'views/menu_views.xml',
'views/templates.xml',
'wizard/sale_make_invoice_advance_views.xml',
'data/ir_default_data.xml',
@@ -76,6 +79,7 @@
'data/product_data.xml',
'data/product_pricelist_data.xml',
'data/stock_location_data.xml',
'data/sales_team_data.xml',
],
'demo': [
],

View File

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

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- <record id="sales_team.team_sales_department" model="crm.team">-->
<!-- <field name="name">中国</field>-->
<!-- </record>-->
<function model="crm.team" name="write">
<value model="crm.team" eval="obj().env.ref('sales_team.team_sales_department').id"/>
<value eval="{
'name': '中国',
}"/>
</function>
</data>
</odoo>

View File

@@ -0,0 +1,7 @@
id,name
stock.stock_location_locations_partner,往来单位
stock.stock_location_customers,客户区位
stock.stock_location_suppliers,供应商区位
stock.stock_location_locations,物理区位
stock.stock_location_locations_virtual,虚拟区位
stock.stock_location_inter_wh,内部中转区位
1 id name
2 stock.stock_location_locations_partner 往来单位
3 stock.stock_location_customers 客户区位
4 stock.stock_location_suppliers 供应商区位
5 stock.stock_location_locations 物理区位
6 stock.stock_location_locations_virtual 虚拟区位
7 stock.stock_location_inter_wh 内部中转区位

View File

@@ -1,31 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="stock.removal_fifo" model="product.removal">
<record id="stock.removal_fifo" model="product.removal" context="{'lang': 'zh_CN'}">
<field name="name">先进先出(FIFO)</field>
</record>
<record id="stock.removal_lifo" model="product.removal">
<record id="stock.removal_lifo" model="product.removal" context="{'lang': 'zh_CN'}">
<field name="name">后进先出(LIFO)</field>
</record>
</data>
<data noupdate="0">
<record id="stock.stock_location_locations" model="stock.location">
<field name="name">物理区位</field>
</record>
<record id="stock.stock_location_locations_partner" model="stock.location">
<field name="name">往来单位</field>
</record>
<record id="stock.stock_location_locations_virtual" model="stock.location">
<field name="name">虚拟区位</field>
</record>
<record id="stock.stock_location_suppliers" model="stock.location">
<field name="name">供应商区位</field>
</record>
<record id="stock.stock_location_customers" model="stock.location">
<field name="name">客户区位</field>
</record>
<record id="stock.stock_location_inter_wh" model="stock.location">
<field name="name">内部中转区位</field>
</record>
<function model="stock.location" name="write" context="{'lang': 'zh_CN'}">
<value eval="[ref('stock.stock_location_locations', False)]"/>
<value model="stock.location" eval="{
'name': '物理区位',
}"/>
</function>
<function model="stock.location" name="write" context="{'lang': 'zh_CN'}">
<value eval="[ref('stock.stock_location_locations_partner', False)]"/>
<value model="stock.location" eval="{
'name': '往来单位',
}"/>
</function>
<function model="stock.location" name="write" context="{'lang': 'zh_CN'}">
<value eval="[ref('stock.stock_location_locations_virtual', False)]"/>
<value model="stock.location" eval="{
'name': '虚拟区位',
}"/>
</function>
<function model="stock.location" name="write" context="{'lang': 'zh_CN'}">
<value eval="[ref('stock.stock_location_suppliers', False)]"/>
<value model="stock.location" eval="{
'name': '供应商区位',
}"/>
</function>
<function model="stock.location" name="write" context="{'lang': 'zh_CN'}">
<value eval="[ref('stock.stock_location_customers', False)]"/>
<value model="stock.location" eval="{
'name': '客户区位',
}"/>
</function>
<function model="stock.location" name="write" context="{'lang': 'zh_CN'}">
<value eval="[ref('stock.stock_location_inter_wh', False)]"/>
<value model="stock.location" eval="{
'name': '中转区位',
}"/>
</function>
<!-- 几个特殊区位处理-->
<function model="res.company" name="_adjust_wh_cn_name"/>
</data>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<data noupdate="1">
<!--
Resource: res.partner.category
-->

View File

@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<data noupdate="0">
<data noupdate="01>
<record id="base.res_partner_address_1" model="res.partner">
<field name="image" type="base64" file="base/static/img/res_partner_address_1-image.png"/>

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from . import res_company
from . import res_partner
from . import res_currency
from . import product_category

View File

@@ -7,11 +7,24 @@ from odoo.exceptions import UserError, ValidationError
class ResCompany(models.Model):
_inherit = 'res.company'
short_name = fields.Char('Short Name', related='partner_id.short_name', readonly=False)
# 当传参 show_short_company 时,只显示简称
def name_get(self):
if self._context.get('show_short_company'):
return [(value.id, "%s" % (value.short_name if value.short_name else value.name)) for value in self]
else:
return super().name_get()
@api.model
def _adjust_wh_cn_name(self):
companys = self.env['res.company'].with_context(active_test=False, lang='zh_CN').search([])
for rec in companys:
# 修正区位名称
ids = self.env['stock.location'].with_context(active_test=False).search(
[('name', 'like', ': Transit Location'), ('company_id', '=', rec.id)])
ids.write({'name': '%s: 中转区位' % rec.name})
ids = self.env['stock.location'].with_context(active_test=False).search(
[('name', 'like', ': Scrap'), ('company_id', '=', rec.id)])
ids.write({'name': '%s: 报废区位' % rec.name})
ids = self.env['stock.location'].with_context(active_test=False).search(
[('name', 'like', ': Inventory adjustment'), ('company_id', '=', rec.id)])
ids.write({'name': '%s: 盘点区位' % rec.name})
# 注意,原生没有在生产中使用 _
ids = self.env['stock.location'].with_context(active_test=False).search([
('name', 'like', ': Production'), ('company_id', '=', rec.id)])
ids.write({'name': '%s: 生产区位' % rec.name})
ids = self.env['stock.location'].with_context(active_test=False).search([
('name', 'like', ': Subcontracting Location'), ('company_id', '=', rec.id)])
ids.write({'name': '%s: 委外区位' % rec.name})

View File

@@ -26,7 +26,7 @@ class ResCurrency(models.Model):
xflag = value
value = abs(value)
# 先把value 数字进行格式化保留两位小数,转成字符串然后去除小数点
nums = map(int, list(str('%0.2f' % value).replace('.', '')))
nums = list(map(int, list(str('%0.2f' % value).replace('.', ''))))
words = []
zflag = 0 # 标记连续0次数以删除万字或适时插入零字
start = len(nums) - 3

View File

@@ -15,5 +15,31 @@
</field>
</record>
<!--名称优化-->
<record id="account.action_move_out_invoice_type" model="ir.actions.act_window" context="{'lang': 'zh_CN'}">
<field name="name">应收发票</field>
</record>
<record id="account.action_move_out_refund_type" model="ir.actions.act_window" context="{'lang': 'zh_CN'}">
<field name="name">应收退款-红字发票</field>
</record>
<record id="account.action_move_out_receipt_type" model="ir.actions.act_window" context="{'lang': 'zh_CN'}">
<field name="name">应收收据(无销售订单)</field>
</record>
<record id="account.action_account_payments" model="ir.actions.act_window" context="{'lang': 'zh_CN'}">
<field name="name">应收支付</field>
</record>
<record id="account.action_move_in_invoice_type" model="ir.actions.act_window" context="{'lang': 'zh_CN'}">
<field name="name">应付账单</field>
</record>
<record id="account.action_move_in_refund_type" model="ir.actions.act_window" context="{'lang': 'zh_CN'}">
<field name="name">应付退款</field>
</record>
<record id="account.action_move_in_receipt_type" model="ir.actions.act_window" context="{'lang': 'zh_CN'}">
<field name="name">应付收据(无采购订单)</field>
</record>
<record id="account.action_account_payments_payable" model="ir.actions.act_window" context="{'lang': 'zh_CN'}">
<field name="name">应付支付</field>
</record>
</data>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<data>
<!-- currency视图, tree -->
<record id="app_view_currency_tree" model="ir.ui.view">
<field name="name">app.res.currency.tree</field>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="account.menu_action_move_out_invoice_type" model="ir.ui.menu" context="{'lang': 'zh_CN'}">
<field name="name">应收发票</field>
</record>
<record id="account.menu_action_move_out_refund_type" model="ir.ui.menu" context="{'lang': 'zh_CN'}">
<field name="name">应收退款-红字发票</field>
</record>
<record id="account.menu_action_move_out_receipt_type" model="ir.ui.menu" context="{'lang': 'zh_CN'}">
<field name="name">应收收据(无销售订单)</field>
</record>
<record id="account.menu_action_account_payments_receivable" model="ir.ui.menu" context="{'lang': 'zh_CN'}">
<field name="name">应收支付</field>
</record>
<record id="account.menu_action_move_in_invoice_type" model="ir.ui.menu" context="{'lang': 'zh_CN'}">
<field name="name">应付账单</field>
</record>
<record id="account.menu_action_move_in_refund_type" model="ir.ui.menu" context="{'lang': 'zh_CN'}">
<field name="name">应付退款</field>
</record>
<record id="account.menu_action_move_in_receipt_type" model="ir.ui.menu" context="{'lang': 'zh_CN'}">
<field name="name">应付收据(无采购订单)</field>
</record>
<record id="account.menu_action_account_payments_payable" model="ir.ui.menu" context="{'lang': 'zh_CN'}">
<field name="name">应付支付</field>
</record>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<data>
<!-- currency视图, tree -->
<record id="app_ir_default_tree_view" model="ir.ui.view">
<field name="name">app.ir.default tree view</field>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<data>
<!-- Partner Form视图用继承方式改写2018-11-21,ivan -->
<record id="app_view_partner_form" model="ir.ui.view">
<field name="name">app.res.partner.form</field>
@@ -55,6 +55,9 @@
<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">
<field name="category_id" widget="many2many_tags"/>
</xpath>
<!-- res.partner联系人 kanban -->
<!-- 显示类型和地址等 -->
<xpath expr="//field[@name='child_ids']//kanban[1]//templates//field[@name='name']" position="before">
@@ -62,6 +65,7 @@
</xpath>
<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.category_id and record.category_id.raw_value"><field name="category_id" widget="many2many_tags"/></div>
</xpath>
</field>
</record>
@@ -113,7 +117,7 @@
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='email']" position="after">
<field name="category_id" optional="show"/>
<field name="category_id" widget="many2many_tags" optional="show"/>
</xpath>
</field>
</record>