Hello! How to set a custom or default values on a m2m tag widget?
for example:
In a tax types field, there are 3 types, "income", "value" and "excise"
i want that 3 to be the default value and there is no edit or create.
please help thanks!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello! How to set a custom or default values on a m2m tag widget?
for example:
In a tax types field, there are 3 types, "income", "value" and "excise"
i want that 3 to be the default value and there is no edit or create.
please help thanks!
Hello Nissan,
You can call a method in default and can set the taxes by searching the records.
Ex:
@api.model
def get_taxes(self):
return self.env['my.tax.tax'].search([('type', 'in', ['income', 'value', 'excise'])]).ids
my_taxes = fields.Many2many(default=get_taxes, ...)
Hope this help you.
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
How can i group by CRM Tag in odoo version 14
Diselesaikan
|
|
2
Okt 21
|
5175 | |
many2many_tags drag to change position
Diselesaikan
|
|
1
Apr 17
|
6276 | |
Many2many domain filter not working
Diselesaikan
|
|
1
Jan 22
|
5744 | |
Cannot execute name_create, no _rec_name defined
Diselesaikan
|
|
1
Jan 22
|
10674 | |
Adding Many2many field to Odoo Reports
Diselesaikan
|
|
2
Jun 25
|
6316 |
Hello! thank you for fast reply. Sorry noob here but I don't understand what does def get_taxes do. Can you explain it to me please? and i want my field to like a combo box but in a m2m tag form/widget
get_taxes method will be called when you are creating a record. This method will return the IDs of those taxes which are of given type.