This question has been flagged
2 Replies
6270 Views

I am new to odoo and python. I am working on a module, I need to hide a button by calling a method from ".xml" file, function definition and body is in ".py" file. Currently am trying to hide button like that

<button confirm="Are you sure you want to start the test?" name="set_to_test_inprogress" states="Invoiced" string="Start Test" type="object" class="oe_highlight"groups="oehealth.group_oeh_medical_physician,oehealth.group_oeh_medical_manager" attrs="{'invisible': [('start_button', '=', False)]}"/>

and "start_button" column is in ".py" file with code like that

def _start_test_button(self, cr, uid, ids, field_name, arg, context):

return False

_columns = {

'start_button': fields.function(_start_test_button, type="boolean", obj="generic.request", method=True),

}

and that python code is in class named "OeHealthLabTests". When create a lab it shows error which is

Uncaught Error: Unknown field start_button in domain [["start_button","=",false],["state","not in",["Invoiced"]]]

Am confused and i didn't find a way yet to make it happen. Please guide me how can i do that.

Thank You

Avatar
Discard
Best Answer

Good day. Because the field start_button doesn't exist on the *form* view (even though it does exist in Python and in the database), Odoo will throw that error: "Unkown field start_button..." The solution is to add the field to the form view like so:

<field name="start_button" />

If you don't want anybody to see the field, just add the invisible attribute like so:

<field name="start_button" invisible="1" />

Avatar
Discard
Author Best Answer

Thank You @Andre. As i mentioned in my previous message that i am totally new to python and odoo, i have 2 more questions.


1. Are there any video tutorials for beginners on odoo development, if yes then please send me link

2. I installed odoo source on my local system using these instructions http://www.mindissoftware.com/2014/09/08/Odoo-PyCharm-Windows-installation/ , and i purchased "oeHealth" odoo module. When i install or upgrade that module it takes too much time (approx 30 minutes), is there any other way to upgrade that module ?

Avatar
Discard