mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
add sequence to support category
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
4.Define different product type, each product type use own rule of sequence.可自定义产品类型,不同产品类型使用不同编码规则。
|
4.Define different product type, each product type use own rule of sequence.可自定义产品类型,不同产品类型使用不同编码规则。
|
||||||
5.Quick access in sale , inventory, system menu.可以在销售、库存、系统菜单中快速定义。
|
5.Quick access in sale , inventory, system menu.可以在销售、库存、系统菜单中快速定义。
|
||||||
6.Multi language support.<br/>多语种支持。
|
6.Multi language support.<br/>多语种支持。
|
||||||
|
7.Setup default Auto Sequence for each product category
|
||||||
""",
|
""",
|
||||||
'pre_init_hook': 'pre_init_hook',
|
'pre_init_hook': 'pre_init_hook',
|
||||||
'depends': [
|
'depends': [
|
||||||
@@ -54,6 +55,7 @@
|
|||||||
# "security/security.xml",
|
# "security/security.xml",
|
||||||
'views/product_template_view.xml',
|
'views/product_template_view.xml',
|
||||||
'views/product_product_view.xml',
|
'views/product_product_view.xml',
|
||||||
|
'views/product_category_view.xml',
|
||||||
'views/product_internal_type_view.xml',
|
'views/product_internal_type_view.xml',
|
||||||
'data/product_sequence.xml',
|
'data/product_sequence.xml',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import product_template
|
import product_template
|
||||||
import product_product
|
import product_product
|
||||||
|
import product_category
|
||||||
import product_internal_type
|
import product_internal_type
|
||||||
27
app_product_sequence/models/product_category.py
Normal file
27
app_product_sequence/models/product_category.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# -*- 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)
|
||||||
@@ -58,3 +58,7 @@ class ProductTemplate(models.Model):
|
|||||||
if len(self.product_variant_ids) == 1:
|
if len(self.product_variant_ids) == 1:
|
||||||
self.product_variant_ids.default_code = self.default_code_stored
|
self.product_variant_ids.default_code = self.default_code_stored
|
||||||
|
|
||||||
|
@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
|
||||||
28
app_product_sequence/views/product_category_view.xml
Normal file
28
app_product_sequence/views/product_category_view.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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"/>
|
||||||
|
<field name="name"/>
|
||||||
|
</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='type']" position="after">
|
||||||
|
<field name="internal_type"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<field name="model">product.template</field>
|
<field name="model">product.template</field>
|
||||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='type']" position="before">
|
<xpath expr="//field[@name='categ_id']" position="after">
|
||||||
<field name="internal_type"/>
|
<field name="internal_type"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user