fix. remove pre_init_hook

This commit is contained in:
ivan deng
2018-07-20 18:01:04 +08:00
parent b3cb0b1ef3
commit 71e8ff2658
39 changed files with 0 additions and 1657 deletions

View File

@@ -1,16 +0,0 @@
# -*- 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 models
from . import controllers

View File

@@ -1,64 +0,0 @@
# -*- 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 Internal Type,Auto Sequence, Auto Code(Variants Supported), Auto Attributes',
'summary': 'Auto Internal Reference.',
"version": '10.0.2.2',
'category': 'Sales',
'author': 'Sunpop.cn',
'website': 'http://www.sunpop.cn',
'license': 'AGPL-3',
'sequence': 2,
'installable': True,
'auto_install': True,
'application': True,
'images': ['static/description/set2.jpg'],
'currency': 'EUR',
'price': 98,
'description': u"""
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. 自动设置产品的销售/采购,可库存产品/服务/消耗品,购买/制造/按订单生成等库存路线
""",
'pre_init_hook': 'pre_init_hook',
'depends': [
'product',
'stock',
],
'data': [
# 视图
"security/ir.model.access.csv",
"security/security.xml",
'views/product_template_view.xml',
'views/product_product_view.xml',
'views/product_category_view.xml',
'views/product_internal_type_view.xml',
'data/product_sequence.xml',
],
'demo': [
],
}

View File

@@ -1 +0,0 @@
from . import main

View File

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

View File

@@ -1,104 +0,0 @@
<?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">PR%(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_mrp_product" model="ir.sequence">
<field name="name">Sequence for Manufactured Product</field>
<field name="code">product.product</field>
<field name="prefix">CP%(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_mrp_component" model="ir.sequence">
<field name="name">Sequence for Manufactured Components</field>
<field name="code">product.product</field>
<field name="prefix">BC%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- 制造原材料,采购的板材,如"16mm中纤板" Components.-->
<record id="seq_sourced_material" model="ir.sequence">
<field name="name">Sequence for Sourced Material</field>
<field name="code">product.product</field>
<field name="prefix">WL%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- internal_type 数据-->
<!--[(4, ref('purchase.route_warehouse0_buy')),(4, ref('mrp.route_warehouse0_manufacture')),(4, ref('stock.route_warehouse0_mto'))]-->
<!--成品-->
<record id="internal_type_mrp_product" model="product.internal.type">
<field name="name">Manufactured Product</field>
<field name="ref">cp</field>
<field name="sequence">10</field>
<field name="type">product</field>
<field name="sale_ok">1</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="description">Set prefix as "CP" in link sequence</field>
<field name="link_sequence" ref="seq_mrp_product"/>
</record>
<!--半成品-->
<record id="internal_type_mrp_component" model="product.internal.type">
<field name="name">Manufactured Components</field>
<field name="ref">bc</field>
<field name="sequence">20</field>
<field name="type">product</field>
<field name="sale_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="description">Set prefix as "BC" in link sequence</field>
<field name="link_sequence" ref="seq_mrp_component"/>
</record>
<!--采购原材料-->
<record id="internal_type_sourced_material" model="product.internal.type">
<field name="name">Sourced Material</field>
<field name="ref">wl</field>
<field name="sequence">30</field>
<field name="type">product</field>
<field name="sale_ok">0</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="description">Set prefix as "WL" in link sequence</field>
<field name="link_sequence" ref="seq_sourced_material"/>
</record>
<!-- 服务与费用 Service-->
<record id="internal_type_service" model="product.internal.type">
<field name="name">Service</field>
<field name="ref">fw</field>
<field name="sequence">50</field>
<field name="type">service</field>
<field name="sale_ok">1</field>
<field name="purchase_ok">1</field>
<field name="description">Set prefix as "PR" in link sequence</field>
<field name="link_sequence" ref="seq_product_auto"/>
</record>
<!-- 消耗品,无限库存 Consu-->
<record id="internal_type_consu" model="product.internal.type">
<field name="name">Consumer</field>
<field name="ref">xh</field>
<field name="sequence">60</field>
<field name="type">consu</field>
<field name="sale_ok">1</field>
<field name="purchase_ok">1</field>
<field name="description">Set prefix as "PR" in link sequence</field>
<field name="link_sequence" ref="seq_product_auto"/>
</record>
</data>
</odoo>

View File

@@ -1,104 +0,0 @@
<?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_mrp_product" 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_sourced_material" 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_product" 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>
<!-- 服务与费用 Service-->
<record id="seq_service" model="ir.sequence">
<field name="name">Service</field>
<field name="code">product.product</field>
<field name="prefix">V%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
</data>
<data noupdate="0">
<!-- internal_type 数据-->
<record id="internal_type_mrp_product" model="product.internal.type">
<field name="name">Manufactured Product</field>
<field name="ref">d</field>
<field name="type">product</field>
<field name="sale_ok">1</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="description">Set prefix as "D" in link sequence</field>
<field name="link_sequence" ref="seq_mrp_product"/>
</record>
<record id="internal_type_sourced_material" model="product.internal.type">
<field name="name">Components Product</field>
<field name="ref">c</field>
<field name="type">product</field>
<field name="sale_ok">0</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="description">Set prefix as "C" in link sequence</field>
<field name="link_sequence" ref="seq_sourced_material"/>
</record>
<record id="internal_type_sourced_product" model="product.internal.type">
<field name="name">Sourced Product</field>
<field name="ref">s</field>
<field name="type">product</field>
<field name="sale_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="description">Set prefix as "S" in link sequence</field>
<field name="link_sequence" ref="seq_sourced_product"/>
</record>
<record id="internal_type_service" model="product.internal.type">
<field name="name">Service</field>
<field name="ref">v</field>
<field name="type">service</field>
<field name="sale_ok">1</field>
<field name="purchase_ok">1</field>
<field name="route_ids" eval="[(5)]"/>
<field name="description">Set prefix as "V" in link sequence</field>
<field name="link_sequence" ref="seq_service"/>
</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_type_sequence.internal_type_mrp_product'))+'\n.'"/>
</record>
</data>
</odoo>

View File

@@ -1,134 +0,0 @@
<?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">PR%(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_mrp_product" model="ir.sequence">
<field name="name">Sequence for Manufactured Product</field>
<field name="code">product.product</field>
<field name="prefix">CP%(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_mrp_component" model="ir.sequence">
<field name="name">Sequence for Manufactured Components</field>
<field name="code">product.product</field>
<field name="prefix">BJ%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- 生产原材料,采购的板材,如"16mm中纤板" Components.-->
<record id="seq_sourced_material" model="ir.sequence">
<field name="name">Sequence for Sourced Material</field>
<field name="code">product.product</field>
<field name="prefix">BC%(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_product" model="ir.sequence">
<field name="name">Sequence for Sourced Product</field>
<field name="code">product.product</field>
<field name="prefix">WL%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- internal_type 数据-->
<!--[(4, ref('purchase.route_warehouse0_buy')),(4, ref('mrp.route_warehouse0_manufacture')),(4, ref('stock.route_warehouse0_mto'))]-->
<!--成品-->
<record id="internal_type_mrp_product" model="product.internal.type">
<field name="name">图纸成品</field>
<field name="ref">cp</field>
<field name="sequence">1</field>
<field name="type">product</field>
<field name="sale_ok">1</field>
<field name="purchase_ok">0</field>
<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="link_sequence" ref="seq_mrp_product"/>
</record>
<!--板件-->
<record id="internal_type_mrp_component" model="product.internal.type">
<field name="name">图纸板件</field>
<field name="ref">bj</field>
<field name="sequence">2</field>
<field name="type">product</field>
<field name="sale_ok">0</field>
<field name="purchase_ok">0</field>
<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="link_sequence" ref="seq_mrp_component"/>
</record>
<!--纯制造原材料,板材-->
<record id="internal_type_sourced_material" model="product.internal.type">
<field name="name">大板</field>
<field name="ref">bc</field>
<field name="sequence">3</field>
<field name="type">product</field>
<field name="sale_ok">0</field>
<field name="purchase_ok">1</field>
<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="link_sequence" ref="seq_sourced_material"/>
</record>
<!--其它外购品,如五金-->
<record id="internal_type_sourced_product" model="product.internal.type">
<field name="name">基础物料</field>
<field name="ref">cl</field>
<field name="sequence">4</field>
<field name="type">product</field>
<field name="sale_ok">1</field>
<field name="purchase_ok">1</field>
<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="link_sequence" ref="seq_sourced_product"/>
</record>
<!-- 服务与费用 Service-->
<record id="internal_type_service" model="product.internal.type">
<field name="name">服务与费用</field>
<field name="ref">fw</field>
<field name="sequence">5</field>
<field name="type">service</field>
<field name="sale_ok">1</field>
<field name="purchase_ok">1</field>
<field name="description">Set prefix as "PR" in link sequence</field>
<field name="link_sequence" ref="seq_product_auto"/>
</record>
<!-- 消耗品,无限库存 Consu-->
<record id="internal_type_consu" model="product.internal.type">
<field name="name">消耗品</field>
<field name="ref">xh</field>
<field name="sequence">6</field>
<field name="type">consu</field>
<field name="sale_ok">0</field>
<field name="purchase_ok">0</field>
<field name="description">Set prefix as "PR" in link sequence</field>
<field name="link_sequence" ref="seq_product_auto"/>
</record>
<!--这个默认值可以不用因为在onchange事件会设置很多值-->
<!--设置产品默认值为制造成品-->
<!--<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('internal_type_mrp_product'))+'\n.'"/>-->
<!--</record>-->
</data>
</odoo>

View File

@@ -1,100 +0,0 @@
<?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">PR%(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_mrp_product" model="ir.sequence">
<field name="name">Sequence for Manufactured Product</field>
<field name="code">product.product</field>
<field name="prefix">CP%(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_mrp_component" model="ir.sequence">
<field name="name">Sequence for Manufactured Components</field>
<field name="code">product.product</field>
<field name="prefix">BC%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- 制造原材料,采购的板材,如"16mm中纤板" Components.-->
<record id="seq_sourced_material" model="ir.sequence">
<field name="name">Sequence for Sourced Material</field>
<field name="code">product.product</field>
<field name="prefix">CL%(y)s%(month)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="initial">True</field>
</record>
<!-- internal_type 数据-->
<!--[(4, ref('purchase.route_warehouse0_buy')),(4, ref('mrp.route_warehouse0_manufacture')),(4, ref('stock.route_warehouse0_mto'))]-->
<!--成品-->
<record id="internal_type_mrp_product" model="product.internal.type">
<field name="name">Manufactured Product</field>
<field name="ref">cp</field>
<field name="type">product</field>
<field name="sale_ok">1</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="description">Set prefix as "CP" in link sequence</field>
<field name="link_sequence" ref="seq_mrp_product"/>
</record>
<!--板件-->
<record id="internal_type_mrp_component" model="product.internal.type">
<field name="name">Manufactured Components</field>
<field name="ref">bc</field>
<field name="type">product</field>
<field name="sale_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="description">Set prefix as "BC" in link sequence</field>
<field name="link_sequence" ref="seq_mrp_component"/>
</record>
<!--纯制造原材料,板材-->
<record id="internal_type_sourced_material" model="product.internal.type">
<field name="name">Components Product</field>
<field name="ref">bc</field>
<field name="type">product</field>
<field name="sale_ok">0</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="description">Set prefix as "BC" in link sequence</field>
<field name="link_sequence" ref="seq_sourced_material"/>
</record>
<!--其它外购品,如五金-->
<record id="internal_type_sourced_product" model="product.internal.type">
<field name="name">Sourced Material</field>
<field name="ref">cl</field>
<field name="type">product</field>
<field name="sale_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="description">Set prefix as "CL" in link sequence</field>
<field name="link_sequence" ref="seq_sourced_product"/>
</record>
<!--这个默认值可以不用因为在onchange事件会设置很多值-->
<!--设置产品默认值为制造成品-->
<!--<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('internal_type_mrp_product'))+'\n.'"/>-->
<!--</record>-->
</data>
</odoo>

View File

@@ -1,34 +0,0 @@
# -*- 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 = '!!PR!!' || 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';")

View File

@@ -1,249 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * app_product_type_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0+e-20171107\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-19 13:34+0000\n"
"PO-Revision-Date: 2017-12-19 13:34+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_type_sequence
#: model:ir.model.fields,help:app_product_type_sequence.field_product_internal_type_type
msgid "A stockable product is a product for which you manage stock. The \"Inventory\" app has to be installed.\n"
"A consumable product, on the other hand, is a product for which stock is not managed.\n"
"A service is a non-material product you provide.\n"
"A digital content is a non-material product you sell online. The files attached to the products are the one that are sold on the e-commerce such as e-books, music, pictures,... The \"Digital Product\" module has to be installed."
msgstr "A stockable product is a product for which you manage stock. The \"Inventory\" app has to be installed.\n"
"A consumable product, on the other hand, is a product for which stock is not managed.\n"
"A service is a non-material product you provide.\n"
"A digital content is a non-material product you sell online. The files attached to the products are the one that are sold on the e-commerce such as e-books, music, pictures,... The \"Digital Product\" module has to be installed."
#. module: app_product_type_sequence
#: model:ir.ui.view,arch_db:app_product_type_sequence.product_internal_type_form_view
msgid "Auto Set Product's Value To:"
msgstr "自动设置产品默认参数为:"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_purchase_ok
msgid "Can be Purchased"
msgstr "可用于采购"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_rental
msgid "Can be Rent"
msgstr "可用于出租"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_sale_ok
msgid "Can be Sold"
msgstr "可用于销售"
#. module: app_product_type_sequence
#: model:product.internal.type,name:app_product_type_sequence.internal_type_sourced_material
msgid "Components Product"
msgstr "原材料"
#. module: app_product_type_sequence
#: code:addons/app_product_type_sequence/models/product_internal_type.py:34
#: selection:product.internal.type,type:0
#, python-format
msgid "Consumable"
msgstr "可消耗"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_create_uid
msgid "Created by"
msgstr "创建人"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_create_date
msgid "Created on"
msgstr "创建时间"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_category_internal_type
msgid "Default Internal Type"
msgstr "默认产品内部类型"
#. module: app_product_type_sequence
#: model:ir.model.fields,help:app_product_type_sequence.field_product_internal_type_route_ids
msgid "Depending on the modules installed, this will allow you to define the route of the product: whether it will be bought, manufactured, MTO/MTS,..."
msgstr "取决于安装的模块它允许在产品定义路线购买制造MTO/MTS等等..."
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_description
msgid "Description"
msgstr "说明"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_display_name
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_name
#: model:ir.ui.view,arch_db:app_product_type_sequence.product_internal_type_form_view
msgid "Display Name"
msgstr "显示名称"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_id
msgid "ID"
msgstr "ID"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_product_default_code_index
msgid "Internal Reference Index"
msgstr "Varient序号"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_product_default_code_stored
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_template_default_code_stored
msgid "Internal Reference Stored"
msgstr "主产品编码"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_product_internal_type
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_template_internal_type
msgid "Internal Type"
msgstr "内部类型"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type___last_update
msgid "Last Modified on"
msgstr "最后修改日"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_write_uid
msgid "Last Updated by"
msgstr "最后更新人"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_write_date
msgid "Last Updated on"
msgstr "最后更新时间"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_link_sequence
msgid "Link Sequence"
msgstr "使用的序列"
#. module: app_product_type_sequence
#: model:product.internal.type,name:app_product_type_sequence.internal_type_mrp_product
msgid "Manufactured Product"
msgstr "制造成品"
#. module: app_product_type_sequence
#: code:addons/app_product_type_sequence/models/product_product.py:23
#: code:addons/app_product_type_sequence/models/product_template.py:33
#, python-format
msgid "New"
msgstr "新建"
#. module: app_product_type_sequence
#: code:addons/app_product_type_sequence/models/product_template.py:41
#, python-format
msgid "Please save product first before adding varients!"
msgstr "增加产品变体前,请先保存当前产品!"
#. module: app_product_type_sequence
#: model:ir.model.fields,help:app_product_type_sequence.field_product_internal_type_sequence_prefix
msgid "Prefix value of the record for the sequence"
msgstr "序列记录的前缀"
#. module: app_product_type_sequence
#: model:ir.model,name:app_product_type_sequence.model_product_product
msgid "Product"
msgstr "产品"
#. module: app_product_type_sequence
#: model:ir.model,name:app_product_type_sequence.model_product_category
msgid "Product Category"
msgstr "产品类别"
#. module: app_product_type_sequence
#: model:ir.actions.act_window,name:app_product_type_sequence.internal_type_action
#: model:ir.ui.menu,name:app_product_type_sequence.menu_internal_type_action_purchase
#: model:ir.ui.menu,name:app_product_type_sequence.menu_internal_type_action_sale
#: model:ir.ui.menu,name:app_product_type_sequence.menu_internal_type_action_stock
#: model:ir.ui.menu,name:app_product_type_sequence.menu_internal_type_action_sys
#: model:ir.ui.view,arch_db:app_product_type_sequence.product_internal_type_form_view
#: model:ir.ui.view,arch_db:app_product_type_sequence.product_internal_type_tree_view
msgid "Product Internal Type"
msgstr "产品编码类型"
#. module: app_product_type_sequence
#: model:ir.model,name:app_product_type_sequence.model_product_template
msgid "Product Template"
msgstr "产品模板"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_type
msgid "Product Type"
msgstr "产品类型"
#. module: app_product_type_sequence
#: code:addons/app_product_type_sequence/models/product_product.py:83
#, python-format
msgid "Product varient can only create in Product view!"
msgstr "请在产品管理页面增加产品的多属性!"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_route_ids
msgid "Routes"
msgstr "路线"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_sequence_prefix
msgid "Sequence Prefix"
msgstr "编号前缀"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_sequence
msgid "Sequence"
msgstr "显示顺序"
#. module: app_product_type_sequence
#: code:addons/app_product_type_sequence/models/product_internal_type.py:35
#: selection:product.internal.type,type:0
#, python-format
msgid "Service"
msgstr "服务"
#. module: app_product_type_sequence
#: model:product.internal.type,name:app_product_type_sequence.internal_type_sourced_product
msgid "Sourced Product"
msgstr "外购成品"
#. module: app_product_type_sequence
#: model:ir.model.fields,help:app_product_type_sequence.field_product_internal_type_sale_ok
msgid "Specify if the product can be selected in a sales order line."
msgstr "如果产品能在销售单明细在被选择,则指定。"
#. module: app_product_type_sequence
#: code:addons/app_product_type_sequence/models/product_internal_type.py:36
#: selection:product.internal.type,type:0
#, python-format
msgid "Stockable Product"
msgstr "可库存产品"
#. module: app_product_type_sequence
#: sql_constraint:product.internal.type:0
#: sql_constraint:product.product:0
msgid "The reference must be unique"
msgstr "产品内部编码不可重复!"
#. module: app_product_type_sequence
#: model:ir.model.fields,field_description:app_product_type_sequence.field_product_internal_type_ref
msgid "Unique Code"
msgstr "唯一编码"
#. module: app_product_type_sequence
#: model:ir.model,name:app_product_type_sequence.model_product_internal_type
msgid "product.internal.type"
msgstr "product.internal.type"

View File

@@ -1,5 +0,0 @@
# -*- coding: utf-8 -*-
from . import product_template
from . import product_product
from . import product_category
from . import product_internal_type

View File

@@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# Created on 2017-11-28
# 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 ProductCategory(models.Model):
_name = "product.category"
_inherit = ['product.category']
internal_type = fields.Many2one(
'product.internal.type', 'Default Internal Type',
auto_join=True, required=False)

View File

@@ -1,64 +0,0 @@
# -*- 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"
_order = 'sequence, name'
sequence = fields.Integer('Sequence', default=9)
name = fields.Char('Display Name', default='Normal', translate=True)
description = fields.Char('Description')
ref = fields.Char('Unique Code', required=True)
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)
# 各种默认值,填则自动录入,不填则不管
type = fields.Selection([
('consu', _('Consumable')),
('service', _('Service')),
('product', _('Stockable Product'))], string='Product Type',
help='A stockable product is a product for which you manage stock. The "Inventory" app has to be installed.\n'
'A consumable product, on the other hand, is a product for which stock is not managed.\n'
'A service is a non-material product you provide.\n'
'A digital content is a non-material product you sell online. The files attached to the products are the one that are sold on '
'the e-commerce such as e-books, music, pictures,... The "Digital Product" module has to be installed.')
rental = fields.Boolean('Can be Rent')
sale_ok = fields.Boolean(
'Can be Sold', default=True,
help="Specify if the product can be selected in a sales order line.")
purchase_ok = fields.Boolean('Can be Purchased', default=True)
# 使用目录的默认路线来处理,暂时不用内部类型路线
route_ids = fields.Many2many('stock.location.route', string='Routes',
domain=[('product_selectable', '=', True)],
help="Depending on the modules installed, this will allow you to define the route of the product: whether it will be bought, manufactured, MTO/MTS,...")
company_id = fields.Many2one(
'res.company', 'Company',
default=lambda self: self.env.user.company_id.id, index=1)
_sql_constraints = [
('uniq_ref',
'unique(ref)',
'The reference must be unique'),
]

View File

@@ -1,140 +0,0 @@
# -*- coding: utf-8 -*-
# Created on 2017-01-09
# 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, default=lambda self: _('New'), copy=False)
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
# code_index: 当没有变体现时值为0有变体时为该变体序号
code_index = 0
if 'default_code' not in vals or vals['default_code'] == _('New'):
if 'product_tmpl_id' in vals:
# 按产品模板创建产品,有多种情况
template = self.env['product.template'].search([('id', '=', vals['product_tmpl_id'])], limit=1)
if template.default_code and template.default_code != '':
code_stored = template.default_code
else:
code_stored = template.default_code_stored
if not code_stored:
code_stored = ''
mylen = len(template.product_variant_ids)
try:
attr = vals['attribute_value_ids'][0][2]
except:
attr = 0
# if self.env.context.get('create_from_tmpl') and not(attr): 此条件已限制不让在template中先直接创建变体要求先保存
if self.env.context.get('create_from_tmpl') and not(attr):
# 从产品模板创建的第一个sku产品不带属性
# 没有属性值则是单规格产品。attribute_value_ids格式为[6,0,[]]。多规格时attribute_value_ids格式为[6,0,[x]]
code_index = 0
vals['default_code_index'] = code_index
vals['default_code'] = code_stored
elif mylen == 0:
# 有属性值了,自己是第一个规格
code_index = 1
vals['default_code_index'] = 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
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 = 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)
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)
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)
else:
# create from product_product
# 默认使用制造成品的编码
sequence = self.env.ref('app_product_type_sequence.internal_type_mrp_product', raise_if_not_found=False)
if 'internal_type' in vals:
sequence = self.env['product.internal.type'].search([('id', '=', vals['internal_type'])], limit=1)
vals['default_code'] = sequence.link_sequence.next_by_id()
else:
# 如果有自己输入 ref则不需要自运输生成
# sequence = self.env['product.internal.type'].search([('id', '=', vals['internal_type'])], limit=1)
# if sequence:
# vals['default_code'] = sequence.link_sequence.next_by_id()
pass
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)
# 当内部类型变化时,改变产品的各默认值
@api.onchange('internal_type')
def _onchange_internal_type(self):
if self.internal_type:
self.type = self.internal_type.type
self.rental = self.internal_type.rental
self.sale_ok = self.internal_type.sale_ok
self.purchase_ok = self.internal_type.purchase_ok
self.route_ids = self.internal_type.route_ids
# 分类变动时,如果分类绑定了内部类型则联动
@api.onchange('categ_id')
def _onchange_cate_id(self):
if self.categ_id and self.categ_id.internal_type:
self.internal_type = self.categ_id.internal_type

View File

@@ -1,101 +0,0 @@
# -*- 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']
# auto_join只要搜索product.template自动会join。如果经常用到 internal_type 效率会高。
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, default=lambda self: _('New'), copy=False)
# 因为default_code有odoo的处理方式影响面大故会将其另存到 default_code_stored
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:
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)
if not sequence:
sequence = self.env.ref('app_product_type_sequence.internal_type_mrp_product', raise_if_not_found=False)
vals['default_code'] = sequence.link_sequence.next_by_id()
else:
pass
if vals['default_code']:
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)
# 设置default_code
for template in unique_variants:
template.default_code = template.product_variant_ids.default_code
for template in (self - unique_variants):
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
# 当内部类型变化时,改变产品模板的各默认值
@api.onchange('internal_type')
def _onchange_internal_type(self):
if self.internal_type:
self.type = self.internal_type.type
self.rental = self.internal_type.rental
self.sale_ok = self.internal_type.sale_ok
self.purchase_ok = self.internal_type.purchase_ok
self.route_ids = self.internal_type.route_ids
# 分类变动时,如果分类绑定了内部类型则联动
@api.onchange('categ_id')
def _onchange_cate_id(self):
if self.categ_id and self.categ_id.internal_type:
self.internal_type = self.categ_id.internal_type

View File

@@ -1,3 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sale_order_type_manager,access_sale_order_type_manager,model_product_internal_type,sales_team.group_sale_manager,1,1,1,1
access_sale_order_type_salesman,access_sale_order_type_salesman,model_product_internal_type,sales_team.group_sale_salesman,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sale_order_type_manager access_sale_order_type_manager model_product_internal_type sales_team.group_sale_manager 1 1 1 1
3 access_sale_order_type_salesman access_sale_order_type_salesman model_product_internal_type sales_team.group_sale_salesman 1 0 0 0

View File

@@ -1,12 +0,0 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.rule" id="product_internal_type_comp_rule">
<field name="name">Product Internal Type multi-company</field>
<field name="model_id" ref="app_product_type_sequence.model_product_internal_type"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="perm_read" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_unlink" eval="1"/>
</record>
</odoo>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -1,171 +0,0 @@
<section class="oe_container oe_dark">
<div class="oe_row oe_padded">
<h2 class="oe_slogan" style="color:#875A7B;"> App Product Auto Sequence, Auto Code(Variants Supported), Auto Attributes</h2>
<div>
<p>
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.
</p>
<ul>
<li>
Auto Sequence or code for every product.
</li>
<li>
Auto Sequence or for every product variants, like product20171130-001.
</li>
<li>
Product code must be Unique.
</li>
<li>
Define different product type, each product type use own rule of sequence.
</li>
<li>
Quick access in sale , inventory, system menu.
</li>
<li>
Multi language support.
</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>
<div>
<img class="oe_picture oe_screenshot" src="set0.jpg">
</div>
<div>
<img class="oe_picture oe_screenshot" src="set1.jpg">
</div>
<div>
<img class="oe_picture oe_screenshot" src="set2.jpg">
</div>
<h2>Sample Rule: if we create on oct 2017</h2>
<ul>
<li>
Manufactured Products: M20171100001
</li>
<li>
Components Products: C20171100001
</li>
<li>
Sourced Products: S20171100001
</li>
</ul>
<p>
Sepcial for variants. add [-00?]<br/>
<ul>
<li>
Products with color[red]: M20171100001#001
</li>
<li>
Products with color[blue]: M20171100001#002
</li>
<li>
Products with color[white]: M20171100001#003
</li>
</ul>
</p>
<h2>Installation:</h2>
<p>
Prior to installing this module, if you have any existing products you should ensure they already have a
unique reference (or no reference) set.<br/>
Products with a default_code of '/' or empty will automatically be assigned a code of "!!DP!!" followed
by the system id for that product.<br/>
Otherwise the setting of the unique constraint will fail and the module will fail to install.<br/>
Notice:<br/>
Odoo product variants is very special.<br/>
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.<br/>
And we make a rule that the product variants can only create after you create normal product template.
</p>
<h2>How to use: Very simple</h2>
<p>
After installed the app. You can Go to anyone of the menu:<br/>
<ul>
<li>
Sales->Configuration->Products->Product Internal Type
</li>
<li>
Inventory->Configuration->Products->Product Internal Type
</li>
<li>
Settings->Sequences & Identifiers->Product Internal Type
</li>
</ul>
</p>
<p>
You would see the default Product Intertype we create.
<div>
<img class="oe_picture oe_screenshot" src="set3.jpg">
</div>
</p>
<p>
And create the product and code by yourself.
<div>
<img class="oe_picture oe_screenshot" src="set4.jpg">
</div>
</p>
<p>
Notice: The "Sequence Code" Field of sequence must be "product.product"
<div>
<img class="oe_picture oe_screenshot" src="set5.jpg">
</div>
</p>
Go to Prior to installing this module, if you have any existing products you should ensure they already have
a
unique reference (or no reference) set.<br/>
Products with a default_code of '/' or empty will automatically be assigned a code of "!!DP!!" followed
by the system id for that product.<br/>
Otherwise the setting of the unique constraint will fail and the module will fail to install.<br/>
Notice:<br/>
Odoo product variants is very special.<br/>
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.<br/>
And we make a rule that the product variants can only create after you create normal product template.
</p>
</div>
</div>
</section>
<section class="oe_container oe_separator">
</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</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="http://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>http://www.sunpop.cn</a>
</div>
</div>
</div>
</section>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -1,15 +0,0 @@
# -*- 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

View File

@@ -1,59 +0,0 @@
# -*- 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,))

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--目录list-->
<record id="product_category_list_view_internal_type" model="ir.ui.view">
<field name="name">product.category.list.internal_type</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_list_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='display_name']" position="after">
<field name="internal_type"/>
</xpath>
</field>
</record>
<!--目录Form-->
<record id="product_category_form_view_internal_type" model="ir.ui.view">
<field name="name">product.category.form._internal_type</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='parent_id']" position="after">
<field name="internal_type"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--产品内部类型list-->
<record id="product_internal_type_tree_view" model="ir.ui.view">
<field name="name">product.internal.type.tree</field>
<field name="model">product.internal.type</field>
<field name="arch" type="xml">
<tree string="Product Internal Type">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="ref"/>
<field name="type"/>
<field name="sale_ok"/>
<field name="purchase_ok"/>
<field name="route_ids" widget="many2many_tags"/>
<field name="link_sequence" context="{'default_code': 'product.product'}"/>
<field name="sequence_prefix"/>
<field name="description"/>
</tree>
</field>
</record>
<!--产品内部类型from-->
<record id="product_internal_type_form_view" model="ir.ui.view">
<field name="name">product.internal.type.form</field>
<field name="model">product.internal.type</field>
<field name="arch" type="xml">
<form string="Product Internal Type">
<sheet>
<div class="oe_title">
<label class="oe_edit_only" for="name" string="Display Name"/>
<h1>
<field name="name"/>
</h1>
</div>
<group>
<group>
<field name="ref"/>
<field name="sequence"/>
</group>
<group>
<field name="description"/>
</group>
</group>
<group>
<field name="link_sequence"/>
<field name="sequence_prefix"/>
</group>
<group string="Auto Set Product's Value To:">
<group>
<field name="type"/>
<field name="route_ids" widget="many2many_checkboxes"/>
</group>
<group>
<field name="sale_ok"/>
<field name="purchase_ok"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="internal_type_action" model="ir.actions.act_window">
<field name="name">Product Internal Type</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.internal.type</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="internal_type_action" id="menu_internal_type_action_sys" parent="base.next_id_5"/>
<!--<menuitem action="internal_type_action" id="menu_internal_type_action_sale"-->
<!--parent="sale.prod_config_main" sequence="6" groups="base.group_no_one"/>-->
<!--<menuitem action="internal_type_action" id="menu_internal_type_action_purchase"-->
<!--parent="purchase.menu_product_in_config_purchase" sequence="3" groups="base.group_no_one"/>-->
<menuitem action="internal_type_action" id="menu_internal_type_action_stock"
parent="stock.menu_product_in_config_stock" sequence="3"/>
</data>
</openerp>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--产品list-->
<record id="product_product_tree_view" model="ir.ui.view">
<field name="name">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='name']" position="after">
<field name="internal_type"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--产品list-->
<record id="product_template_tree_view" model="ir.ui.view">
<field name="name">product.template.product.tree</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='type']" position="before">
<field name="internal_type"/>
</xpath>
</field>
</record>
<!--产品Form-->
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.common.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='options']" position="before">
<div>
<h4>
<label class="oe_edit_only" for="internal_type"/>
<field name="internal_type" options="{'no_create': True,'no_open': True}" required="1"/>
</h4>
</div>
</xpath>
</field>
</record>
<!--改产品默认视图为tree-->
<record id="product.product_template_action" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_type">form</field>
<field name="view_id" ref="product.product_template_kanban_view"/>
<field name="context">{"search_default_filter_to_sell":1}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p>
<p>
You must define a product for everything you sell, whether it's a physical product, a consumable or a service you offer to customers.
</p>
<p>
The product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods,
etc.
</p>
</field>
</record>
</data>
</openerp>

View File

@@ -1,18 +0,0 @@
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/

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from hooks import pre_init_hook
from . import models
from . import ir
from . import res

View File

@@ -30,7 +30,6 @@
'description': """
模块开发模板,目录结构与文件定义。
""",
'pre_init_hook': 'pre_init_hook',
'depends': ['stock'],
'images': ['static/description/demo1.jpg'],
# 'currency': 'EUR',

View File

@@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# Created on 2017-11-22
# 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):
"""
数据初始化,只在安装时执行,更新时不执行
"""
try:
# --设置barcode默认=物料编码
cr.execute("delete from ir_ui_view where name like '%.readonly';")
except Exception, e:
raise Warning(e)

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from .hooks import pre_init_hook
from . import controllers
from . import models
from . import ir

View File

@@ -59,7 +59,6 @@
'js': [
],
'images': ['static/description/app_web_enterprise_03.jpg'],
'pre_init_hook': 'pre_init_hook',
'post_load': None,
'post_init_hook': None,
'installable': True,

View File

@@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# Created on 2017-11-22
# 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):
"""
数据初始化,只在安装时执行,更新时不执行
"""
try:
#
pass
except Exception as e:
raise Warning(e)