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

I write a "def confirm_sale(self, cr, uid, ids, context=None):…………" in saly.py/class sale.order, and i write the "ir.actions.server" like:

<record id="action_sale_order_action_cancel" model="ir.actions.server">
<field name="name">Cancel1</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_sale_order"/>
<field name="state">code</field>
**<field name="code">obj.confirm_sale(context=context)</field>**
</record>
<record id="id_action_sale_order_action_cancel" model="ir.values">
<field name="name">Cancel</field>
<field name="action_id" ref="action_sale_order_action_cancel"/>
<field name="value" eval="'ir.actions.server,' + str(ref('action_sale_order_action_cancel'))"/>
<field name="key">action</field>
<field name="model_id" ref="model_sale_order"/>
<field name="model">sale.order</field>
<field name="key2">client_action_multi</field>
</record>

but it always take the error:
" openerp.tools.safe_eval: Cannot eval u'obj.confirm_sale(context=context)' "

" AttributeError: "Field 'confirm_sale' does not exist in object 'browse_record(sale.order, 10)'" "

But if I replace confirm_sale with action_button_confirm , which has already exist in saly.py, it can work ..

I think I should add something more..But I don't know how to collect...

아바타
취소
베스트 답변

If I understand you correctly, when using the method action_button_confirm it is working, while using the method confirm_sale you get an error? If that is true, did you restart the openERP server, so that it knows the changed code, and have you reloaded (or loaded for the first time) your module?

아바타
취소
작성자

yeah .....when I restart it ...it can work......................................thanks :D