add search rec_name

This commit is contained in:
wilson gomez 2021-09-20 14:41:50 -05:00
parent 7f3ea78849
commit 2236542c47
1 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from trytond.pyson import Not, Bool, Eval, If
from trytond.transaction import Transaction
from trytond.i18n import gettext
from .exceptions import WageTypeValidationError
from trytond.tools import lstrip_wildcard
STATES = {'readonly': Not(Bool(Eval('active')))}
@ -98,6 +99,20 @@ class WageType(ModelSQL, ModelView):
if wage.expense_formula:
wage.compute_expense(test_salary)
@classmethod
def search_rec_name(cls, name, clause):
if clause[1].startswith('!') or clause[1].startswith('not '):
bool_op = 'AND'
else:
bool_op = 'OR'
code_value = clause[2]
if clause[1].endswith('like'):
code_value = lstrip_wildcard(clause[2])
return [bool_op,
('name',) + tuple(clause[1:]),
('code', clause[1], code_value) + tuple(clause[3:]),
]
@staticmethod
def default_unit_price_formula():
return 'salary'