Hello folks.
I have a model on my odoo that is populate by a XML when it is upgrade/installed.
I am trying to get the values of a column of this model to make a selection list into a form.
class ChargeRule(models.Model):
"""
Class storing line item charge type lookup for Finance table logic .
"""
_name = 'guimarc.linechargerule'
line_type = fields.Char('line_type', required=True)
loc = fields.Char('loc', required=True)
prod_type = fields.Char('prod_type', required=True)
cost_element = fields.Char('cost_element', required=True)
So I want create a form that will have the field called cost element as well for the user be able to create a new entry.
However the entry only can be allowed with the names that are already stored into the guimarc.linechargerule.
1 - I have put this on the new model :
cost_element = fields.Many2one('ibmfinance.linechargerule',string='cost_element')
2 - On my form I have created like this :
<form string="Fiance master cost" create="true" editable="top" delete="true">
<sheet string="Finance Master Cost">
<group>
<group>
<field name="cost_element"/> ---- HERE
<field name="loc"/>
<field name="cost"/>
<field name="created_by"/>
<field name="activate_date"/>
</group>
</group>
</sheet>
</form
so when I open my form it comes a drop LIST however with the IDS only like guimarc.linechargerule,1 guimarc.linechargerule,2 and etc.
I would like to see on the field the value of cost_element not the IDS.. the values of cost element.
Could you please help me on that?
Thank you so much team
If I understand correctly, try this
<field name="cost_element">
<tree name="cost">
<field name="cost_element"/>
</tree>
</field>