diff --git a/app_odoo_customize/models/app_theme_config_settings.py b/app_odoo_customize/models/app_theme_config_settings.py
index 2af01395..403ea727 100644
--- a/app_odoo_customize/models/app_theme_config_settings.py
+++ b/app_odoo_customize/models/app_theme_config_settings.py
@@ -114,6 +114,40 @@ class AppThemeConfigSettings(models.TransientModel):
raise Warning(e)
return True
+ def remove_product(self):
+ to_removes = [
+ # 清除产品数据
+ ['product.product', ],
+ ['product.template', ],
+ ]
+ try:
+ for line in to_removes :
+ obj_name = line[0]
+ obj = self.pool.get(obj_name)
+ if obj and obj._table_exist:
+ sql = "delete from %s" % obj._table
+ self._cr.execute( sql)
+ except Exception, e:
+ raise Warning(e)
+ return True
+
+ def remove_product_attribute(self):
+ to_removes = [
+ # 清除产品属性
+ ['product.attribute.value', ],
+ ['product.attribute', ],
+ ]
+ try:
+ for line in to_removes :
+ obj_name = line[0]
+ obj = self.pool.get(obj_name)
+ if obj and obj._table_exist:
+ sql = "delete from %s" % obj._table
+ self._cr.execute( sql)
+ except Exception, e:
+ raise Warning(e)
+ return True
+
@api.multi
def remove_pos(self):
to_removes = [
@@ -154,6 +188,8 @@ class AppThemeConfigSettings(models.TransientModel):
def remove_mrp(self):
to_removes = [
# 清除生产单据
+ ['mrp.workcenter.productivity', ],
+ ['mrp.workorder', ],
['mrp.production.workcenter.line', ],
['mrp.production', ],
['mrp.production.product.line', ],
diff --git a/app_odoo_customize/static/description/index.html b/app_odoo_customize/static/description/index.html
index 91ecda62..2ed27b35 100644
--- a/app_odoo_customize/static/description/index.html
+++ b/app_odoo_customize/static/description/index.html
@@ -103,12 +103,18 @@
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:guohuadeng@hotmail.com">
guohuadeng@hotmail.com
+
diff --git a/app_product_sequence/__init__.py b/app_product_sequence/__init__.py
new file mode 100644
index 00000000..32e57aa9
--- /dev/null
+++ b/app_product_sequence/__init__.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+'''
+Created on 2017-10-28
+@author: 广州尚鹏,http://www.sunpop.cn
+@email: 300883@qq.com
+@resource of Sunpop
+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:
+'''
+
+import models
+import controllers
+from .hooks import pre_init_hook
+
diff --git a/app_product_sequence/__openerp__.py b/app_product_sequence/__openerp__.py
new file mode 100644
index 00000000..9d371ad6
--- /dev/null
+++ b/app_product_sequence/__openerp__.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+
+# Created on 2017-11-05
+# author: 广州尚鹏,http://www.sunpop.cn
+# email: 300883@qq.com
+# resource of Sunpop
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+# Odoo在线中文用户手册(长期更新)
+# 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:
+{
+ 'name': 'App Product Auto Sequence, Auto Code(Variants Supported)',
+ 'summary': 'Auto Internal Reference.',
+ "version": '10.0.2.2',
+ 'category': 'Sales',
+ 'author': 'Sunpop.cn',
+ 'website': 'http://www.sunpop.cn',
+ 'license': 'AGPL-3',
+ 'sequence': 0,
+ 'installable': True,
+ 'auto_install': False,
+ 'application': True,
+ 'images': ['static/description/set2.jpg'],
+ 'currency': 'EUR',
+ 'price': 98,
+ 'description': u"""
+ App Product Auto Sequence, Auto Code(Variants Supported)
+
+ 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.
多语种支持。
+ """,
+ 'pre_init_hook': 'pre_init_hook',
+ 'depends': [
+ 'product',
+ 'sale',
+ 'stock',
+ ],
+ 'data': [
+ # 视图
+ 'views/product_template_view.xml',
+ 'views/product_product_view.xml',
+ 'views/product_internal_type_view.xml',
+ 'data/product_sequence.xml',
+ ],
+ 'demo': [
+ ],
+}
diff --git a/app_product_sequence/controllers/__init__.py b/app_product_sequence/controllers/__init__.py
new file mode 100644
index 00000000..8ee9bae1
--- /dev/null
+++ b/app_product_sequence/controllers/__init__.py
@@ -0,0 +1 @@
+import main
diff --git a/app_product_sequence/controllers/main.py b/app_product_sequence/controllers/main.py
new file mode 100644
index 00000000..40a96afc
--- /dev/null
+++ b/app_product_sequence/controllers/main.py
@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-
diff --git a/app_product_sequence/data/product_sequence.xml b/app_product_sequence/data/product_sequence.xml
new file mode 100644
index 00000000..4a89bd60
--- /dev/null
+++ b/app_product_sequence/data/product_sequence.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+ 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
+
+
+
+ Components Product
+ Set prefix as "C" in link sequence
+
+
+
+ Sourced Product
+ Set prefix as "S" in link sequence
+
+
+
+
diff --git a/app_product_sequence/hooks.py b/app_product_sequence/hooks.py
new file mode 100644
index 00000000..a4d9d2f1
--- /dev/null
+++ b/app_product_sequence/hooks.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+# Created on 2017-11-05
+# author: 广州尚鹏,http://www.sunpop.cn
+# email: 300883@qq.com
+# resource of Sunpop
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+# Odoo在线中文用户手册(长期更新)
+# 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:
+
+def pre_init_hook(cr):
+ """
+ Updates existing codes matching the default 'New' or
+ empty. Primarily this ensures installation does not
+ fail for demo data.
+ :param cr: database cursor
+ :return: void
+ """
+ cr.execute("UPDATE product_product "
+ "SET default_code = '!!DP!!' || id "
+ "WHERE default_code IS NULL OR default_code = 'New';")
+
+ cr.execute("UPDATE product_template "
+ "Set default_code = "
+ "(select default_code from product_product "
+ "where product_product.product_tmpl_id = product_template.id limit 1)"
+ "WHERE default_code IS NULL OR default_code = 'New';")
diff --git a/app_product_sequence/i18n/en_GB.po b/app_product_sequence/i18n/en_GB.po
new file mode 100644
index 00000000..58278920
--- /dev/null
+++ b/app_product_sequence/i18n/en_GB.po
@@ -0,0 +1,20 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product
+#
+# Translators:
+# Ivan Deng <300883@qq.com>
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo 10.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-11-22 14:03+0000\n"
+"PO-Revision-Date: 2016-01-30 10:36+0000\n"
+"Last-Translator: Ivan Deng\n"
+"Language-Team: English (United Kingdom) (http://www.transifex.com/odoo/"
+"odoo-10/language/en_GB/)\n"
+"Language: en_GB\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
diff --git a/app_product_sequence/i18n/zh_CN.po b/app_product_sequence/i18n/zh_CN.po
new file mode 100644
index 00000000..ba4208f6
--- /dev/null
+++ b/app_product_sequence/i18n/zh_CN.po
@@ -0,0 +1,131 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * app_product_sequence
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 10.0+e-20171014\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-11-05 12:11+0000\n"
+"PO-Revision-Date: 2017-11-05 12:11+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_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_create_uid
+msgid "Created by"
+msgstr "创建人"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_create_date
+msgid "Created on"
+msgstr "创建时间"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_description
+msgid "Description"
+msgstr "说明"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_display_name
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_name
+msgid "Display Name"
+msgstr "显示名称"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_id
+msgid "ID"
+msgstr "ID"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_product_default_code_index
+msgid "Internal Reference Index"
+msgstr "Varient序号"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_product_default_code_stored
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_template_default_code_stored
+msgid "Internal Reference Stored"
+msgstr "主产品编码"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_product_internal_type
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_template_internal_type
+msgid "Internal Type"
+msgstr "编码类型"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type___last_update
+msgid "Last Modified on"
+msgstr "最后修改日"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_write_uid
+msgid "Last Updated by"
+msgstr "最后更新人"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_write_date
+msgid "Last Updated on"
+msgstr "最后更新时间"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,field_description:app_product_sequence.field_product_internal_type_link_sequence
+msgid "Link Sequence"
+msgstr "使用的序列"
+
+#. module: app_product_sequence
+#: code:addons/app_product_sequence/models/product_template.py:38
+#, python-format
+msgid "Please save product first before adding varients!"
+msgstr "增加产品变体前,请先保存当前产品!"
+
+#. module: app_product_sequence
+#: model:ir.model.fields,help:app_product_sequence.field_product_internal_type_sequence_prefix
+msgid "Prefix value of the record for the sequence"
+msgstr "序列记录的前缀"
+
+#. module: app_product_sequence
+#: model:ir.model,name:app_product_sequence.model_product_product
+msgid "Product"
+msgstr "产品"
+
+#. module: app_product_sequence
+#: model:ir.actions.act_window,name:app_product_sequence.internal_type_action
+#: model:ir.ui.menu,name:app_product_sequence.menu_internal_type_action_sale
+#: model:ir.ui.menu,name:app_product_sequence.menu_internal_type_action_stock
+#: model:ir.ui.menu,name:app_product_sequence.menu_internal_type_action_sys
+#: model:ir.ui.view,arch_db:app_product_sequence.product_internal_type_tree_view
+msgid "Product Internal Type"
+msgstr "产品编码类型"
+
+#. module: app_product_sequence
+#: model:ir.model,name:app_product_sequence.model_product_template
+msgid "Product Template"
+msgstr "产品模板"
+
+#. module: app_product_sequence
+#: code:addons/app_product_sequence/models/product_product.py:80
+#, python-format
+msgid "Product varient can only create in Product view!"
+msgstr "请在产品管理页面增加产品的多属性!"
+
+#. module: app_product_sequence
+#: sql_constraint:product.internal.type:0
+msgid "The Link Sequence must be unique"
+msgstr "使用的序列不可重复!"
+
+#. module: app_product_sequence
+#: sql_constraint:product.product:0
+msgid "The reference must be unique"
+msgstr "产品内部编码不可重复!"
+
+#. module: app_product_sequence
+#: model:ir.model,name:app_product_sequence.model_product_internal_type
+msgid "product.internal.type"
+msgstr "product.internal.type"
+
diff --git a/app_product_sequence/models/__init__.py b/app_product_sequence/models/__init__.py
new file mode 100644
index 00000000..3bd3f183
--- /dev/null
+++ b/app_product_sequence/models/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+import product_template
+import product_product
+import product_internal_type
\ No newline at end of file
diff --git a/app_product_sequence/models/product_internal_type.py b/app_product_sequence/models/product_internal_type.py
new file mode 100644
index 00000000..723ec33b
--- /dev/null
+++ b/app_product_sequence/models/product_internal_type.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+# Created on 2017-11-05
+# author: 广州尚鹏,http://www.sunpop.cn
+# email: 300883@qq.com
+# resource of Sunpop
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+# Odoo在线中文用户手册(长期更新)
+# 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 openerp import api, fields, models, _
+
+
+class ProductInternalType(models.Model):
+ _name = "product.internal.type"
+
+ name = fields.Char('Display Name',default='Normal')
+ description = fields.Char('Description')
+ # 因为default_code有odoo的处理方式,影响面大,故会将其另存到 default_code_stored
+ link_sequence = fields.Many2one(
+ 'ir.sequence', 'Link Sequence',
+ auto_join=True, required=True, domain="[('code', '=', 'product.product')]")
+ sequence_prefix = fields.Char(u'Sequence Prefix', related='link_sequence.prefix', readonly=True, store=False)
+
+ # _sql_constraints = [
+ # ('uniq_link_sequence',
+ # 'unique(link_sequence)',
+ # 'The Link Sequence must be unique'),
+ # ]
\ No newline at end of file
diff --git a/app_product_sequence/models/product_product.py b/app_product_sequence/models/product_product.py
new file mode 100644
index 00000000..3f32589a
--- /dev/null
+++ b/app_product_sequence/models/product_product.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+
+# Created on 2017-11-05
+# author: 广州尚鹏,http://www.sunpop.cn
+# email: 300883@qq.com
+# resource of Sunpop
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+# Odoo在线中文用户手册(长期更新)
+# 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 openerp import models, fields, api, exceptions, _
+
+
+class ProductProduct(models.Model):
+ _inherit = 'product.product'
+
+ default_code = fields.Char('Internal Reference', index=True, readonly=True, default='New', copy=False)
+ default_code_index = fields.Integer('Internal Reference Index', readonly=True)
+
+ _sql_constraints = [
+ ('uniq_default_code',
+ 'unique(default_code)',
+ 'The reference must be unique'),
+ ]
+
+ @api.model
+ def create(self, vals):
+ # todo: but 先建空白产品后,编辑给2个以上变体,序号会少个 -1
+ # code_index: 当没有变体现时,值为0,有变体时,为该变体序号
+ if 'default_code' not in vals or vals['default_code'] == 'New':
+ code_index = 0
+ if 'product_tmpl_id' in vals:
+ template = self.env['product.template'].search([('id', '=', vals['product_tmpl_id'])], limit=1)
+ mylen = len(template.product_variant_ids)
+ # created from product_template
+ if 'product_tmpl_id' in vals:
+ template = self.env['product.template'].search([('id', '=', vals['product_tmpl_id'])], limit=1)
+ attr = vals['attribute_value_ids'][0][2]
+ if not(attr):
+ # 没有属性值,则是单规格产品。attribute_value_ids格式为[6,0,[]]。多规格时,attribute_value_ids格式为[6,0,[x]]
+ code_index = 0
+ vals['default_code_index'] = code_index
+ vals['default_code'] = template.default_code_stored
+ elif mylen == 0:
+ # 有属性值了,自己是第一个规格
+ code_index = 1
+ vals['default_code_index'] = code_index
+ vals['default_code'] = template.default_code_stored + '-%03d'%(code_index)
+ elif mylen == 1:
+ # 已存在1个,当存在的1个有属性时,要改已存在的product值
+ code_index = template.product_variant_ids[:1].default_code_index
+ if template.product_variant_ids[:1].attribute_value_ids:
+ if code_index == 0:
+ code_index = 1
+ template.product_variant_ids[:1].default_code_index = code_index
+ template.product_variant_ids[:1].default_code = template.default_code_stored + '-%03d'%(code_index)
+ # 接着改当前操作的product值
+ code_index = code_index + 1
+ vals['default_code_index'] = code_index
+ vals['default_code'] = template.default_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'] = template.default_code_stored + '-%03d'%(code_index)
+ else:
+ # create from product_product
+ sequence = self.env['product.internal.type'].search([('id', '=', vals['internal_type'])], limit=1)
+ vals['default_code'] = sequence.link_sequence.next_by_id()
+ return super(ProductProduct, self).create(vals)
+
+ @api.multi
+ def copy(self, default=None):
+ if len(self.product_tmpl_id.product_variant_ids)>1 :
+ raise exceptions.ValidationError(_('Product varient can only create in Product view!'))
+ return super(ProductProduct, self).copy(default=None)
diff --git a/app_product_sequence/models/product_template.py b/app_product_sequence/models/product_template.py
new file mode 100644
index 00000000..f81d66f9
--- /dev/null
+++ b/app_product_sequence/models/product_template.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+
+# Created on 2017-11-05
+# author: 广州尚鹏,http://www.sunpop.cn
+# email: 300883@qq.com
+# resource of Sunpop
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+# Odoo在线中文用户手册(长期更新)
+# 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 openerp import api, fields, models, exceptions, _
+
+
+class ProductTemplate(models.Model):
+ _name = "product.template"
+ _inherit = ['product.template']
+
+ internal_type = fields.Many2one(
+ 'product.internal.type', 'Internal Type',
+ auto_join=True, required=True)
+
+ default_code = fields.Char(
+ 'Internal Reference', compute='_compute_default_code',
+ inverse='_set_default_code', store=True, readonly=True,
+ default='New', copy=False)
+ # 因为default_code有odoo的处理方式,影响面大,故会将其另存到 default_code_stored
+ default_code_stored = fields.Char('Internal Reference Stored',default='New')
+
+ @api.model
+ def create(self, vals):
+ if 'attribute_line_ids' in vals:
+ if len(vals['attribute_line_ids'])>0:
+ raise exceptions.ValidationError(_('Please save product first before adding varients!'))
+ if 'default_code' not in vals or vals['default_code'] == 'New':
+ sequence = self.env['product.internal.type'].search([('id', '=', vals['internal_type'])], limit=1)
+ vals['default_code'] = sequence.link_sequence.next_by_id()
+ vals['default_code_stored'] = vals['default_code']
+ return super(ProductTemplate, self).create(vals)
+
+ @api.depends('product_variant_ids', 'product_variant_ids.default_code')
+ def _compute_default_code(self):
+ unique_variants = self.filtered(lambda template: len(template.product_variant_ids) == 1)
+ for template in unique_variants:
+ template.default_code = template.product_variant_ids.default_code
+ for template in (self):
+ if len(template.product_variant_ids)>1:
+ template.default_code = ''
+
+ @api.one
+ def _set_default_code(self):
+ if len(self.product_variant_ids) == 1:
+ self.product_variant_ids.default_code = self.default_code_stored
+
diff --git a/app_product_sequence/static/description/icon.png b/app_product_sequence/static/description/icon.png
new file mode 100644
index 00000000..2a04f219
Binary files /dev/null and b/app_product_sequence/static/description/icon.png differ
diff --git a/app_product_sequence/static/description/index.html b/app_product_sequence/static/description/index.html
new file mode 100644
index 00000000..68d66a88
--- /dev/null
+++ b/app_product_sequence/static/description/index.html
@@ -0,0 +1,98 @@
+
+
+
App Product Auto Sequence, Auto Code(Variants Supported)
+
+
+ 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.
+
+
+ -
+ Auto Sequence or code for every product.
+
+ -
+ Auto Sequence or for every product variants, like product20171130-001.
+
+ -
+ Product code must be Unique.
+
+ -
+ Define different product type, each product type use own rule of sequence.
+
+ -
+ Quick access in sale , inventory, system menu.
+
+ -
+ Multi language support.
+
+
+
+

+
+
+

+
+
Sample Rule:
+
+ D171100001 for Manufactured Products.
+ C171000001 for Components Products.
+ S171000001 for Sourced Products.
+ 17-year, 10-month.
+
+
+ Sepcial for variants. add [-00?]
+
+
Installation:
+
+ Prior to installing this module, if you have any existing products you should ensure they already have a
+ unique reference (or no reference) set.
+ Products with a default_code of '/' or empty will automatically be assigned a code of "!!DP!!" followed
+ by the system id for that product.
+ Otherwise the setting of the unique constraint will fail and the module will fail to install.
+
+ Notice:
+ Odoo product variants is very special.
+ When u create a product(not product template) with attribute, It would delete the first product, which
+ have no attribute.
+ So it's very normal that the first product variants begin wit ???-002.
+ And we make a rule that the product variants can only create after you create normal product template.
+
+
+
+
+
+
+
+
+
+
+
Technical Help & Support
+
+
+
+
\ No newline at end of file
diff --git a/app_product_sequence/static/description/set1.jpg b/app_product_sequence/static/description/set1.jpg
new file mode 100644
index 00000000..77910e22
Binary files /dev/null and b/app_product_sequence/static/description/set1.jpg differ
diff --git a/app_product_sequence/static/description/set2.jpg b/app_product_sequence/static/description/set2.jpg
new file mode 100644
index 00000000..f05874e3
Binary files /dev/null and b/app_product_sequence/static/description/set2.jpg differ
diff --git a/app_product_sequence/tests/__init__.py b/app_product_sequence/tests/__init__.py
new file mode 100644
index 00000000..269a938e
--- /dev/null
+++ b/app_product_sequence/tests/__init__.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+'''
+Created on 2017-10-28
+@author: 广州尚鹏,http://www.sunpop.cn
+@email: 300883@qq.com
+@resource of Sunpop
+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 test_product_sequence
diff --git a/app_product_sequence/tests/test_product_sequence.py b/app_product_sequence/tests/test_product_sequence.py
new file mode 100644
index 00000000..f275be4f
--- /dev/null
+++ b/app_product_sequence/tests/test_product_sequence.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+'''
+Created on 2017-10-28
+@author: 广州尚鹏,http://www.sunpop.cn
+@email: 300883@qq.com
+@resource of Sunpop
+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 odoo.tests.common import TransactionCase
+from ..hooks import pre_init_hook
+
+
+class TestProductSequence(TransactionCase):
+ """Tests for creating product with and without Product Sequence"""
+
+ def setUp(self):
+ super(TestProductSequence, self).setUp()
+ self.product_product = self.env['product.product']
+
+ def test_product_create_with_default_code(self):
+ product = self.product_product.create(dict(
+ name="Apple",
+ default_code='PROD01'
+ ))
+ self.assertEqual(product.default_code, 'PROD01')
+
+ def test_product_create_without_default_code(self):
+ product_1 = self.product_product.create(dict(
+ name="Orange",
+ default_code='/'))
+ self.assertRegexpMatches(str(product_1.default_code), r'PR/*')
+
+ def test_product_copy(self):
+ product_2 = self.product_product.create(dict(
+ name="Apple",
+ default_code='PROD02'
+ ))
+ copy_product_2 = product_2.copy()
+ self.assertEqual(copy_product_2.default_code, 'PROD02-copy')
+
+ def test_pre_init_hook(self):
+ product_3 = self.product_product.create(dict(
+ name="Apple",
+ default_code='PROD03'
+ ))
+ self.cr.execute(
+ "update product_product set default_code='/' where id=%s"
+ % (product_3.id,))
+ product_3.invalidate_cache()
+ self.assertEqual(product_3.default_code, '/')
+ pre_init_hook(self.cr)
+ product_3.invalidate_cache()
+ self.assertEqual(product_3.default_code, '!!mig!!%s' % (product_3.id,))
diff --git a/app_product_sequence/views/product_internal_type_view.xml b/app_product_sequence/views/product_internal_type_view.xml
new file mode 100644
index 00000000..68d49d7d
--- /dev/null
+++ b/app_product_sequence/views/product_internal_type_view.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+ product.internal.type.tree
+ product.internal.type
+
+
+
+
+
+
+
+
+
+
+ Product Internal Type
+ ir.actions.act_window
+ product.internal.type
+ tree
+
+
+
+
+
+
+
diff --git a/app_product_sequence/views/product_product_view.xml b/app_product_sequence/views/product_product_view.xml
new file mode 100644
index 00000000..834bb3ef
--- /dev/null
+++ b/app_product_sequence/views/product_product_view.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ product.product.tree
+ product.product
+
+
+
+
+
+
+
+
+
diff --git a/app_product_sequence/views/product_template_view.xml b/app_product_sequence/views/product_template_view.xml
new file mode 100644
index 00000000..26f4c6db
--- /dev/null
+++ b/app_product_sequence/views/product_template_view.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+ product.template.product.tree
+ product.template
+
+
+
+
+
+
+
+
+
+ product.template.common.form
+ product.template
+
+
+
+
+
+
+
+
+