تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
5740 أدوات العرض

When I try to add a button with loop action in the tree view I get this error :

ValueError: "name 'records' is not defined" while evaluating
u'for rec in records:\n\t\t\t\t\trec.action_update_period_loop()'

and here the source :
<record id="action_update_period" model="ir.actions.server"> <field name="name">mettre à jour la periode</field> <field name="model_id" ref="account.model_account_payment"/> <field name="state">code</field> <field name="code"> for rec in records: rec.action_update_period_loop() </field> </record> <record id="ir_update_period" model="ir.values"> <field eval="'client_action_multi'" name="key2"/> <field eval="'account.payment'" name="model"/> <field name="name">mettre à jour la periode</field> <field eval="'ir.actions.server,%d'%action_update_period" name="value"/> </record>
please help me fix this error and thanks in advance
الصورة الرمزية
إهمال

Hi,

try this:

<field name="code">

if records:

records.action_update_period_loop()

</field>

And in python, action_update_period_loop would be initiated with with @api.multi and then you loop inside.

Hope this helps. If not write back for further analysis

الكاتب أفضل إجابة

Thanks Ibrahim it works !!!

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
سبتمبر 23
1866
0
سبتمبر 23
1575
2
يونيو 25
10988
6
أكتوبر 23
21828
3
مارس 24
9290