[ADD]Yaltik DSL : add filter_yes_no
This commit is contained in:
parent
1a4bed211a
commit
ae30f47886
@ -19,7 +19,7 @@
|
||||
'name': 'Yaltik Odoo DSL base module and fns',
|
||||
'summary': 'Yaltik Odoo Domain Specific Language base module and functions',
|
||||
'description': """ Yaltik Odoo Domain Specific Language base module and functions """,
|
||||
'version': '16.0.0.5.1',
|
||||
'version': '16.0.0.5.2',
|
||||
'category': 'Yaltik',
|
||||
'author': 'Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -100,6 +100,17 @@ field_arch = lambda *args: field({'name': 'arch', 'type': 'xml'}, *args)
|
||||
filter = lambda *args: xmln('filter', *args)
|
||||
separator = lambda *args: xmln('separator', *args)
|
||||
|
||||
def filter_yes_no(field, str_yes=False, str_no=False):
|
||||
""" Double filter for boolean : True and False """
|
||||
res = []
|
||||
if str_yes:
|
||||
res.append(filter({'name': f'{field}_yes', 'string': str_yes,
|
||||
'domain': f"[('{field}', '=', True)]"}))
|
||||
if str_no:
|
||||
res.append(filter({'name': f'{field}_no', 'string': str_no,
|
||||
'domain': f"[('{field}', '=', False)]"}))
|
||||
return res
|
||||
|
||||
# Views
|
||||
view = lambda xmlid, children: record({'id': xmlid, 'model': 'ir.ui.view'}, children)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# __coconut_hash__ = 0x4944f425
|
||||
# __coconut_hash__ = 0xa5bf2f83
|
||||
|
||||
# Compiled with Coconut version 2.1.1 [The Spanish Inquisition]
|
||||
|
||||
@ -137,7 +137,17 @@ field_arch = lambda *args: field({'name': 'arch', 'type': 'xml'}, *args)
|
||||
filter = lambda *args: xmln('filter', *args)
|
||||
separator = lambda *args: xmln('separator', *args)
|
||||
|
||||
def filter_yes_no(field, str_yes=False, str_no=False):
|
||||
""" Double filter for boolean : True and False """
|
||||
res = []
|
||||
if str_yes:
|
||||
res.append(filter({'name': f'{field}_yes', 'string': str_yes, 'domain': f"[('{field}', '=', True)]"}))
|
||||
if str_no:
|
||||
res.append(filter({'name': f'{field}_no', 'string': str_no, 'domain': f"[('{field}', '=', False)]"}))
|
||||
return res
|
||||
|
||||
# Views
|
||||
|
||||
view = lambda xmlid, children: record({'id': xmlid, 'model': 'ir.ui.view'}, children)
|
||||
|
||||
def view_def(xmlid, name, model, arch):
|
||||
|
Loading…
Reference in New Issue
Block a user