콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
30136 화면

Hi guyz, I'm getting this error: RuntimeError: maximum recursion depth exceeded. But the code was working fine before sometime.

When I searched regarding this issue, many results pointed to execution time taken due to python and also explanations were difficult to understand.

Can anyone give me suggestion regarding this error.

In sample.py:

from osv import fields, osv
import time

class sample(osv.osv):
    def onchange_state(self, cr, uid, ids, state_id, context=None):
        if state_id:
            country_id = self.pool.get('res.country.state').browse(cr, uid, state_id, context).country_id.id
            return {'value':{'country_id':country_id}}
        return {}   
    def _calculate(self, cr, uid, ids, fields, arg, context):
        x={}
        for record in self.browse(cr, uid, ids):
            x[record.id]= record.field_a + record.field_b
        return x
    _name = "sample"
    _table = "sample"
    _rec_name = "name"
    _log_access = True
    _description = "Simple Form"
    _columns = {
             'name':fields.char('Name', size=32, required=True),
             "age" : fields.integer("age"),
             "length": fields.integer("length"),    
             'address': fields.text('Address'),
             'flag': fields.boolean('Flag'),
             'date': fields.date('Date'),
             'datetime': fields.datetime('Date with Time'),
             'confirm': fields.selection((('unconfirmed', 'Unconfirmed'), ('confirmed', 'Confirmed')),
                  'Selection Box'),
             'image': fields.binary("Image"),
             "phone" : fields.char("phone"),

             'user_id': fields.many2one('res.users', 'Salesperson'),
             'partner_id': fields.many2one('res.partner', 'Customer', ondelete='cascade'),
             'location_id' : fields.related('location_id', type="many2one", relation="stock.location", string="Location Id"),
             'state_id': fields.many2one("res.country.state", 'State'),
             'country_id': fields.many2one('res.country', 'Country'),
             'country': fields.related('country_id', type='many2one', relation='res.country', string='Country'), 

             'duration' : fields.float('Duration'),

             'field_a' : fields.integer('Number1') ,
             'field_b' : fields.integer('Number2'),
             'result'  : fields.function(_calculate, type='integer', obj='sample', method=True, store=False, string='Result'),
    }

    _defaults = {  
        'date': fields.date.context_today,
        }

sample()

In sample_view.xml:

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>

        <record model="ir.ui.view" id="test_tree_view">
            <field name="name">test.tree</field>
            <field name="model">sample</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="test" toolbar="1">
                    <field name="name" />
                    <field name="age" />
                    <field name="date" />
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="test_form_view">
            <field name="name">test.form</field>
            <field name="model">sample</field>
            <field name="arch" type="xml">
                <form string="test" version="7.0">

                    <header>
                        <button name="header_button" string="Create" type="object" />
                        <field name="confirm" widget="statusbar" statusbar_visible="unconfirmed,coked"
                            statusbar_colors='{"unconfirmed":"red","confirmed":"blue"}'
                            clickable="True" />
                        <!-- <field name="name" widget="statusbar" statusbar_visible="draft,sent,invoiced,done" 
                            statusbar_colors='{"draft":"red","done":"blue"}' /> -->
                    </header>

                    <sheet>
                        <group>
                            <label string="Label" colspan="2" />
                            <field name="name" select="1" />
                            <field name="state_id" string="State" onchange="onchange_state" />
                            <field name="country_id" string="Country" />
                            <field name="country" />
                            <field name="location_id" /> 
                            <separator string="seperator tag inserted here"
                                colspan="4" />
                            <newline />
                            <notebook colspan="4" tabpos="up">
                                <page string="basic data field">
                                    <group>
                                        <field name="age" select="2" />
                                        <field name="length" select="3" />
                                        <field name="address" placeholder="Provide current address..." />
                                        <field name="flag" />
                                        <field name="date" />
                                        <field name="datetime" />
                                        <field name="confirm" />
                                        <field name="image" />
                                        <field name="state_id" />
                                        <field name="country_id" />
                                    </group>
                                </page>
                                <page string="relational data field">
                                    <group>
                                        <field name="user_id" string="user_id(many2one)" />
                                        <!-- <field name="partner_ids" string="partner_ids(one2many)" /> -->
                                    </group>
                                </page>
                                <page string="functional data field">
                                    <group>
                                        <field name="field_a" />
                                        <field name="field_b" />
                                        <field name="result" />
                                    </group>
                                </page>
                                <page string="calendar">
                                    <group>
                                        <field name="user_id" string="conducted by" />
                                        <field name="datetime" string="scheduled date" />
                                        <field name="duration" />
                                        <field name="partner_id" string="member to attend" />
                                    </group>
                                </page>
                            </notebook>
                        </group>

                        <!-- <button name="Submit" string="Button" icon="STOCK_APPLY" special="save" 
                            colspan="2" type="action" target="new" confirm="Ask for Confirmation" /> -->

                    </sheet>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="sample_kanban_view">
            <field name="name">Kanban</field>
            <field name="model">sample</field>
            <field name="arch" type="xml">
                <kanban>
                    <field name="name" />
                    <!-- <field name="code" /> <field name="lst_price" /> -->
                    <templates>
                        <t t-name="kanban-box">
                            <div class="oe_kanban_vignette oe_semantic_html_override">
                                <a type="open">
                                    <img t-att-src="kanban_image('sample', 'image', record.id.value)"
                                        class="oe_kanban_image" />
                                </a>
                                <div class="oe_kanban_details">
                                    <h4>
                                        <a type="open">
                                            <!-- <t t-if="record.code.raw_value"> [ <field name="code" /> 
                                                ] </t> -->
                                            <field name="name" />
                                        </a>
                                    </h4>
                                    <div name="tags" />
                                    <ul>
                                        <li>
                                            Age:
                                            <field name="age"></field>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>

        <record model="ir.ui.view" id="sample_graph">
            <field name="name">sample.graph</field>
            <field name="model">sample</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Graph string" orientation="horizontal" type="bar">
                    <field name="name" group="True" />
                    <field name="age" operator="*" />
                </graph>
            </field>
        </record>

        <record model="ir.ui.view" id="sample_calendar_view">
            <field name="name">sample.calendar</field>
            <field name="model">sample</field>
            <field name="type">calendar</field>
            <field name="arch" type="xml">
                <calendar string="Reminders" date_start="datetime" color="user_id"
                    date_delay="duration" mode="week">
                    <field name="name" modifiers="{'required': true}" />
                    <field name="partner_id" modifiers="{}" />
                </calendar>
            </field>
        </record>

        <record model="ir.ui.view" id="sample_search_view">
            <field name="name">sample.search</field>
            <field name="model">sample</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search>
                    <group expand="1" string="Group By...">
                        <filter string="Users" icon="terp-project" domain="[]"
                            context="{'group_by':'user_id'}" />
                        <filter string="Partner" icon="terp-project" domain="[]"
                            context="{'group_by':'partner_id'}"  />
                        <separator orientation="vertical" />
                        <filter string="Date" icon="terp-project" domain="[]"
                            context="{'group_by':'date'}" />
                        <filter string="Current State" domain="[('confirm','in',('unconfirmed','confirmed'))]" help="Confirmed and Unconfirmed Tasks" icon="terp-project"/>
                        <field name="location_id" string="Location"
                            filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]" />
                    </group>
                </search>
            </field>
        </record>

        <record model="ir.ui.view" id="sample_gantt_view">
            <field name="name">sample.gantt</field>
            <field name="model">sample</field>
            <field name="type">gantt</field>
            <field name="arch" type="xml">
                <gantt color="user_id" date_delay="duration" date_start="datetime"
                    string="Tasks" mode="3months">
                    <level object="crm.make.sale" link="partnet_id" domain="[]">
                        <field name="name" />
                    </level>
                </gantt>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_test_form">
            <field name="name">sample</field>
            <field name="res_model">sample</field>
            <field name="view_type">form</field>
            <field name="view_mode">kanban,tree,form,graph,calendar,gantt</field>
        </record>

        <menuitem name="testParent" icon="terp-project" id="testParent_menu"
            sequence="0" />

        <menuitem name="NotesChild" parent="testParent_menu" id="NotesChild_menu" />

        <menuitem name="Header" parent="NotesChild_menu" id="Header_menu_mainform"
            action="action_test_form" />
    </data>

</openerp>

__openerp__.py:

#coomentnds
{
    "name" : "sample",
    "version" : "0.1",
    "author" : "Atchuthan",
    "category" : "Generic Modules/Others",
    "depends" : ["base", "stock"],
    "description" : "Simple demo form",
    "demo_xml" : [],
    "data" : ["sample_view.xml"],
    "active": False,
    "installable": True
}
아바타
취소

what is the name of the module you were working with? were you working with partners, categories, or bill of materials?

작성자

i created a custom module

could you post it? looks like there is a bug in your module

작성자

code added

the code looks OK, could you post the traceback?

작성자

traceback updated

작성자

This code is working properly fine now... So why was there a error?

No code changes done.

베스트 답변

https://answers.launchpad.net/openobject-addons/+question/179149

check this answer.may be this answer will help you.

Thank you.

아바타
취소
작성자

I already viewed this link with OpenERP bug issues @ https://bugs.launchpad.net/openobject-addons/+bug/891474.

They are telling it as "configuration mistake" but why is it working fine now?..

I didnt change any code to remove error. Today when I tried to open my custom module, it worked fine.

베스트 답변

It seems problem is in following line:

for picking, todo in self._chain_compute(cr, uid, moves, context=context).items():
아바타
취소
관련 게시물 답글 화면 활동
1
12월 24
2320
0
11월 24
871
2
7월 24
1994
0
4월 24
1498
3
3월 24
1356