diff --git a/app_base_chinese/views/res_partner_views.xml b/app_base_chinese/views/res_partner_views.xml index 25ab25d2..44649121 100644 --- a/app_base_chinese/views/res_partner_views.xml +++ b/app_base_chinese/views/res_partner_views.xml @@ -133,7 +133,7 @@ - + diff --git a/app_contacts_superbar/views/res_partner_views.xml b/app_contacts_superbar/views/res_partner_views.xml index 1fbd7723..515e3e94 100644 --- a/app_contacts_superbar/views/res_partner_views.xml +++ b/app_contacts_superbar/views/res_partner_views.xml @@ -1,27 +1,27 @@ - - - - res.partner.select.superbar - res.partner - - - - - - - - - - - - - - - - - - - - + + + + res.partner.select.superbar + res.partner + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app_mixin_name_en/__init__.py b/app_mixin_name_en/__init__.py new file mode 100644 index 00000000..0190a7f5 --- /dev/null +++ b/app_mixin_name_en/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- + +from .hooks import pre_init_hook +from .hooks import post_init_hook +from . import controllers +from . import models +from . import ir +from . import res \ No newline at end of file diff --git a/app_mixin_name_en/__manifest__.py b/app_mixin_name_en/__manifest__.py new file mode 100644 index 00000000..11964107 --- /dev/null +++ b/app_mixin_name_en/__manifest__.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +# Created on 2018-11-05 +# author: 广州尚鹏,https://www.sunpop.cn +# email: 300883@qq.com +# resource of Sunpop +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +# Odoo在线中文用户手册(长期更新) +# https://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html + +# Odoo10离线中文用户手册下载 +# https://www.sunpop.cn/odoo10_user_manual_document_offline/ +# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备) +# https://www.sunpop.cn/odoo10_developer_document_offline/ +# description: + + +{ + 'name': "mixin english name,增加英文名字段", + 'version': '13.20.05.11', + 'author': 'Sunpop.cn', + 'category': 'Base', + 'website': 'https://www.sunpop.cn', + 'license': 'LGPL-3', + 'sequence': 2, + 'price': 0, + 'currency': 'EUR', + 'summary': """ + Chinese enhance. Out of the box use in china. + Set all chinese default value. + Add quick set of english name. + Default country, timezone, currency, partner... + """, + 'description': """ + + odoo Chinese Enhance. 中国化增强-基础 + 1. mixin, 增加英文名字段, 自动设定lang=en_US的名称为英文名 + 2 + """, + 'pre_init_hook': 'pre_init_hook', + 'post_init_hook': 'post_init_hook', + 'depends': [ + 'base', + ], + 'images': ['static/description/banner.jpg'], + 'data': [ + 'views/res_partner_views.xml', + ], + 'demo': [ + ], + 'test': [ + ], + 'css': [ + ], + 'qweb': [ + ], + 'js': [ + ], + 'installable': True, + 'application': True, + 'auto_install': False, +} diff --git a/app_mixin_name_en/controllers/__init__.py b/app_mixin_name_en/controllers/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/app_mixin_name_en/controllers/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/app_mixin_name_en/hooks.py b/app_mixin_name_en/hooks.py new file mode 100644 index 00000000..519e6004 --- /dev/null +++ b/app_mixin_name_en/hooks.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +# Created on 2017-11-22 +# author: 广州尚鹏,https://www.sunpop.cn +# email: 300883@qq.com +# resource of Sunpop +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +# Odoo在线中文用户手册(长期更新) +# https://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html + +# Odoo10离线中文用户手册下载 +# https://www.sunpop.cn/odoo10_user_manual_document_offline/ +# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备) +# https://www.sunpop.cn/odoo10_developer_document_offline/ +# description: + +from odoo import api, SUPERUSER_ID, _ + + +def pre_init_hook(cr): + """ + 数据初始化,只在安装时执行,更新时不执行 + """ + pass + + +def post_init_hook(cr, registry): + """ + 数据初始化,只在安装后执行,更新时不执行 + """ + try: + env = api.Environment(cr, SUPERUSER_ID, {}) + ids = env['product.category'].sudo().with_context(lang='zh_CN').search([ + ('parent_id', '!=', False) + ], order='complete_name') + for rec in ids: + rec._compute_complete_name() + ids = env['stock.location'].sudo().with_context(lang='zh_CN').search([ + ('location_id', '!=', False), + ('usage', '!=', 'views'), + ], order='complete_name') + for rec in ids: + rec._compute_complete_name() + # 超级用户改时区为中国 + ids = env['res.users'].sudo().with_context(lang='zh_CN').browse([1, 2]) + ids.write({'tz': "Asia/Shanghai"}) + except Exception as e: + raise Warning(e) + +def uninstall_hook(cr, registry): + """ + 数据初始化,卸载时执行 + """ + pass \ No newline at end of file diff --git a/app_mixin_name_en/i18n/zh_CN.po b/app_mixin_name_en/i18n/zh_CN.po new file mode 100644 index 00000000..6a18bc84 --- /dev/null +++ b/app_mixin_name_en/i18n/zh_CN.po @@ -0,0 +1,130 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * app_base_chinese +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-04-10 18:20+0000\n" +"PO-Revision-Date: 2020-04-10 18:20+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: app_base_chinese +#: model:ir.model.fields,field_description:app_base_chinese.field_account_tax_group__active +msgid "Active" +msgstr "激活" + +#. module: app_base_chinese +#: model:ir.model,name:app_base_chinese.model_base +msgid "Base" +msgstr "基础" + +#. module: app_base_chinese +#: model:ir.model.fields,field_description:app_base_chinese.field_product_category__complete_name +msgid "Complete Name" +msgstr "完整名称" + +#. module: app_base_chinese +#: model:ir.model,name:app_base_chinese.model_res_partner +msgid "Contact" +msgstr "联系人" + +#. module: app_base_chinese +#: model_terms:ir.ui.view,arch_db:app_base_chinese.app_res_partner_kanban_view +msgid "Credit:" +msgstr "信用额:" + +#. module: app_base_chinese +#: model:ir.model,name:app_base_chinese.model_res_currency +msgid "Currency" +msgstr "币种" + +#. module: app_base_chinese +#: model:ir.model.fields,help:app_base_chinese.field_res_currency__sequence +msgid "Determine the display order. Sort ascending." +msgstr "决定显示顺序,数字越小排序越前" + +#. module: app_base_chinese +#: model:ir.model.fields,field_description:app_base_chinese.field_res_partner__name_en_US +#: model:ir.model.fields,field_description:app_base_chinese.field_res_users__name_en_US +msgid "English Name" +msgstr "英文名" + +#. module: app_base_chinese +#: model_terms:ir.ui.view,arch_db:app_base_chinese.app_view_sale_advance_payment_inv +msgid "FaPiao / Invoice Orders" +msgstr "创建收据/发票" + +#. module: app_base_chinese +#: model:ir.model.fields,field_description:app_base_chinese.field_res_partner__fax +#: model:ir.model.fields,field_description:app_base_chinese.field_res_users__fax +msgid "Fax" +msgstr "传真" + +#. module: app_base_chinese +#: model:ir.model.fields,field_description:app_base_chinese.field_stock_location__complete_name +msgid "Full Location Name" +msgstr "完整的位置名称" + +#. module: app_base_chinese +#: model:ir.model,name:app_base_chinese.model_stock_location +msgid "Inventory Locations" +msgstr "库存位置" + +#. module: app_base_chinese +#: model_terms:ir.ui.view,arch_db:app_base_chinese.app_view_order_form +msgid "Invoices/FaPiao" +msgstr "收据/发票" + +#. module: app_base_chinese +#: model_terms:ir.ui.view,arch_db:app_base_chinese.app_view_order_form +msgid "Make Collections" +msgstr "收款" + +#. module: app_base_chinese +#: model:ir.model.fields,field_description:app_base_chinese.field_res_partner__name +#: model:ir.model.fields,field_description:app_base_chinese.field_res_users__name +msgid "Name" +msgstr "名称" + +#. module: app_base_chinese +#: model_terms:ir.ui.view,arch_db:app_base_chinese.app_view_move_form +msgid "Post Entry" +msgstr "过帐" + +#. module: app_base_chinese +#: model:ir.model,name:app_base_chinese.model_product_category +msgid "Product Category" +msgstr "品类" + +#. module: app_base_chinese +#: model:ir.model.fields,field_description:app_base_chinese.field_res_currency__sequence +msgid "Sequence" +msgstr "单号规则" + +#. module: app_base_chinese +#: model:ir.model.fields,help:app_base_chinese.field_account_tax_group__active +msgid "Set active to false to hide the tax without removing it." +msgstr "请不要删除指定税率,可以将其归档。" + +#. module: app_base_chinese +#: model:ir.model.fields,field_description:app_base_chinese.field_res_partner__short_name +#: model:ir.model.fields,field_description:app_base_chinese.field_res_users__short_name +msgid "Short Name" +msgstr "简称" + +#. module: app_base_chinese +#: model:ir.model,name:app_base_chinese.model_account_tax_group +msgid "Tax Group" +msgstr "税组" + +#. module: app_base_chinese +#: model:ir.sequence,name:app_base_chinese.sequence_product_category_normal +msgid "产品目录常规编号规则" +msgstr "" diff --git a/app_mixin_name_en/ir/__init__.py b/app_mixin_name_en/ir/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/app_mixin_name_en/ir/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/app_mixin_name_en/models/__init__.py b/app_mixin_name_en/models/__init__.py new file mode 100644 index 00000000..79f9bac3 --- /dev/null +++ b/app_mixin_name_en/models/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- + +from . import mixin_name_en +from . import res_partner + + diff --git a/app_mixin_name_en/models/mixin_name_en.py b/app_mixin_name_en/models/mixin_name_en.py new file mode 100644 index 00000000..4f45a74d --- /dev/null +++ b/app_mixin_name_en/models/mixin_name_en.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +import logging + +from odoo import api, fields, models, _ + +_logger = logging.getLogger(__name__) + + +class MixinNameEn(models.AbstractModel): + _name = 'mixin.name.en' + _description = 'Mixin Auto english name' + + # name_en_US 只要某个模型有此字段,且放在界面上,就会进行此处理 + # 无此字段不处理 + + name_en_US = fields.Char('English Name') + + # create_multi 中不可用,因为须先 create 再写 lang=en_US的值 + # todo: 在 ir.translation 中处理以提高性能, 或反向写回 + + @api.model + def create(self, vals): + name_field = self._fields.get("name") + name_en_US = None + + if name_field and name_field.translate and name_field.type in ["char", "text"] and 'name_en_US' in vals and vals.get('name_en_US'): + name_en_US = vals.get('name_en_US') + rec = super(MixinNameEn, self).create(vals) + if name_en_US and self.env.lang != 'en_US': + try: + rec.with_context(lang='en_US').write(dict(name=name_en_US)) + except Exception as e: + pass + return rec + + def write(self, vals): + name_field = self._fields.get("name") + name_en_US = None + if name_field and name_field.translate and name_field.type in ["char", "text"] and 'name_en_US' in vals and vals.get('name_en_US'): + name_en_US = vals.get('name_en_US') + rec = super(MixinNameEn, self).write(vals) + if name_en_US and self.env.lang != 'en_US': + try: + self.with_context(lang='en_US').write(dict(name=name_en_US)) + except Exception as e: + pass + return rec diff --git a/app_mixin_name_en/models/res_partner.py b/app_mixin_name_en/models/res_partner.py new file mode 100644 index 00000000..5f1720a8 --- /dev/null +++ b/app_mixin_name_en/models/res_partner.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- + +from odoo import api, models, fields, _ +from odoo.exceptions import UserError, ValidationError + + +class ResPartner(models.Model): + _name = 'res.partner' + + _inherit = ['mixin.name.en'] diff --git a/app_mixin_name_en/report/__init__.py b/app_mixin_name_en/report/__init__.py new file mode 100644 index 00000000..633f8661 --- /dev/null +++ b/app_mixin_name_en/report/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- + diff --git a/app_mixin_name_en/res/__init__.py b/app_mixin_name_en/res/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/app_mixin_name_en/res/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/app_mixin_name_en/static/description/banner.jpg b/app_mixin_name_en/static/description/banner.jpg new file mode 100644 index 00000000..ae2ca114 Binary files /dev/null and b/app_mixin_name_en/static/description/banner.jpg differ diff --git a/app_mixin_name_en/static/description/cnreadme.jpg b/app_mixin_name_en/static/description/cnreadme.jpg new file mode 100644 index 00000000..c53583f6 Binary files /dev/null and b/app_mixin_name_en/static/description/cnreadme.jpg differ diff --git a/app_mixin_name_en/static/description/icon.png b/app_mixin_name_en/static/description/icon.png new file mode 100644 index 00000000..22cbd278 Binary files /dev/null and b/app_mixin_name_en/static/description/icon.png differ diff --git a/app_mixin_name_en/static/description/index.html b/app_mixin_name_en/static/description/index.html new file mode 100644 index 00000000..3f59ff52 --- /dev/null +++ b/app_mixin_name_en/static/description/index.html @@ -0,0 +1,99 @@ +
+
+
+

App base chinese. Local customize for china user

+

Set all chinese default value. Like Default country, timezone, currency, partner...

+
+

Lastest update: v13.20.04.11

+
+ +
+
+
+ Key features: +
    +
  • + + Chinese feature enhance. +
  • +
  • + + Set Default country, state, timezone, currency. +
  • +
  • + + Set partner to chinese format. +
  • +
  • + + Fix Category Display not in english bug. +
  • +
+
+
+
+ +
+
+
+
+
+ +
+
+

Set Default country, state, timezone, currency.

+
+ +
+
+ +
+
+
+ +
+
+

Fix Category Display not in english bug.

+
+ +
+
+
+ +
+
+
+

Technical Help & Support

+
+
+
+

+ For any type of technical help & support requests, Feel free to contact us

+ + guohuadeng@hotmail.com +

+ Via QQ: 300883 (App user would not get QQ or any other IM support. Only for odoo project customize.)

+ + 300883@qq.com +
+
+

+ Visit our website for more support.

+ + https://www.sunpop.cn +
+
+
+
+

More Powerful addons, Make your odoo very easy to use, easy customize: + Supop.cn Odoo Addons +

+
+
+ diff --git a/app_mixin_name_en/static/src/scss/app_style.scss b/app_mixin_name_en/static/src/scss/app_style.scss new file mode 100644 index 00000000..39bfb17d --- /dev/null +++ b/app_mixin_name_en/static/src/scss/app_style.scss @@ -0,0 +1,26 @@ +.o_form_view .o_address_format { + .o_address_country { + display: -webkit-inline-flex; + display: inline-flex; + width: 48%; + margin-right: 2%; + } +} +.o_form_view.o_form_editable .o_address_format { + div.o_address_state { + width: 50%; + margin-right: 0; + } + .o_address_city{ + width: 48%; + margin-right: 2%; + } + .o_address_city_id{ + width: 48%; + margin-right: 2%; + } + input.o_address_zip{ + width: 50%; + margin-right: 0; + } +} diff --git a/app_mixin_name_en/views/res_partner_views.xml b/app_mixin_name_en/views/res_partner_views.xml new file mode 100644 index 00000000..7205cea6 --- /dev/null +++ b/app_mixin_name_en/views/res_partner_views.xml @@ -0,0 +1,16 @@ + + + + + + app.res.partner.form + res.partner + + + + + + + + +