RuntimeError:在调用对象时超过了最大递归深度,当我在odoo 9中使用Python的拆分函数作为选择字段或Many2one字段时,我得到了这个错误。
我想分割字符串,并与其他字符串连接,但首先,我必须将它分开,另一个。但是,它显示了对split()的上述错误。请帮我摆脱它.
这是.py文件
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文件
<?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>发布于 2016-10-18 06:07:37
您可以增加递归深度
import sys
sys.setrecursionlimit($) # replace $ with any number greater than 1000`
https://stackoverflow.com/questions/40100626
复制相似问题