Merge branch '10.0'

This commit is contained in:
guohuadeng
2018-01-11 04:00:03 +08:00
23 changed files with 260 additions and 84 deletions

View File

@@ -44,6 +44,8 @@ You can config odoo, make it look like your own platform.
13. Change Powered by Odoo in login screen.(Please change '../views/app_odoo_customize_view.xml' #15) 13. Change Powered by Odoo in login screen.(Please change '../views/app_odoo_customize_view.xml' #15)
14. Quick delete test data in Apps: Sales/POS/Purchase/MRP/Inventory/Accounting/Message/Workflow etc. 14. Quick delete test data in Apps: Sales/POS/Purchase/MRP/Inventory/Accounting/Message/Workflow etc.
15. Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice... 15. Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice...
16. Fix odoo reload module translation bug while enable english language
17. Stop Odoo Auto Subscribe(Performance Improve)
This module can help to white label the Odoo. This module can help to white label the Odoo.
Also helpful for training and support for your odoo end-user. Also helpful for training and support for your odoo end-user.
@@ -51,7 +53,7 @@ The user can get the help document just by one click.
""", """,
'images': ['static/description/banner.png'], 'images': ['static/description/banner.png'],
'depends': ['web'], 'depends': ['web','mail'],
'data': [ 'data': [
'views/app_odoo_customize_view.xml', 'views/app_odoo_customize_view.xml',
'views/app_theme_config_settings_view.xml', 'views/app_theme_config_settings_view.xml',

View File

@@ -42,6 +42,10 @@
<field name="key">app_show_poweredby</field> <field name="key">app_show_poweredby</field>
<field name="value">False</field> <field name="value">False</field>
</record> </record>
<record id="app_stop_subscribe" model="ir.config_parameter">
<field name="key">app_stop_subscribe</field>
<field name="value">False</field>
</record>
<record id="app_documentation_url" model="ir.config_parameter"> <record id="app_documentation_url" model="ir.config_parameter">
<field name="key">app_documentation_url</field> <field name="key">app_documentation_url</field>

View File

@@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0+e-20171014\n" "Project-Id-Version: Odoo Server 10.0+e-20171107\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-19 20:57+0000\n" "POT-Creation-Date: 2018-01-10 11:41+0000\n"
"PO-Revision-Date: 2017-12-19 20:57+0000\n" "PO-Revision-Date: 2018-01-10 11:41+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -54,10 +54,15 @@ msgstr "基础模型数据"
msgid "Cancel" msgid "Cancel"
msgstr "取消" msgstr "取消"
#. module: app_odoo_customize
#: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_stop_subscribe
msgid "Check to stop Odoo Subscribe function"
msgstr "Check to stop Odoo Subscribe function"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_create_uid #: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_create_uid
msgid "Created by" msgid "Created by"
msgstr "创建" msgstr "创建"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_create_date #: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_create_date
@@ -151,7 +156,12 @@ msgstr "显示名称"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_app_documentation_url #: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_app_documentation_url
msgid "Documentation Url" msgid "Documentation Url"
msgstr "文档链接" msgstr "用户手册链接"
#. module: app_odoo_customize
#: model:ir.model,name:app_odoo_customize.model_mail_thread
msgid "Email Thread"
msgstr "Email线程"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_id #: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_id
@@ -166,7 +176,7 @@ msgstr "安装语言"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings #: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings
msgid "Inventory" msgid "Inventory"
msgstr "库" msgstr "库"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings #: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings
@@ -283,6 +293,11 @@ msgstr "显示分享Odoo"
msgid "Show Support" msgid "Show Support"
msgstr "显示支持" msgstr "显示支持"
#. module: app_odoo_customize
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_app_stop_subscribe
msgid "Stop Odoo Subscribe(Performance Improve)"
msgstr "停用Odoo自动订阅(提高性能)"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_app_support_url #: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_app_support_url
msgid "Support Url" msgid "Support Url"
@@ -297,17 +312,17 @@ msgstr "系统名称"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_enterprise #: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_enterprise
msgid "Uncheck to hide the Enterprise tag" msgid "Uncheck to hide the Enterprise tag"
msgstr "不勾选则不显示企业版标签" msgstr "Uncheck to hide the Enterprise tag"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_share #: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_share
msgid "Uncheck to hide the Odoo Share Dashboard" msgid "Uncheck to hide the Odoo Share Dashboard"
msgstr "不勾选则不显示odoo分享" msgstr "Uncheck to hide the Odoo Share Dashboard"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_poweredby #: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_poweredby
msgid "Uncheck to hide the Powered by text" msgid "Uncheck to hide the Powered by text"
msgstr "不勾选则不显示Powered by字样" msgstr "不勾选则不显示Odoo Powered by"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings #: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings
@@ -357,7 +372,7 @@ msgstr "启用后,会显示快速调试菜单"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings #: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings
msgid "White Label Setting" msgid "White Label Setting"
msgstr "个性化Odoo设置" msgstr "个性化odoo设置"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.model,name:app_odoo_customize.model_ir_ui_view #: model:ir.model,name:app_odoo_customize.model_ir_ui_view
@@ -367,8 +382,8 @@ msgstr "ir.ui.view"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.actions.act_window,name:app_odoo_customize.action_app_theme_config #: model:ir.actions.act_window,name:app_odoo_customize.action_app_theme_config
#: model:ir.ui.menu,name:app_odoo_customize.menu_app_theme_config #: model:ir.ui.menu,name:app_odoo_customize.menu_app_theme_config
msgid "odoo Customize" msgid "odooApp Customize"
msgstr "odoo 定制" msgstr "odooApp 定制"
#. module: app_odoo_customize #. module: app_odoo_customize
#: model:ir.ui.menu,name:app_odoo_customize.menu_app_group #: model:ir.ui.menu,name:app_odoo_customize.menu_app_group

View File

@@ -3,3 +3,4 @@
import ir_ui_view import ir_ui_view
import app_theme_config_settings import app_theme_config_settings
import base_language_install import base_language_install
import mail_thread

View File

@@ -24,6 +24,7 @@ class AppThemeConfigSettings(models.TransientModel):
app_show_enterprise = fields.Boolean('Show Enterprise Tag', help=u"Uncheck to hide the Enterprise tag") app_show_enterprise = fields.Boolean('Show Enterprise Tag', help=u"Uncheck to hide the Enterprise tag")
app_show_share = fields.Boolean('Show Share Dashboard', help=u"Uncheck to hide the Odoo Share Dashboard") app_show_share = fields.Boolean('Show Share Dashboard', help=u"Uncheck to hide the Odoo Share Dashboard")
app_show_poweredby = fields.Boolean('Show Powered by Odoo', help=u"Uncheck to hide the Powered by text") app_show_poweredby = fields.Boolean('Show Powered by Odoo', help=u"Uncheck to hide the Powered by text")
app_stop_subscribe = fields.Boolean('Stop Odoo Subscribe(Performance Improve)', help=u"Check to stop Odoo Subscribe function")
app_documentation_url = fields.Char('Documentation Url') app_documentation_url = fields.Char('Documentation Url')
app_documentation_dev_url = fields.Char('Developer Documentation Url') app_documentation_dev_url = fields.Char('Developer Documentation Url')
@@ -45,6 +46,7 @@ class AppThemeConfigSettings(models.TransientModel):
app_show_enterprise = True if ir_config.get_param('app_show_enterprise') == "True" else False app_show_enterprise = True if ir_config.get_param('app_show_enterprise') == "True" else False
app_show_share = True if ir_config.get_param('app_show_share') == "True" else False app_show_share = True if ir_config.get_param('app_show_share') == "True" else False
app_show_poweredby = True if ir_config.get_param('app_show_poweredby') == "True" else False app_show_poweredby = True if ir_config.get_param('app_show_poweredby') == "True" else False
app_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
app_documentation_url = ir_config.get_param('app_documentation_url', app_documentation_url = ir_config.get_param('app_documentation_url',
default='http://www.sunpop.cn/documentation/user/10.0/en/index.html') default='http://www.sunpop.cn/documentation/user/10.0/en/index.html')
@@ -64,6 +66,8 @@ class AppThemeConfigSettings(models.TransientModel):
app_show_enterprise=app_show_enterprise, app_show_enterprise=app_show_enterprise,
app_show_share=app_show_share, app_show_share=app_show_share,
app_show_poweredby=app_show_poweredby, app_show_poweredby=app_show_poweredby,
app_stop_subscribe=app_stop_subscribe,
app_documentation_url=app_documentation_url, app_documentation_url=app_documentation_url,
app_documentation_dev_url=app_documentation_dev_url, app_documentation_dev_url=app_documentation_dev_url,
app_support_url=app_support_url, app_support_url=app_support_url,
@@ -85,6 +89,7 @@ class AppThemeConfigSettings(models.TransientModel):
ir_config.set_param("app_show_enterprise", self.app_show_enterprise or "False") ir_config.set_param("app_show_enterprise", self.app_show_enterprise or "False")
ir_config.set_param("app_show_share", self.app_show_share or "False") ir_config.set_param("app_show_share", self.app_show_share or "False")
ir_config.set_param("app_show_poweredby", self.app_show_poweredby or "False") ir_config.set_param("app_show_poweredby", self.app_show_poweredby or "False")
ir_config.set_param("app_stop_subscribe", self.app_stop_subscribe or "False")
ir_config.set_param("app_documentation_url", ir_config.set_param("app_documentation_url",
self.app_documentation_url or "http://www.sunpop.cn/documentation/user/10.0/en/index.html") self.app_documentation_url or "http://www.sunpop.cn/documentation/user/10.0/en/index.html")

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Jarvis (www.odoomod.com)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

View File

@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Jarvis (www.odoomod.com)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models, _
class MailThread(models.AbstractModel):
_inherit = "mail.thread"
@api.multi
def message_subscribe(self, partner_ids=None, channel_ids=None, subtype_ids=None, force=True):
""" 停用订阅功能. """
ir_config = self.env['ir.config_parameter']
app_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
if app_stop_subscribe:
return
else:
return super(MailThread, self).message_subscribe(partner_ids, channel_ids, subtype_ids, force)
@api.multi
def message_auto_subscribe(self, updated_fields, values=None):
""" 停用订阅功能. """
ir_config = self.env['ir.config_parameter']
app_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
if app_stop_subscribe:
return
else:
return super(MailThread, self).message_auto_subscribe(updated_fields, values)
@api.multi
def _message_auto_subscribe_notify(self, partner_ids):
""" 停用订阅功能. """
ir_config = self.env['ir.config_parameter']
app_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
if app_stop_subscribe:
return
else:
return super(MailThread, self)._message_auto_subscribe_notify(partner_ids)

View File

@@ -18,6 +18,7 @@ You can config odoo, make it look like your own platform.
14. Quick delete test data in Apps: Sales/POS/Purchase/MRP/Inventory/Accounting/Message/Workflow etc. 14. Quick delete test data in Apps: Sales/POS/Purchase/MRP/Inventory/Accounting/Message/Workflow etc.
15. Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice... 15. Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice...
16. Fix odoo reload module translation bug while enable english language 16. Fix odoo reload module translation bug while enable english language
17. Stop Odoo Auto Subscribe(Performance Improve)
This module can help to white label the Odoo. This module can help to white label the Odoo.
Also helpful for training and support for your odoo end-user. Also helpful for training and support for your odoo end-user.
The user can get the help document just by one click. The user can get the help document just by one click.
@@ -42,7 +43,8 @@ http://www.sunpop.cn
13. 自定义登陆界面中的 Powered by Odoo 13. 自定义登陆界面中的 Powered by Odoo
14. 快速删除测试数据,支持模块包括:销售/POS门店/采购/生产/库存/会计/消息与工作流等. 14. 快速删除测试数据,支持模块包括:销售/POS门店/采购/生产/库存/会计/消息与工作流等.
15. 将各类单据的序号重置从1开始包括SO/PO/MO/Invoice 等 15. 将各类单据的序号重置从1开始包括SO/PO/MO/Invoice 等
16. 修复odoo启用英文后模块显示的Bug 16. 修复odoo启用英文后模块显示中文的Bug
17. 可停用odoo自动订阅功能避免“同样对象关注2次”bug同时提升性能
使用方法:将解压后的 app_odoo_customize 放到 odoo的 addons目录下激活开发者模式应用-->更新应用列表, 使用方法:将解压后的 app_odoo_customize 放到 odoo的 addons目录下激活开发者模式应用-->更新应用列表,
找到 "App odoo Customize"模块,安装即可。 找到 "App odoo Customize"模块,安装即可。

View File

@@ -7,23 +7,23 @@
Online Documentation Access,Quick Data Clear. </p> Online Documentation Access,Quick Data Clear. </p>
<br> <br>
<ul> <ul>
<li>1.Deletes Odoo label in footer</li> <li>1. Deletes Odoo label in footer</li>
<li>2.Replaces "Odoo" in Windows title</li> <li>2. Replaces "Odoo" in Windows title</li>
<li>3.Customize Documentation, Support, About links and title in usermenu</li> <li>3. Customize Documentation, Support, About links and title in usermenu</li>
<li>4.Adds "Developer mode" link to the top right-hand User Menu.</li> <li>4. Adds "Developer mode" link to the top right-hand User Menu.</li>
<li>5.Adds Quick Language Switcher to the top right-hand User Menu.</li> <li>5. Adds Quick Language Switcher to the top right-hand User Menu.</li>
<li>6.Adds Country flags to the top right-hand User Menu.</li> <li>6. Adds Country flags to the top right-hand User Menu.</li>
<li>7.Adds English and Chinese user documentation access to the top right-hand User Menu.</li> <li>7. Adds English and Chinese user documentation access to the top right-hand User Menu.</li>
<li>8.Adds developer documentation access to the top right-hand User Menu.</li> <li>8. Adds developer documentation access to the top right-hand User Menu.</li>
<li>9.Customize "My odoo.com account" button</li> <li>9. Customize "My odoo.com account" button</li>
<li>10.Standalone setting panel, easy to setup.</li> <li>10. Standalone setting panel, easy to setup.</li>
<li>11.Provide 236 country flags.</li> <li>11. Provide 236 country flags.</li>
<li>12.Multi-language Support.</li> <li>12. Multi-language Support.</li>
<li>13.Change Powered by Odoo in login screen.(Please change '../views/app_odoo_customize_view.xml' #15)</li> <li>13. Change Powered by Odoo in login screen.(Please change '../views/app_odoo_customize_view.xml' #15)</li>
<li>14.Quick delete test data in Apps: Sales/POS/Purchase/MRP/Inventory/Accounting/Base Models.</li> <li>14. Quick delete test data in Apps: Sales/POS/Purchase/MRP/Inventory/Accounting/Base Models.</li>
<li>15.Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice...</li> <li>15. Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice...</li>
<li>16.Fix odoo reload module translation bug while enable english language <li>16. Fix odoo reload module translation bug while enable english language</li>
</li> <li>17. Stop Odoo Auto Subscribe(Performance Improve)</li>
</ul> </ul>
<p> <p>
This module can help to white label the Odoo. This module can help to white label the Odoo.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -60,6 +60,10 @@
<field name="app_show_poweredby"/> <field name="app_show_poweredby"/>
<label for="app_show_poweredby"/> <label for="app_show_poweredby"/>
</div> </div>
<div>
<field name="app_stop_subscribe"/>
<label for="app_stop_subscribe"/>
</div>
</div> </div>
</group> </group>
<group string="User Menu Content"> <group string="User Menu Content">
@@ -137,7 +141,7 @@
</record> </record>
<record id="action_app_theme_config" model="ir.actions.act_window"> <record id="action_app_theme_config" model="ir.actions.act_window">
<field name="name">odoo Customize</field> <field name="name">odooApp Customize</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">app.theme.config.settings</field> <field name="res_model">app.theme.config.settings</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<!-- 更新序号规则 Auto Internal Reference. -->
<!-- 所有的 All Products. -->
<record id="seq_product_auto" model="ir.sequence">
<field name="name">Sequence for All Products</field>
<field name="code">product.product</field>
<field name="prefix">P%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- 制造的成品 manufactured Products. -->
<record id="seq_manufacture" model="ir.sequence">
<field name="name">Sequence for Manufactured Product</field>
<field name="code">product.product</field>
<field name="prefix">D%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- 制造的原料 Components.-->
<record id="seq_component" model="ir.sequence">
<field name="name">Sequence for Components Product</field>
<field name="code">product.product</field>
<field name="prefix">C%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- 采购的成品 Sourced Products.-->
<record id="seq_sourced" model="ir.sequence">
<field name="name">Sequence for Sourced Product</field>
<field name="code">product.product</field>
<field name="prefix">S%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- internal_type 数据-->
<record id="internal_type_manufacture" model="product.internal.type">
<field name="name">Manufactured Product</field>
<field name="description">Set prefix as "D" in link sequence</field>
<field name="link_sequence" ref="seq_manufacture"/>
</record>
<record id="internal_type_sourced" model="product.internal.type">
<field name="name">Sourced Product</field>
<field name="description">Set prefix as "S" in link sequence</field>
<field name="link_sequence" ref="seq_sourced"/>
</record>
<record id="internal_type_component" model="product.internal.type">
<field name="name">Components Product</field>
<field name="description">Set prefix as "C" in link sequence</field>
<field name="link_sequence" ref="seq_component"/>
</record>
<!--设置产品默认值为制造产品-->
<record id="product_internal_type_default" model="ir.values">
<field name="name">internal_type</field>
<field name="model">product.template</field>
<field name="key">default</field>
<field name="key2"></field>
<field name="company_id" ref="base.main_company"/>
<field name="value" eval="'I' + str(ref('app_product_sequence.internal_type_manufacture'))+'\n.'"/>
</record>
</data>
</odoo>

View File

@@ -15,7 +15,7 @@
# http://www.sunpop.cn/odoo10_developer_document_offline/ # http://www.sunpop.cn/odoo10_developer_document_offline/
# description: # description:
{ {
'name': 'App Product Internal Type,Auto Sequence, Auto Code(Variants Supported)', 'name': 'App Product Internal Type,Auto Sequence, Auto Code(Variants Supported), Auto Attributes',
'summary': 'Auto Internal Reference.', 'summary': 'Auto Internal Reference.',
"version": '10.0.2.2', "version": '10.0.2.2',
'category': 'Sales', 'category': 'Sales',
@@ -30,7 +30,7 @@
'currency': 'EUR', 'currency': 'EUR',
'price': 98, 'price': 98,
'description': u""" 'description': u"""
App Product Auto Sequence, Auto Code(Variants Supported) App Product Auto Sequence, Auto Code(Variants Supported), Auto Attributes
This module allows to associate a sequence to the product reference.<br/> This module allows to associate a sequence to the product reference.<br/>
The reference (default code) is unique (SQL constraint) and required.<br/> The reference (default code) is unique (SQL constraint) and required.<br/>
@@ -41,7 +41,8 @@
4.Define different product type, each product type use own rule of sequence.可自定义产品类型,不同产品类型使用不同编码规则。 4.Define different product type, each product type use own rule of sequence.可自定义产品类型,不同产品类型使用不同编码规则。
5.Quick access in sale , inventory, system menu.可以在销售、库存、系统菜单中快速定义。 5.Quick access in sale , inventory, system menu.可以在销售、库存、系统菜单中快速定义。
6.Multi language support.<br/>多语种支持。 6.Multi language support.<br/>多语种支持。
7.Setup default Auto Sequence for each product category 7.Setup default Auto Sequence for each product category,自动设置每个产品目录使用的产品编码规则
8.Auto setup product attribute lik Sale/Purchase, Stockable/Consumable/Service, Stock Routes. 自动设置产品的销售/采购,可库存产品/服务/消耗品,购买/制造/按订单生成等库存路线
""", """,
'pre_init_hook': 'pre_init_hook', 'pre_init_hook': 'pre_init_hook',
'depends': [ 'depends': [

View File

@@ -6,7 +6,7 @@
<record id="seq_product_auto" model="ir.sequence"> <record id="seq_product_auto" model="ir.sequence">
<field name="name">Sequence for All Products</field> <field name="name">Sequence for All Products</field>
<field name="code">product.product</field> <field name="code">product.product</field>
<field name="prefix">P%(y)s%(month)s</field> <field name="prefix">PR%(y)s%(month)s</field>
<field name="padding">5</field> <field name="padding">5</field>
<field name="company_id" eval="False"/> <field name="company_id" eval="False"/>
<field name="initial">True</field> <field name="initial">True</field>
@@ -42,12 +42,11 @@
<record id="seq_sourced_product" model="ir.sequence"> <record id="seq_sourced_product" model="ir.sequence">
<field name="name">Sequence for Sourced Product</field> <field name="name">Sequence for Sourced Product</field>
<field name="code">product.product</field> <field name="code">product.product</field>
<field name="prefix">CL%(y)s%(month)s</field> <field name="prefix">WL%(y)s%(month)s</field>
<field name="padding">5</field> <field name="padding">5</field>
<field name="company_id" eval="False"/> <field name="company_id" eval="False"/>
<field name="initial">True</field> <field name="initial">True</field>
</record> </record>
<!-- internal_type 数据--> <!-- internal_type 数据-->
<!--[(4, ref('purchase.route_warehouse0_buy')),(4, ref('mrp.route_warehouse0_manufacture')),(4, ref('stock.route_warehouse0_mto'))]--> <!--[(4, ref('purchase.route_warehouse0_buy')),(4, ref('mrp.route_warehouse0_manufacture')),(4, ref('stock.route_warehouse0_mto'))]-->
<!--成品--> <!--成品-->
@@ -58,7 +57,7 @@
<field name="type">product</field> <field name="type">product</field>
<field name="sale_ok">1</field> <field name="sale_ok">1</field>
<field name="purchase_ok">0</field> <field name="purchase_ok">0</field>
<field name="route_ids" eval="[(6,0, [ref('mrp.route_warehouse0_manufacture'),ref('stock.route_warehouse0_mto')])]"/> <field name="route_ids" eval="[(6,0, [ref('mrp.route_warehouse0_manufacture')])]"/>
<field name="description">Set prefix as "CP" in link sequence</field> <field name="description">Set prefix as "CP" in link sequence</field>
<field name="link_sequence" ref="seq_mrp_product"/> <field name="link_sequence" ref="seq_mrp_product"/>
</record> </record>
@@ -70,7 +69,7 @@
<field name="type">product</field> <field name="type">product</field>
<field name="sale_ok">0</field> <field name="sale_ok">0</field>
<field name="purchase_ok">0</field> <field name="purchase_ok">0</field>
<field name="route_ids" eval="[(6,0, [ref('mrp.route_warehouse0_manufacture'),ref('stock.route_warehouse0_mto')])]"/> <field name="route_ids" eval="[(6,0, [ref('mrp.route_warehouse0_manufacture')])]"/>
<field name="description">Set prefix as "BJ" in link sequence</field> <field name="description">Set prefix as "BJ" in link sequence</field>
<field name="link_sequence" ref="seq_mrp_component"/> <field name="link_sequence" ref="seq_mrp_component"/>
</record> </record>
@@ -82,7 +81,7 @@
<field name="type">product</field> <field name="type">product</field>
<field name="sale_ok">0</field> <field name="sale_ok">0</field>
<field name="purchase_ok">1</field> <field name="purchase_ok">1</field>
<field name="route_ids" eval="[(6,0, [ref('purchase.route_warehouse0_buy'),ref('stock.route_warehouse0_mto')])]"/> <field name="route_ids" eval="[(6,0, [ref('purchase.route_warehouse0_buy')])]"/>
<field name="description">Set prefix as "BC" in link sequence</field> <field name="description">Set prefix as "BC" in link sequence</field>
<field name="link_sequence" ref="seq_sourced_material"/> <field name="link_sequence" ref="seq_sourced_material"/>
</record> </record>
@@ -94,7 +93,7 @@
<field name="type">product</field> <field name="type">product</field>
<field name="sale_ok">1</field> <field name="sale_ok">1</field>
<field name="purchase_ok">1</field> <field name="purchase_ok">1</field>
<field name="route_ids" eval="[(6,0, [ref('purchase.route_warehouse0_buy'),ref('stock.route_warehouse0_mto')])]"/> <field name="route_ids" eval="[(6,0, [ref('purchase.route_warehouse0_buy')])]"/>
<field name="description">Set prefix as "CL" in link sequence</field> <field name="description">Set prefix as "CL" in link sequence</field>
<field name="link_sequence" ref="seq_sourced_product"/> <field name="link_sequence" ref="seq_sourced_product"/>
</record> </record>
@@ -123,13 +122,13 @@
<!--这个默认值可以不用因为在onchange事件会设置很多值--> <!--这个默认值可以不用因为在onchange事件会设置很多值-->
<!--设置产品默认值为制造成品--> <!--设置产品默认值为制造成品-->
<record id="product_internal_type_default" model="ir.values"> <!--<record id="product_internal_type_default" model="ir.values">-->
<field name="name">internal_type</field> <!--<field name="name">internal_type</field>-->
<field name="model">product.template</field> <!--<field name="model">product.template</field>-->
<field name="key">default</field> <!--<field name="key">default</field>-->
<field name="key2"></field> <!--<field name="key2"></field>-->
<field name="company_id" ref="base.main_company"/> <!--<field name="company_id" ref="base.main_company"/>-->
<field name="value" eval="'I' + str(ref('internal_type_mrp_product'))+'\n.'"/> <!--<field name="value" eval="'I' + str(ref('internal_type_mrp_product'))+'\n.'"/>-->
</record> <!--</record>-->
</data> </data>
</odoo> </odoo>

View File

@@ -24,7 +24,7 @@ def pre_init_hook(cr):
:return: void :return: void
""" """
cr.execute("UPDATE product_product " cr.execute("UPDATE product_product "
"SET default_code = '!!DP!!' || id " "SET default_code = '!!PR!!' || id "
"WHERE default_code IS NULL OR default_code = 'New';") "WHERE default_code IS NULL OR default_code = 'New';")
cr.execute("UPDATE product_template " cr.execute("UPDATE product_template "

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Created on 2017-11-05 # Created on 2017-01-09
# author: 广州尚鹏http://www.sunpop.cn # author: 广州尚鹏http://www.sunpop.cn
# email: 300883@qq.com # email: 300883@qq.com
# resource of Sunpop # resource of Sunpop
@@ -24,13 +24,26 @@ class ProductProduct(models.Model):
default_code_index = fields.Integer('Internal Reference Index', readonly=True) default_code_index = fields.Integer('Internal Reference Index', readonly=True)
# todo: 检查数据,要保证数据唯一性 # todo: 检查数据,要保证数据唯一性
# 为免报错,不限制唯一性
_sql_constraints = [ _sql_constraints = [
('uniq_default_code', ('uniq_default_code',
'unique(default_code)', 'unique(default_code)',
'The reference must be unique'), 'The reference must be unique'),
] ]
@api.model
def default_get(self, fields):
context = self._context or {}
res = super(ProductProduct, self).default_get(fields)
# 内部编码类型默认值的录入
if context.get("default_internal_type"):
self._onchange_internal_type()
elif context.get("default_internal_type_ref"):
types = self.env['product.internal.type'].search_read([('ref', '=', context.get("default_internal_type_ref"))], limit=1)
if types:
res.update({'internal_type':types[0]['id']})
self._onchange_internal_type()
return res
@api.model @api.model
def create(self, vals): def create(self, vals):
# todo: but 先建空白产品后编辑2个以上变体序号会少个 -1 # todo: but 先建空白产品后编辑2个以上变体序号会少个 -1
@@ -63,7 +76,7 @@ class ProductProduct(models.Model):
# 有属性值了,自己是第一个规格 # 有属性值了,自己是第一个规格
code_index = 1 code_index = 1
vals['default_code_index'] = code_index vals['default_code_index'] = code_index
vals['default_code'] = code_stored + '-%03d'%(code_index) vals['default_code'] = code_stored + '#%03d'%(code_index)
elif mylen == 1: elif mylen == 1:
# 已存在1个当存在的1个有属性时要改已存在的product值 # 已存在1个当存在的1个有属性时要改已存在的product值
code_index = template.product_variant_ids[:1].default_code_index code_index = template.product_variant_ids[:1].default_code_index
@@ -71,24 +84,24 @@ class ProductProduct(models.Model):
if code_index == 0: if code_index == 0:
code_index = 1 code_index = 1
template.product_variant_ids[:1].default_code_index = code_index template.product_variant_ids[:1].default_code_index = code_index
template.product_variant_ids[:1].default_code = code_stored + '-%03d'%(code_index) template.product_variant_ids[:1].default_code = code_stored + '#%03d'%(code_index)
# 接着改当前操作的product值 # 接着改当前操作的product值
code_index = code_index + 1 code_index = code_index + 1
vals['default_code_index'] = code_index vals['default_code_index'] = code_index
vals['default_code'] = code_stored + '-%03d'%(code_index) vals['default_code'] = code_stored + '#%03d'%(code_index)
elif mylen > 1: elif mylen > 1:
# 找到最大的序号 # 找到最大的序号
variant_max = max(template.product_variant_ids,key=lambda x: x['default_code_index']) variant_max = max(template.product_variant_ids,key=lambda x: x['default_code_index'])
code_index = variant_max['default_code_index'] + 1 code_index = variant_max['default_code_index'] + 1
vals['default_code_index'] = code_index vals['default_code_index'] = code_index
vals['default_code'] = code_stored + '-%03d'%(code_index) vals['default_code'] = code_stored + '#%03d'%(code_index)
else: else:
# 当按模板 # 当按模板
# 此条件常规不出现,但特殊项目会有 # 此条件常规不出现,但特殊项目会有
variant_max = max(template.product_variant_ids,key=lambda x: x['default_code_index']) variant_max = max(template.product_variant_ids,key=lambda x: x['default_code_index'])
code_index = variant_max['default_code_index'] + 1 code_index = variant_max['default_code_index'] + 1
vals['default_code_index'] = code_index vals['default_code_index'] = code_index
vals['default_code'] = code_stored + '-%03d'%(code_index) vals['default_code'] = code_stored + '#%03d'%(code_index)
else: else:
# create from product_product # create from product_product
# 默认使用制造成品的编码 # 默认使用制造成品的编码

View File

@@ -36,6 +36,20 @@ class ProductTemplate(models.Model):
default_code_stored = fields.Char('Internal Reference Stored', default_code_stored = fields.Char('Internal Reference Stored',
default=lambda self: _('New')) default=lambda self: _('New'))
@api.model
def default_get(self, fields):
context = self._context or {}
res = super(ProductTemplate, self).default_get(fields)
# 内部编码类型默认值的录入
if context.get("default_internal_type"):
self._onchange_internal_type()
elif context.get("default_internal_type_ref"):
types = self.env['product.internal.type'].search_read([('ref', '=', context.get("default_internal_type_ref"))], limit=1)
if types:
res.update({'internal_type':types[0]['id']})
self._onchange_internal_type()
return res
@api.model @api.model
def create(self, vals): def create(self, vals):
if 'attribute_line_ids' in vals: if 'attribute_line_ids' in vals:

View File

@@ -1,6 +1,6 @@
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<div class="oe_row oe_padded"> <div class="oe_row oe_padded">
<h2 class="oe_slogan" style="color:#875A7B;">App Product Auto Sequence, Auto Code(Variants Supported)</h2> <h2 class="oe_slogan" style="color:#875A7B;"> App Product Auto Sequence, Auto Code(Variants Supported), Auto Attributes</h2>
<div> <div>
<p> <p>
This module allows to associate a sequence to the product reference.<br/> This module allows to associate a sequence to the product reference.<br/>
@@ -26,7 +26,16 @@
<li> <li>
Multi language support. Multi language support.
</li> </li>
<li>
Setup default Auto Sequence for each product category.
</li>
<li>
Auto setup product attribute lik Sale/Purchase, Stockable/Consumable/Service, Stock Routes.
</li>
</ul> </ul>
<div>
<img class="oe_picture oe_screenshot" src="set0.jpg">
</div>
<div> <div>
<img class="oe_picture oe_screenshot" src="set1.jpg"> <img class="oe_picture oe_screenshot" src="set1.jpg">
</div> </div>
@@ -49,13 +58,13 @@
Sepcial for variants. add [-00?]<br/> Sepcial for variants. add [-00?]<br/>
<ul> <ul>
<li> <li>
Products with color[red]: M20171100001-001 Products with color[red]: M20171100001#001
</li> </li>
<li> <li>
Products with color[blue]: M20171100001-002 Products with color[blue]: M20171100001#002
</li> </li>
<li> <li>
Products with color[white]: M20171100001-003 Products with color[white]: M20171100001#003
</li> </li>
</ul> </ul>
</p> </p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -1,22 +0,0 @@
App Product Auto Sequence, Auto Code(Variants Supported)
1.<2E>Զ<EFBFBD><D4B6><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>
2.<2E>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EBA3AC>ʽΪ <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>-001<30><31>
3.<2E><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>Ҫ<EFBFBD><D2AA>Ψһ<CEA8><D2BB>
4.<2E><><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>ͬ<EFBFBD><CDAC>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ʹ<EFBFBD>ò<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
5.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۡ<EFBFBD><DBA1><EFBFBD><EFBFBD>桢ϵͳ<CFB5>˵<EFBFBD><CBB5>п<EFBFBD><D0BF>ٶ<EFBFBD><D9B6>
6.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>֡<EFBFBD>
This module allows to associate a sequence to the product reference.<br/>
The reference (default code) is unique (SQL constraint) and required.<br/>
Support Product with or without Variants.
1.Auto Sequence or code for every product.<2E>Զ<EFBFBD><D4B6><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>
2.Auto Sequence or for every product variants, like product20171130-001.<2E>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EBA3AC>ʽΪ <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>-001<30><31>
3.Product code must be Unique.<2E><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>Ҫ<EFBFBD><D2AA>Ψһ<CEA8><D2BB>
4.Define different product type, each product type use own rule of sequence.<2E><><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>ͬ<EFBFBD><CDAC>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ʹ<EFBFBD>ò<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
5.Quick access in sale , inventory, system menu.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۡ<EFBFBD><DBA1><EFBFBD><EFBFBD>桢ϵͳ<CFB5>˵<EFBFBD><CBB5>п<EFBFBD><D0BF>ٶ<EFBFBD><D9B6>
6.Multi language support.<br/><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>֡<EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
http://www.sunpop.cn/product/app-product-auto-sequence-auto-codevariants-supported/

View File

@@ -0,0 +1,18 @@
App Product Auto Sequence, Auto Code(Variants Supported)
App Product Auto Sequence, Auto Code(Variants Supported), Auto Attributes
This module allows to associate a sequence to the product reference.<br/>
The reference (default code) is unique (SQL constraint) and required.<br/>
Support Product with or without Variants.
1.Auto Sequence or code for every product.自动产品编码。
2.Auto Sequence or for every product variants, like product20171130-001.自动多规格产品编码,形式为 主产品编码-001。
3.Product code must be Unique.产品编码强制要求唯一。
4.Define different product type, each product type use own rule of sequence.可自定义产品类型,不同产品类型使用不同编码规则。
5.Quick access in sale , inventory, system menu.可以在销售、库存、系统菜单中快速定义。
6.Multi language support.<br/>多语种支持。
7.Setup default Auto Sequence for each product category自动设置每个产品目录使用的产品编码规则
8.Auto setup product attribute lik Sale/Purchase, Stockable/Consumable/Service, Stock Routes. 自动设置产品的销售/采购,可库存产品/服务/消耗品,购买/制造/按订单生成等库存路线
http://www.sunpop.cn/product/app-product-auto-sequence-auto-codevariants-supported/