mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update app common
This commit is contained in:
@@ -133,7 +133,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"/>
|
||||
<field name="category_id" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- contact -->
|
||||
<!-- contact superbar -->
|
||||
<record id="view_res_partner_filter_superbar" model="ir.ui.view">
|
||||
<field name="name">res.partner.select.superbar</field>
|
||||
<field name="model">res.partner</field>
|
||||
|
||||
8
app_mixin_name_en/__init__.py
Normal file
8
app_mixin_name_en/__init__.py
Normal file
@@ -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
|
||||
63
app_mixin_name_en/__manifest__.py
Normal file
63
app_mixin_name_en/__manifest__.py
Normal file
@@ -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,
|
||||
}
|
||||
1
app_mixin_name_en/controllers/__init__.py
Normal file
1
app_mixin_name_en/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
55
app_mixin_name_en/hooks.py
Normal file
55
app_mixin_name_en/hooks.py
Normal file
@@ -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
|
||||
130
app_mixin_name_en/i18n/zh_CN.po
Normal file
130
app_mixin_name_en/i18n/zh_CN.po
Normal file
@@ -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 ""
|
||||
1
app_mixin_name_en/ir/__init__.py
Normal file
1
app_mixin_name_en/ir/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
6
app_mixin_name_en/models/__init__.py
Normal file
6
app_mixin_name_en/models/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import mixin_name_en
|
||||
from . import res_partner
|
||||
|
||||
|
||||
48
app_mixin_name_en/models/mixin_name_en.py
Normal file
48
app_mixin_name_en/models/mixin_name_en.py
Normal file
@@ -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
|
||||
10
app_mixin_name_en/models/res_partner.py
Normal file
10
app_mixin_name_en/models/res_partner.py
Normal file
@@ -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']
|
||||
2
app_mixin_name_en/report/__init__.py
Normal file
2
app_mixin_name_en/report/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
1
app_mixin_name_en/res/__init__.py
Normal file
1
app_mixin_name_en/res/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
BIN
app_mixin_name_en/static/description/banner.jpg
Normal file
BIN
app_mixin_name_en/static/description/banner.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
BIN
app_mixin_name_en/static/description/cnreadme.jpg
Normal file
BIN
app_mixin_name_en/static/description/cnreadme.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
app_mixin_name_en/static/description/icon.png
Normal file
BIN
app_mixin_name_en/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 162 KiB |
99
app_mixin_name_en/static/description/index.html
Normal file
99
app_mixin_name_en/static/description/index.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced" >
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">App base chinese. Local customize for china user </h2>
|
||||
<h3 class="oe_slogan">Set all chinese default value. Like Default country, timezone, currency, partner... </h3>
|
||||
<div class="oe_row">
|
||||
<h3>Lastest update: v13.20.04.11</h3>
|
||||
<div class="oe_span12">
|
||||
<img class="oe_demo oe_screenshot" src="banner.jpg">
|
||||
</div>
|
||||
<div class="oe_span12 oe_spaced">
|
||||
<div class="alert alert-info" style="padding:8px;font-weight: 300; font-size: 20px;">
|
||||
<i class="fa fa-hand-o-right"></i><b> Key features: </b>
|
||||
<ul class="list-unstyled">
|
||||
<li>
|
||||
<i class="fa fa-check-square-o text-primary"></i>
|
||||
Chinese feature enhance.
|
||||
</li>
|
||||
<li>
|
||||
<i class="fa fa-check-square-o text-primary"></i>
|
||||
Set Default country, state, timezone, currency.
|
||||
</li>
|
||||
<li>
|
||||
<i class="fa fa-check-square-o text-primary"></i>
|
||||
Set partner to chinese format.
|
||||
</li>
|
||||
<li>
|
||||
<i class="fa fa-check-square-o text-primary"></i>
|
||||
Fix Category Display not in english bug.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_span12">
|
||||
<img class="oe_demo oe_screenshot" src="cnreadme.jpg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<h4 class="oe_slogan">Set Default country, state, timezone, currency.</h4>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="demo1.jpg">
|
||||
</div>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="demo2.jpg">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<h4 class="oe_slogan">Fix Category Display not in english bug.</h4>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="demo3.jpg">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container oe_dark">
|
||||
<div class="oe_row oe_spaced text-center">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">Technical Help & Support</h2>
|
||||
</div>
|
||||
<div class="col-md-12 pad0">
|
||||
<div class="oe_mt16">
|
||||
<p><h4>
|
||||
For any type of technical help & support requests, Feel free to contact us</h4></p>
|
||||
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:guohuadeng@hotmail.com"><span
|
||||
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||
<i class="fa fa-envelope"></i> guohuadeng@hotmail.com</a>
|
||||
<p><h4>
|
||||
Via QQ: 300883 (App user would not get QQ or any other IM support. Only for odoo project customize.)</h4></p>
|
||||
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:300883@qq.com"><span
|
||||
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||
<i class="fa fa-envelope"></i> 300883@qq.com</a>
|
||||
</div>
|
||||
<div class="oe_mt16">
|
||||
<p><h4>
|
||||
Visit our website for more support.</h4></p>
|
||||
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||
class="btn btn-warning btn-lg" rel="nofollow" href="https://www.sunpop.cn" target="_blank"><span
|
||||
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||
<i class="fa fa-web"></i>https://www.sunpop.cn</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_row oe_spaced text-center">
|
||||
<h1>More Powerful addons, Make your odoo very easy to use, easy customize:
|
||||
<a class="btn btn-primary mb16" href="http://www.odoo.com/apps/modules/browse?author=Sunpop.cn">Supop.cn Odoo Addons</a>
|
||||
</h1>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
26
app_mixin_name_en/static/src/scss/app_style.scss
Normal file
26
app_mixin_name_en/static/src/scss/app_style.scss
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
16
app_mixin_name_en/views/res_partner_views.xml
Normal file
16
app_mixin_name_en/views/res_partner_views.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="0">
|
||||
<!-- Partner Form视图,用继承方式改写2018-11-21,ivan -->
|
||||
<record id="app_view_partner_form" model="ir.ui.view">
|
||||
<field name="name">app.res.partner.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='type']" position="after">
|
||||
<field name="name_en_US" attrs="{}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user