Hi, ...
I want to question ...
How make field become invisible but type field is Selection ....
I Use code like :
<field name="code_ahm" attrs="{'invisible': [('customer','!=',True)]}"/>
thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi, ...
I want to question ...
How make field become invisible but type field is Selection ....
I Use code like :
<field name="code_ahm" attrs="{'invisible': [('customer','!=',True)]}"/>
thanks
You can use invisible="1" in xml field.
<field name="name" invisible="1" />
If customer field is a selection, you usually do the reverse: [('customer', '=', False)]
so my code become :
<field name="code_ahm" attrs="{'invisible': [('customer','!=',1)]}"/> ?
Right ?
@Ivan
Ivan, type Customer field is boolean ...
You mentioned that "... but type field is Selection ...." Anyway, if you need to domain by a selection field you can use treat it as normal character field with the value being the code of the selection chosen, e.g. [('selection_field', '=', 'value1')], [('selection_field', 'in', ('value1', 'value2'))], etc.
You mentioned that "... but type field is Selection ...." Anyway, if you need to domain by a selection field you can use treat it as normal character field with the value being the code of the selection chosen, e.g. [('selection_field', '=', 'value1')], [('selection_field', 'in', ('value1', 'value2'))], etc.
--
Ivan
Sent by Odoo Inc. using Odoo about Forum Post False
As the value is only available after the record is displayed this can only be done from view XML. I see that you have pilih field as the selection field, right? 'b' and 'c' are the values. First, if you want to use the field in domain, you need to include the field first, which I see have been included in res_partner_formBranch_view. Then you use it like: attrs="{'invisible': [('pilih','!=','c')]}" if you want to hide, say, the tgl_lahir field if the pilih field is not 'c'.
As the value is only available after the record is displayed this can only be done from view XML. I see that you have pilih field as the selection field, right? 'b' and 'c' are the values. First, if you want to use the field in domain, you need to include the field first, which I see have been included in res_partner_formBranch_view. Then you use it like: attrs="{'invisible': [('pilih','!=','c')]}" if you want to hide, say, the tgl_lahir field if the pilih field is not 'c'.
@Heru, please post a different question, don't mixed the subject. The image is not displayed, so I can't help you. Also, please consider learning grep (http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_02.html). You can find a lot of examples from the official addons module. That's, AFAIK, is the best route for learning the basics.
@Heru, please post a different question, don't mixed the subject. The image is not displayed, so I can't help you. Also, please consider learning grep (http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_02.html). You can find a lot of examples from the official addons module. That's, AFAIK, is the best route for learning the basics.
I try to make function field .
def _get_groups(self, cr, uid, ids, field_name, args, context=None):
x = self.pool.get("res.users").browse(cr, uid, uid)['groups_id']
#is self.group_id in x ?
return self.group_id in x
def _cek_groups(self, cr, uid, obj, name, args, context=None):
res = []
x = self.pool.get("res.users").browse(cr, uid, uid)['groups_id']
ids = obj.search(cr,uid,[]) # ids of visits
for v in self.browse(cr, uid, ids): # foreach visit
if all(v.group_id == y[0] for y in x) :
res.append(v.id)
return [('id','in',res)]
columns :
'abc':fields.function(_get_groups, string="ABC", type="boolean", fnct_search=_cek_groups)
my xml code shown below :
<record model="ir.actions.act_window" id="approval_portal_action">
<field name="name">Portal Approval Matrix Biaya</field>
<field name="res_model">wtc.approval.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="domain">[('sts','=','1'),('abc','=',True)]</field>
</record>