首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RuntimeError:在odoo中使用拆分()函数时调用Python时超过了最大递归深度

RuntimeError:在odoo中使用拆分()函数时调用Python时超过了最大递归深度
EN

Stack Overflow用户
提问于 2016-10-18 06:00:47
回答 1查看 978关注 0票数 0

RuntimeError:在调用对象时超过了最大递归深度,当我在odoo 9中使用Python的拆分函数作为选择字段或Many2one字段时,我得到了这个错误。

我想分割字符串,并与其他字符串连接,但首先,我必须将它分开,另一个。但是,它显示了对split()的上述错误。请帮我摆脱它.

这是.py文件

代码语言:javascript
复制
from  openerp import models, fields, api
import sys
sys.setrecursionlimit(1500)
class erp_product_template(models.Model):
_name='product.template' 
    _inherit='product.template'
    erp_sub=fields.Many2one("product.sub11",string="Sub Category")
    erp_cats=fields.Many2one("product.maincats",string="Main Category")

    temp1=fields.Char("Testing Char Field")
    temp1=erp_sub.split("/")

    class erp_MainModal(models.Model):
        _name="product.maincats"
        name=fields.Selection([('SL0','SL0'),('SL1','SL1'),('SL2','SL2'),('SL3','SL3'),('SL4','SL4'),('SL5','SL5'),('SL6','SL6'),('SL7','SL7'),('SL8','SL8')]) 

    class erp_sub11(models.Model):
        _name="product.sub11"
        name=fields.Selection([('ECDS0','SL0/ECDS0'),('ECDS1','SL0/ECDS1'),('ECDS2','SL0/ECDS2'),('ECDS3','SL0/ECDS3')])    

    class erp_sub_sub1(models.Model):
        _name="product.sub_sub1"
        name=fields.Selection([('08','ECDS0/08'),('09','ECDS0/09'),('10','ECDS2/10'),('11','ECDS3/11')])   

这是xml文件

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="erp_product_template_tree_view" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_tree_view" /> 
<field name="model">product.template</field>
<field name="arch" type="xml">
<field name="type" position="after"> 
<field name="erp_cats"/>   
</field>
</field>
</record>

<record id="erp_product_template_only_form_view" model="ir.ui.view">
<field name="inherit_id" ref="product.product_template_only_form_view" /> 
<field name="model">product.template</field>
<field name="arch" type="xml">
<field name="type" position="after">   
<field name="erp_cats"/>  
<field name="erp_sub"/> 
</field>
</field>
</record>
</data>
</openerp>
EN

回答 1

Stack Overflow用户

发布于 2016-10-18 06:07:37

您可以增加递归深度

代码语言:javascript
复制
import sys
sys.setrecursionlimit($)   # replace $ with any number greater than 1000

`

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40100626

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档