Link a button to a python function from my model (Odoo 8) -
i trouble linking button function (python) model. searched on net got few informations odoo 8. code right now:
my function model (mymodule.service):
def main_val(self, context=none): if context none: context = {} [...]
the view associated:
<record model="ir.ui.view" id="view_myodule_clients_tree"> <field name="name">mymodule.clients.tree</field> <field name="model">mymodule.service</field> <field name="inherit_id" ref="base.view_partner_tree"/> <field name="arch" type="xml"> <field name="display_name" position="after"> <button name="main_val" type="object" string="bill" class="oe_highlight" /> </field> </field> </record>
i keep having error:
error details: field `function` not exist
and can't figure out why.
do have idea? thanks
if want call python function on button click must have set same method name in button name attribute , button type attributes object.
i give small demo check 1 hand
def main_val(self,cr,uid,ids,context=none): if context none: context = {} # logic set on hear return true
you have set same name attribute in xml file button name attribute
<button name="main_val" type="object" string="bill" class="oe_highlight" />
you can check method arguments , update module , click button
i hope should helpful ..:)
Comments
Post a Comment