update common

This commit is contained in:
ivan deng
2020-09-05 18:01:07 +08:00
parent 418f4bc8ba
commit 386dc82b55
23 changed files with 539 additions and 1 deletions

7
app_common/__init__.py Normal file
View File

@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
from . import models
from . import controllers
from .hooks import pre_init_hook
from .hooks import post_init_hook
from .hooks import uninstall_hook

View File

@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
# Created on 20120-01-05
# author: 广州尚鹏https://www.sunpop.cn
# email: 300883@qq.com
# resource of Sunpop
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
# Odoo12在线用户手册长期更新
# https://www.sunpop.cn/documentation/user/12.0/zh_CN/index.html
# Odoo12在线开发者手册长期更新
# https://www.sunpop.cn/documentation/12.0/index.html
# Odoo10在线中文用户手册长期更新
# 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/
##############################################################################
# Copyright (C) 2009-TODAY Sunpop.cn Ltd. https://www.sunpop.cn
# Author: Ivan Deng300883@qq.com
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# See <http://www.gnu.org/licenses/>.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
##############################################################################
{
'name': "Sunpop Odooapp Common Func",
'version': '13.20.09.05',
'author': 'Sunpop.cn',
'category': 'Base',
'website': 'https://www.sunpop.cn',
'license': 'LGPL-3',
'sequence': 2,
'price': 0.00,
'currency': 'EUR',
'images': ['static/description/banner.png'],
'depends': [
'web',
],
'summary': '''
Core for common use
基础核心
''',
'description': '''
Support Odoo 1312, Enterprise and Community Edition
1.
2.
3. Multi-language Support.
4. Multi-Company Support.
5. Support Odoo 1312, Enterprise and Community Edition
==========
1.
2.
3. 多语言支持
4. 多公司支持
5. Odoo 13, 12, 企业版,社区版,多版本支持
''',
'data': [
# 'security/*.xml',
# 'security/ir.model.access.csv',
# 'data/.xml',
# 'views/.xml',
# 'report/.xml',
],
'qweb': [
'static/src/xml/*.xml',
],
'demo': [],
# 'pre_init_hook': 'pre_init_hook',
# 'post_init_hook': 'post_init_hook',
# 'uninstall_hook': 'uninstall_hook',
'installable': True,
'application': True,
'auto_install': False,
}

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
# from . import main

32
app_common/hooks.py Normal file
View File

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Created on 2018-10-12
# author: 广州尚鹏https://www.sunpop.cn
# email: 300883@qq.com
# resource of Sunpop
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
# 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
# cr.execute("")
def post_init_hook(cr, registry):
pass
# cr.execute("")
def uninstall_hook(cr, registry):
pass
# cr.execute("")

14
app_common/i18n/zh_CN.po Normal file
View File

@@ -0,0 +1,14 @@
# Translation of Odoo Server.
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-08 14:28+0000\n"
"PO-Revision-Date: 2018-01-08 14:28+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"

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Part of Sunpop.cn. See LICENSE file for full copyright and licensing details.
# Created on 2019-04-20
# author: 广州尚鹏http://www.sunpop.cn
# email: 300883@qq.com
# resource of Sunpop
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# Odoo12在线用户手册长期更新
# http://www.sunpop.cn/documentation/user/12.0/en/index.html
# Odoo12在线开发者手册长期更新
# http://www.sunpop.cn/documentation/12.0/index.html
# Odoo10在线中文用户手册长期更新
# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html
# Odoo10离线中文用户手册下载
# http://www.sunpop.cn/odoo10_user_manual_document_offline/
# Odoo10离线开发手册下载-含python教程jquery参考Jinja2模板PostgresSQL参考odoo开发必备
# http://www.sunpop.cn/odoo10_developer_document_offline/
# description:
from . import models

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
class BaseModelExtend(models.AbstractModel):
_name = 'basemodel.extend'
_description = 'Base Extend for Sunpop'
def _register_hook(self):
'''
Register method in BaseModel
如果 该 fieldname 是m2o的那么如果context没值就用该模型第一个
'''
@api.model
def _app_get_m2o_default(self, fieldname):
if hasattr(self, fieldname) and self._fields[fieldname].type == 'many2one':
if self._context.get(fieldname) or self._context.get('default_%s' % fieldname):
return self._context.get(fieldname) or self._context.get('default_%s' % fieldname)
else:
rec = self.env[self._fields[fieldname].comodel_name].search([], limit=1)
return rec.id if rec else False
return False
models.BaseModel._app_get_default = _app_get_m2o_default
return super(BaseModelExtend, self)._register_hook()

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- model权限 -->
<record id="acc_module" model="ir.model.access">
<field name="name">acc_module_user</field>
<field name="model_id" ref="model_app_order"/>
<field name="group_id" ref="base.group_user"/>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_unlink" eval="1"/>
</record>
<!-- 应用权限目录 -->
<record model="ir.module.category" id="app_module_category_1">
<field name="name">App...</field>
<field name="description">Helps you manage your ...</field>
<field name="sequence">8</field>
</record>
<!-- 权限用户 -->
<!-- 普通 -->
<record id="group_app_user" model="res.groups">
<field name="name">App User</field>
<field name="category_id" ref="app_module_category_1"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="comment">The user will be able to ...</field>
</record>
<!-- 管理员,可以配置 -->
<record id="group_app_admin" model="res.groups">
<field name="name">App Admin</field>
<field name="category_id" ref="app_module_category_1"/>
<field name="implied_ids" eval="[(4, ref('group_app_user'))]"/>
<field name="comment">The user will be able to config ...</field>
</record>
<!-- group_erp_manager自动有完整权限 -->
<record id="base.group_erp_manager" model="res.groups">
<field name="implied_ids" eval="[(4, ref('group_app_admin'))]"/>
</record>
<!-- Rules -->
<record id="rule_user" model="ir.rule">
<field name="name">Users are allowed to access their own m///</field>
<field name="model_id" ref="model_app_order"/>
<field name="domain_force">['|', ('partner_id', 'in', [user.partner_id.id]), ('user_id.id', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
</record>
<!--End -->
</data>
</odoo>

View File

@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_attribute_value_group_user,product_attribute_value_group.user,app_product_variant_pro.model_product_attribute_value_group,base.group_user,1,0,0,0
access_product_attribute_value_group_manager,product_attribute_value_group.manager,app_product_variant_pro.model_product_attribute_value_group,base.group_erp_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_product_attribute_value_group_user product_attribute_value_group.user app_product_variant_pro.model_product_attribute_value_group base.group_user 1 0 0 0
3 access_product_attribute_value_group_manager product_attribute_value_group.manager app_product_variant_pro.model_product_attribute_value_group base.group_erp_manager 1 1 1 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

@@ -0,0 +1,95 @@
<section class="oe_container">
<div class="oe_row oe_spaced" >
<div class="oe_span12">
<h2 class="oe_slogan"> </h2>
<h3 class="oe_slogan"> </h3>
<div class="oe_row">
<h3>Lastest update: v13.20.01.01</h3>
<div class="oe_span12">
<img class="oe_demo oe_screenshot" style="max-height: 100%;" src="banner.png">
</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>
Put key function here.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
3. Multi-language Support.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
4. Multi-Company Support.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
5. Support Odoo 1312, 11, Enterprise and Community Edition.
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">So Easy to navigator and search any data.</h1>
<h4 class="oe_slogan"> </h4>
<div class="oe_demo oe_screenshot">
<img src=".jpg"/>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">Multi-language Support..</h1>
<h4 class="oe_slogan"> </h4>
<div class="oe_demo oe_screenshot">
<img src="cnreadme.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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

View File

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="app_product_brand_search_view" model="ir.ui.view">
<field name="name">product.brand.search</field>
<field name="model">product.brand</field>
<field name="arch" type="xml">
<search string="Product Brand">
<field name="name"/>
<field name="partner_id"/>
</search>
</field>
</record>
<act_window
id="action_open_brand_products"
name="Brand Products"
res_model="product.template"
view_mode="kanban,form,tree"
domain="[('product_brand_id', '=', active_id)]"/>
<act_window
id="action_open_single_product_brand"
name="Product Brand"
res_model="product.brand"
view_mode="kanban,form,tree"
target="current"
domain="[('product_ids', 'in', active_id)]"/>
<record id="app_product_brand_form_view" model="ir.ui.view">
<field name="name">product.brand.form</field>
<field name="model">product.brand</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="%(action_open_brand_products)d"
type="action"
class="oe_stat_button"
icon="fa-cubes">
<field name="products_count" widget="statinfo" string="Products"/>
</button>
</div>
<field name="logo" widget="image" class="oe_avatar"/>
<div class="oe_title">
<label for="name" string="Brand Name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
</div>
<group>
<group>
<field name="partner_id"/>
</group>
</group>
<group string="Description">
<field name="description" nolabel="1"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="product_brand_tree_view" model="ir.ui.view">
<field name="name">product.brand.tree</field>
<field name="model">product.brand</field>
<field name="arch" type="xml">
<tree string="product.brand">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="description"/>
<field name="partner_id"/>
</tree>
</field>
</record>
<record id="product_brand_kanban_view" model="ir.ui.view">
<field name="name">product.brand.kanban</field>
<field name="model">product.brand</field>
<field name="arch" type="xml">
<kanban>
<field name="id"/>
<field name="logo"/>
<field name="products_count"/>
<field name="description"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img t-att-src="kanban_image('product.brand', 'logo', record.id.raw_value)" alt="Logo"/>
</div>
<div class="oe_kanban_details">
<h4>
<field name="name"/>
</h4>
<div>
<a name="%(action_open_brand_products)d" type="action">
<t t-esc="record.products_count.value"/> Products
</a>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record model="ir.actions.act_window" id="action_product_brand">
<field name="name">Brand</field>
<field name="res_model">product.brand</field>
<field name="view_mode">kanban,form,tree</field>
</record>
<menuitem id="menu_product_brand" name="Product Brands"
action="action_product_brand"
sequence="8"
parent="stock.menu_product_in_config_stock"/>
</odoo>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!--产品list可调整显示顺序-->
<record id="app_product_product_tree_view" model="ir.ui.view">
<field name="name">app.product.product.tree</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='type']" position="after">
<field name="abc_classification" widget="label_selection"
options="{'classes': {'a': 'danger', 'b': 'primary', 'c': 'default'}}"/>
</xpath>
</field>
</record>
<record id="product_product_action" model="ir.actions.act_window">
<field name="name">Product Manager</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">tree,form</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_product_template_search_brand" model="ir.ui.view">
<field name="name">product.template.search.brand</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="product_brand_id"/>
<filter string="Brand" name="groupby_brand" domain="[]"
context="{'group_by': 'product_brand_id'}"/>
<separator/>
</field>
</field>
</record>
<record id="product_template_form_brand_add" model="ir.ui.view">
<field name="name">product.template.product.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="sale_ok" position="before">
<field name="product_brand_id" placeholder="Brand"/>
<div/>
</field>
</field>
</record>
<record id="view_product_template_kanban_brand" model="ir.ui.view">
<field name="name">product kanban view add brand</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_kanban_details')]/strong[1]" position="after">
<div>
<a t-if="record.product_brand_id" type="action"
name="%(action_open_single_product_brand)d">
<field name="product_brand_id"/>
</a>
</div>
</xpath>
</field>
</record>
<record id="view_product_template_tree_brand" model="ir.ui.view">
<field name="name">product tree view add brand</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="product_brand_id"/>
</field>
</field>
</record>
</data>
</odoo>

View File