Skip to Content
Menu
This question has been flagged
2 Replies
1309 Views

I'm new to Odoo 12. And still testing...

How can  i add/change the values of the Type Field in the parts section?

https://www.dropbox.com/s/jthsspqioiom65u/OdooFrage.jpg?dl=0


Avatar
Discard
Author Best Answer

sorry for the delay...

Thanks for your answer. But where do I have to put this in? A file? Somewhere in the settings.?

Avatar
Discard
Best Answer

Hello,

From the image what I can see is, your field is a selection field.

You can use selection_add= to just Add or Modify the value of a key in the selection field.

If you want to Change/Remove the key, you can redefine the selection field.

See the examples:


# Initial
# -------
class YourClass(models.Model):
_inherit = 'your.model'

your_selection_field = fields.Selection([('draft', 'Draft'),
('confirmed', 'Confirmed')],
string='State')

# Change/Remove the key
# ---------------------
class YourClass1(models.Model):
_inherit = 'your.model'

your_selection_field = fields.Selection([('draft', 'Draft'),
('open', 'Open'),
('close', 'Close')], string='State')


# Add or Modify the value of a key
# --------------------------------
class YourClass2(models.Model):
_inherit = 'your.model'

your_selection_field = fields.Selection(selection_add=[('close', 'End'),
('reject', 'Reject')])



Thanks & Regards

Avinash N K

Avatar
Discard