diff --git a/app_odoo_customize/__openerp__.py b/app_odoo_customize/__openerp__.py
index 62dd5a59..56110fb2 100644
--- a/app_odoo_customize/__openerp__.py
+++ b/app_odoo_customize/__openerp__.py
@@ -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)
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...
+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.
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'],
- 'depends': ['web'],
+ 'depends': ['web','mail'],
'data': [
'views/app_odoo_customize_view.xml',
'views/app_theme_config_settings_view.xml',
diff --git a/app_odoo_customize/data/ir_config_parameter.xml b/app_odoo_customize/data/ir_config_parameter.xml
index 9f4f7dcb..ede752c1 100644
--- a/app_odoo_customize/data/ir_config_parameter.xml
+++ b/app_odoo_customize/data/ir_config_parameter.xml
@@ -42,6 +42,10 @@
app_show_poweredbyFalse
+
+ app_stop_subscribe
+ False
+ app_documentation_url
diff --git a/app_odoo_customize/i18n/zh_CN.po b/app_odoo_customize/i18n/zh_CN.po
index 6c2a5b83..aea4159b 100644
--- a/app_odoo_customize/i18n/zh_CN.po
+++ b/app_odoo_customize/i18n/zh_CN.po
@@ -4,10 +4,10 @@
#
msgid ""
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"
-"POT-Creation-Date: 2017-12-19 20:57+0000\n"
-"PO-Revision-Date: 2017-12-19 20:57+0000\n"
+"POT-Creation-Date: 2018-01-10 11:41+0000\n"
+"PO-Revision-Date: 2018-01-10 11:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -54,10 +54,15 @@ msgstr "基础模型数据"
msgid "Cancel"
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
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_create_uid
msgid "Created by"
-msgstr "创建者"
+msgstr "创建人"
#. module: app_odoo_customize
#: 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
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_app_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
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_id
@@ -166,7 +176,7 @@ msgstr "安装语言"
#. module: app_odoo_customize
#: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings
msgid "Inventory"
-msgstr "仓库"
+msgstr "库存"
#. module: app_odoo_customize
#: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings
@@ -283,6 +293,11 @@ msgstr "显示分享Odoo"
msgid "Show Support"
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
#: model:ir.model.fields,field_description:app_odoo_customize.field_app_theme_config_settings_app_support_url
msgid "Support Url"
@@ -297,17 +312,17 @@ msgstr "系统名称"
#. module: app_odoo_customize
#: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_enterprise
msgid "Uncheck to hide the Enterprise tag"
-msgstr "不勾选则不显示企业版标签"
+msgstr "Uncheck to hide the Enterprise tag"
#. module: app_odoo_customize
#: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_share
msgid "Uncheck to hide the Odoo Share Dashboard"
-msgstr "不勾选则不显示odoo分享"
+msgstr "Uncheck to hide the Odoo Share Dashboard"
#. module: app_odoo_customize
#: model:ir.model.fields,help:app_odoo_customize.field_app_theme_config_settings_app_show_poweredby
msgid "Uncheck to hide the Powered by text"
-msgstr "不勾选则不显示Powered by字样"
+msgstr "不勾选则不显示Odoo Powered by"
#. module: app_odoo_customize
#: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings
@@ -357,7 +372,7 @@ msgstr "启用后,会显示快速调试菜单"
#. module: app_odoo_customize
#: model:ir.ui.view,arch_db:app_odoo_customize.view_app_theme_config_settings
msgid "White Label Setting"
-msgstr "个性化Odoo设置"
+msgstr "个性化odoo设置"
#. module: app_odoo_customize
#: model:ir.model,name:app_odoo_customize.model_ir_ui_view
@@ -367,8 +382,8 @@ msgstr "ir.ui.view"
#. module: app_odoo_customize
#: 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
-msgid "odoo Customize"
-msgstr "odoo 定制"
+msgid "odooApp Customize"
+msgstr "odooApp 定制"
#. module: app_odoo_customize
#: model:ir.ui.menu,name:app_odoo_customize.menu_app_group
diff --git a/app_odoo_customize/models/__init__.py b/app_odoo_customize/models/__init__.py
index 501afcfa..36ac87dc 100644
--- a/app_odoo_customize/models/__init__.py
+++ b/app_odoo_customize/models/__init__.py
@@ -3,3 +3,4 @@
import ir_ui_view
import app_theme_config_settings
import base_language_install
+import mail_thread
diff --git a/app_odoo_customize/models/app_theme_config_settings.py b/app_odoo_customize/models/app_theme_config_settings.py
index b207f278..20be6575 100644
--- a/app_odoo_customize/models/app_theme_config_settings.py
+++ b/app_odoo_customize/models/app_theme_config_settings.py
@@ -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_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_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_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_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_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
app_documentation_url = ir_config.get_param('app_documentation_url',
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_share=app_show_share,
app_show_poweredby=app_show_poweredby,
+ app_stop_subscribe=app_stop_subscribe,
+
app_documentation_url=app_documentation_url,
app_documentation_dev_url=app_documentation_dev_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_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_stop_subscribe", self.app_stop_subscribe or "False")
ir_config.set_param("app_documentation_url",
self.app_documentation_url or "http://www.sunpop.cn/documentation/user/10.0/en/index.html")
diff --git a/app_odoo_customize/models/mail_follower.py b/app_odoo_customize/models/mail_follower.py
new file mode 100644
index 00000000..5d6d200f
--- /dev/null
+++ b/app_odoo_customize/models/mail_follower.py
@@ -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).
diff --git a/app_odoo_customize/models/mail_thread.py b/app_odoo_customize/models/mail_thread.py
new file mode 100644
index 00000000..cf1e7a0a
--- /dev/null
+++ b/app_odoo_customize/models/mail_thread.py
@@ -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)
\ No newline at end of file
diff --git a/app_odoo_customize/readme.md b/app_odoo_customize/readme.md
index 10985a42..dcde3067 100644
--- a/app_odoo_customize/readme.md
+++ b/app_odoo_customize/readme.md
@@ -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.
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.
Also helpful for training and support for your odoo end-user.
The user can get the help document just by one click.
@@ -42,7 +43,8 @@ http://www.sunpop.cn
13. 自定义登陆界面中的 Powered by Odoo
14. 快速删除测试数据,支持模块包括:销售/POS门店/采购/生产/库存/会计/消息与工作流等.
15. 将各类单据的序号重置,从1开始,包括:SO/PO/MO/Invoice 等
-16. 修复odoo启用英文后模块显示的Bug
+16. 修复odoo启用英文后模块不显示中文的Bug
+17. 可停用odoo自动订阅功能,避免“同样对象关注2次”bug,同时提升性能
使用方法:将解压后的 app_odoo_customize 放到 odoo的 addons目录下,激活开发者模式,应用-->更新应用列表,
找到 "App odoo Customize"模块,安装即可。
diff --git a/app_odoo_customize/static/description/index.html b/app_odoo_customize/static/description/index.html
index 48444991..12f6f717 100644
--- a/app_odoo_customize/static/description/index.html
+++ b/app_odoo_customize/static/description/index.html
@@ -7,23 +7,23 @@
Online Documentation Access,Quick Data Clear.
-
1.Deletes Odoo label in footer
-
2.Replaces "Odoo" in Windows title
-
3.Customize Documentation, Support, About links and title in usermenu
-
4.Adds "Developer mode" link to the top right-hand User Menu.
-
5.Adds Quick Language Switcher to the top right-hand User Menu.
-
6.Adds Country flags to the top right-hand User Menu.
-
7.Adds English and Chinese user documentation access to the top right-hand User Menu.
-
8.Adds developer documentation access to the top right-hand User Menu.
-
9.Customize "My odoo.com account" button
-
10.Standalone setting panel, easy to setup.
-
11.Provide 236 country flags.
-
12.Multi-language Support.
-
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/Base Models.
-
15.Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice...
-
16.Fix odoo reload module translation bug while enable english language
-
+
1. Deletes Odoo label in footer
+
2. Replaces "Odoo" in Windows title
+
3. Customize Documentation, Support, About links and title in usermenu
+
4. Adds "Developer mode" link to the top right-hand User Menu.
+
5. Adds Quick Language Switcher to the top right-hand User Menu.
+
6. Adds Country flags to the top right-hand User Menu.
+
7. Adds English and Chinese user documentation access to the top right-hand User Menu.
+
8. Adds developer documentation access to the top right-hand User Menu.
+
9. Customize "My odoo.com account" button
+
10. Standalone setting panel, easy to setup.
+
11. Provide 236 country flags.
+
12. Multi-language Support.
+
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/Base Models.
+
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.
diff --git a/app_odoo_customize/static/description/set1.png b/app_odoo_customize/static/description/set1.png
index 617f0bb0..b68f7abe 100644
Binary files a/app_odoo_customize/static/description/set1.png and b/app_odoo_customize/static/description/set1.png differ
diff --git a/app_odoo_customize/static/description/set12.png b/app_odoo_customize/static/description/set12.png
index 7d4ac681..bda7ea1b 100644
Binary files a/app_odoo_customize/static/description/set12.png and b/app_odoo_customize/static/description/set12.png differ
diff --git a/app_odoo_customize/static/description/set3.png b/app_odoo_customize/static/description/set3.png
index a77aa59b..0c2edc58 100644
Binary files a/app_odoo_customize/static/description/set3.png and b/app_odoo_customize/static/description/set3.png differ
diff --git a/app_odoo_customize/views/app_theme_config_settings_view.xml b/app_odoo_customize/views/app_theme_config_settings_view.xml
index 1f580cbf..2b115b5a 100644
--- a/app_odoo_customize/views/app_theme_config_settings_view.xml
+++ b/app_odoo_customize/views/app_theme_config_settings_view.xml
@@ -60,6 +60,10 @@
+
+
+
+
@@ -137,7 +141,7 @@
- odoo Customize
+ odooApp Customizeir.actions.act_windowapp.theme.config.settingsform
diff --git a/app_product_sequence/controllers/product_sequence.xml b/app_product_sequence/controllers/product_sequence.xml
new file mode 100644
index 00000000..7955665e
--- /dev/null
+++ b/app_product_sequence/controllers/product_sequence.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+ Sequence for All Products
+ product.product
+ P%(y)s%(month)s
+ 5
+
+ True
+
+
+
+ Sequence for Manufactured Product
+ product.product
+ D%(y)s%(month)s
+ 5
+
+ True
+
+
+
+ Sequence for Components Product
+ product.product
+ C%(y)s%(month)s
+ 5
+
+ True
+
+
+
+ Sequence for Sourced Product
+ product.product
+ S%(y)s%(month)s
+ 5
+
+ True
+
+
+
+
+ Manufactured Product
+ Set prefix as "D" in link sequence
+
+
+
+ Sourced Product
+ Set prefix as "S" in link sequence
+
+
+
+ Components Product
+ Set prefix as "C" in link sequence
+
+
+
+
+
+ internal_type
+ product.template
+ default
+
+
+
+
+
+
diff --git a/app_product_type_sequence/__openerp__.py b/app_product_type_sequence/__openerp__.py
index b6abe991..738e996f 100644
--- a/app_product_type_sequence/__openerp__.py
+++ b/app_product_type_sequence/__openerp__.py
@@ -15,7 +15,7 @@
# http://www.sunpop.cn/odoo10_developer_document_offline/
# 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.',
"version": '10.0.2.2',
'category': 'Sales',
@@ -30,7 +30,7 @@
'currency': 'EUR',
'price': 98,
'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.
The reference (default code) is unique (SQL constraint) and required.
@@ -41,7 +41,8 @@
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. 多语种支持。
- 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',
'depends': [
diff --git a/app_product_type_sequence/data/product_sequence_felive.xml b/app_product_type_sequence/data/product_sequence_felive.xml
index 86737139..5278299c 100644
--- a/app_product_type_sequence/data/product_sequence_felive.xml
+++ b/app_product_type_sequence/data/product_sequence_felive.xml
@@ -6,7 +6,7 @@
Sequence for All Productsproduct.product
- P%(y)s%(month)s
+ PR%(y)s%(month)s5True
@@ -42,12 +42,11 @@
Sequence for Sourced Productproduct.product
- CL%(y)s%(month)s
+ WL%(y)s%(month)s5True
-
@@ -58,7 +57,7 @@
product10
-
+ Set prefix as "CP" in link sequence
@@ -70,7 +69,7 @@
product00
-
+ Set prefix as "BJ" in link sequence
@@ -82,7 +81,7 @@
product01
-
+ Set prefix as "BC" in link sequence
@@ -94,7 +93,7 @@
product11
-
+ Set prefix as "CL" in link sequence
@@ -123,13 +122,13 @@
-
- internal_type
- product.template
- default
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/app_product_type_sequence/hooks.py b/app_product_type_sequence/hooks.py
index a4d9d2f1..4a0ea85d 100644
--- a/app_product_type_sequence/hooks.py
+++ b/app_product_type_sequence/hooks.py
@@ -24,7 +24,7 @@ def pre_init_hook(cr):
:return: void
"""
cr.execute("UPDATE product_product "
- "SET default_code = '!!DP!!' || id "
+ "SET default_code = '!!PR!!' || id "
"WHERE default_code IS NULL OR default_code = 'New';")
cr.execute("UPDATE product_template "
diff --git a/app_product_type_sequence/models/product_product.py b/app_product_type_sequence/models/product_product.py
index 43aec35b..28ded679 100644
--- a/app_product_type_sequence/models/product_product.py
+++ b/app_product_type_sequence/models/product_product.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Created on 2017-11-05
+# Created on 2017-01-09
# author: 广州尚鹏,http://www.sunpop.cn
# email: 300883@qq.com
# resource of Sunpop
@@ -24,13 +24,26 @@ class ProductProduct(models.Model):
default_code_index = fields.Integer('Internal Reference Index', readonly=True)
# todo: 检查数据,要保证数据唯一性
- # 为免报错,不限制唯一性
_sql_constraints = [
('uniq_default_code',
'unique(default_code)',
'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
def create(self, vals):
# todo: but 先建空白产品后,编辑2个以上变体,序号会少个 -1
@@ -63,7 +76,7 @@ class ProductProduct(models.Model):
# 有属性值了,自己是第一个规格
code_index = 1
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:
# 已存在1个,当存在的1个有属性时,要改已存在的product值
code_index = template.product_variant_ids[:1].default_code_index
@@ -71,24 +84,24 @@ class ProductProduct(models.Model):
if code_index == 0:
code_index = 1
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值
code_index = code_index + 1
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:
# 找到最大的序号
variant_max = max(template.product_variant_ids,key=lambda x: x['default_code_index'])
code_index = variant_max['default_code_index'] + 1
vals['default_code_index'] = code_index
- vals['default_code'] = code_stored + '-%03d'%(code_index)
+ vals['default_code'] = code_stored + '#%03d'%(code_index)
else:
# 当按模板
# 此条件常规不出现,但特殊项目会有
variant_max = max(template.product_variant_ids,key=lambda x: x['default_code_index'])
code_index = variant_max['default_code_index'] + 1
vals['default_code_index'] = code_index
- vals['default_code'] = code_stored + '-%03d'%(code_index)
+ vals['default_code'] = code_stored + '#%03d'%(code_index)
else:
# create from product_product
# 默认使用制造成品的编码
diff --git a/app_product_type_sequence/models/product_template.py b/app_product_type_sequence/models/product_template.py
index 74d65450..bd51b4a0 100644
--- a/app_product_type_sequence/models/product_template.py
+++ b/app_product_type_sequence/models/product_template.py
@@ -36,6 +36,20 @@ class ProductTemplate(models.Model):
default_code_stored = fields.Char('Internal Reference Stored',
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
def create(self, vals):
if 'attribute_line_ids' in vals:
diff --git a/app_product_type_sequence/static/description/index.html b/app_product_type_sequence/static/description/index.html
index 4ac12cc4..ecb4de17 100644
--- a/app_product_type_sequence/static/description/index.html
+++ b/app_product_type_sequence/static/description/index.html
@@ -1,6 +1,6 @@
-
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.
@@ -26,7 +26,16 @@
Multi language support.
+
+ Setup default Auto Sequence for each product category.
+
+
+ Auto setup product attribute lik Sale/Purchase, Stockable/Consumable/Service, Stock Routes.
+
+
+
+
@@ -49,13 +58,13 @@
Sepcial for variants. add [-00?]
- Products with color[red]: M20171100001-001
+ Products with color[red]: M20171100001#001
- Products with color[blue]: M20171100001-002
+ Products with color[blue]: M20171100001#002
- Products with color[white]: M20171100001-003
+ Products with color[white]: M20171100001#003
diff --git a/app_product_type_sequence/static/description/set0.jpg b/app_product_type_sequence/static/description/set0.jpg
new file mode 100644
index 00000000..7cf34652
Binary files /dev/null and b/app_product_type_sequence/static/description/set0.jpg differ
diff --git a/app_product_type_sequence/产品自动唯一编码模块支持多规格.txt b/app_product_type_sequence/产品自动唯一编码模块支持多规格.txt
deleted file mode 100644
index a62820ce..00000000
--- a/app_product_type_sequence/产品自动唯一编码模块支持多规格.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-App Product Auto Sequence, Auto Code(Variants Supported)
-
-1.ԶƷ롣
-2.ԶƷ룬ʽΪ Ʒ-001
-3.ƷǿҪΨһ
-4.ԶƷͣͬƷʹòͬ
-5.ۡ桢ϵͳ˵пٶ塣
-6.֧֡
-
-This module allows to associate a sequence to the product reference.
-The reference (default code) is unique (SQL constraint) and required.
-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. ֧֡
-
-
-ҳ棬
-http://www.sunpop.cn/product/app-product-auto-sequence-auto-codevariants-supported/
diff --git a/app_product_type_sequence/产品自动生成唯一编码自动输入关键属性-支持多规格.txt b/app_product_type_sequence/产品自动生成唯一编码自动输入关键属性-支持多规格.txt
new file mode 100644
index 00000000..4e5f1474
--- /dev/null
+++ b/app_product_type_sequence/产品自动生成唯一编码自动输入关键属性-支持多规格.txt
@@ -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.
+ The reference (default code) is unique (SQL constraint) and required.
+ 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. 多语种支持。
+ 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/