How to write domain filter onchange function for one2many field.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Buchhaltung
- Lager
- PoS
- Project
- MRP
Diese Frage wurde gekennzeichnet
1
Antworten
5094
Ansichten
dear Giezel Esteves,
for v7:
def on_change_company_id(self, cr, uid, ids, company_id=False, context=None): res= {} currency_id= False company_journal_ids= [] if company_id: company_journal_obj= self.pool.get('company.journal.configuration') company_journal_ids= company_journal_obj.search(cr, uid, [('company_id','=',company_id)], context=context) res= {'domain':{'company_ids':[('id','in',company_journal_ids)]}} return res |
<field name="company_id" on_change="on_change_company_id(company_id)"/> <field name="company_ids"/> |
on v8:
@api.multi @api.onchange('company_id') def on_change_company_id(self): res= {} company_list= [] if self.company_id: company_journal_obj= self.env['company.journal.configuration'] company_journal_ids=company_journal_obj.search([('company_id','=', self.company_id.id)]) for record in company_journal_ids: company_list.append(record.id) res= {'domain':{'company_ids':[('id','in',company_list)]}} return res |
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
RegistrierenVerknüpfte Beiträge | Antworten | Ansichten | Aktivität | |
---|---|---|---|---|
|
0
Sept. 23
|
2081 | ||
|
0
Sept. 23
|
1828 | ||
|
2
Juni 25
|
11307 | ||
|
6
Okt. 23
|
22168 | ||
|
3
März 24
|
9573 |