I have
many2onefieldname_idinmy_model.xmlview.I want to filter and have possibility select from
name_idfield only these values which have a relation with active form view model.Example:
I have
'my.model'class records:id = 1 title = 'Aloha' id = 2 title = 'Bye'
'my.model.line'class records:id = 1 name = 'first' my_model_id = 1 id = 2 name = 'second' my_model_id = 1 id = 3 name = 'item' my_model_id = 2So when I open form view, and click on add an item from
name_id many2one field I want to have selection only from values: 'first', 'second' if active 'my.model' id = 1. If 'my.model' id = 2name_id many2one field selection just from 'item' value.my_model.xml <record model="ir.ui.view" id="view_my_model_form"> <field name="name">my.model.form</field> <field name="model">my.model</field> <field name="arch" type="xml"> <form string="My Model"> <header> <field name="my_model_line"> <tree> field name="name"/> </tree> </field> <notebook> <page> <field name="supply_conditions_status"> <tree string="My model Lines"> <field name="name_id"/> </tree>Models:
class SupplyConditions(models.Model): _name = 'supply.conditions' name_id = fields.Many2one('my.model.line', string='Product') model_id = fields.Many2one('my.model') class MyModelLine(models.Model): _name = 'my.model.line' name = fields.Char('Name') my_model_id = fields.Many2one('my.model') class MyModel(models.Model): _name = 'my.model' title = fields.Char('Title') my_model_line = fields.One2many('my.model.line', 'my_model_id') supply_conditions_status = fields.One2many('supply.conditions', 'model_id')I have no idea how to do this. Can't use domain on xml view because can't reach active 'my.model' id. Tried on name_id use _default_value but nothing.. Maybe with relations but also have no idea how. Need any hints..
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- Müşteri İlişkileri Yönetimi
- e-Commerce
- Muhasebe
- Envanter
- PoS
- Project
- MRP
Bu soru işaretlendi
3572
Görünümler
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Ol| İlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
|---|---|---|---|---|
|
|
1
Ara 16
|
7608 | ||
|
|
5
Eki 22
|
16353 | ||
|
|
0
Nis 16
|
3666 | ||
|
|
1
Eki 15
|
5074 | ||
|
|
0
Eki 23
|
3461 |