minor fix

This commit is contained in:
Wilson Gomez 2023-03-08 17:07:02 -05:00
parent cfd8abe2f8
commit 7413cd7055
2 changed files with 25 additions and 8 deletions

View File

@ -218,14 +218,15 @@ class Collection(ModelSQL, ModelView):
collection_percent = fields.Function(fields.Numeric(
'Collection Percent', digits=(2, 2), readonly=True), 'get_collection_percent')
move = fields.Many2One("account.move", "Move")
lines_move = fields.Function(fields.One2Many("account.move.line", "move", "Lines"), 'get_lines')
lines_move = fields.Function(fields.One2Many("account.move.line", "move", "Lines"), 'get_lines',
searcher='search_lines_move')
@classmethod
def __setup__(cls):
super(Collection, cls).__setup__()
cls._order = [
('line', 'DESC'),
]
# cls._order = [
# ('line', 'DESC'),
# ]
@classmethod
def __register__(cls, module_name):
@ -350,12 +351,27 @@ class Collection(ModelSQL, ModelView):
}
if clause[1] in reverse:
if clause[2]:
return [('line.reconciliation', clause[1], None)]
return [('lines_move.reconciliation', clause[1], None)]
else:
return [('line.reconciliation', reverse[clause[1]], None)]
return [('lines_move.reconciliation', reverse[clause[1]], None)]
else:
return []
@classmethod
def search_lines_move(cls, name, clause):
# FIX ME
# reverse = {
# '=': '!=',
# '!=': '=',
# }
# if clause[1] in reverse:
# if clause[2]:
# return [('lines_move.reconciliation', clause[1], None)]
# else:
# return [('lines_move.reconciliation', reverse[clause[1]], None)]
# else:
return []
@classmethod
def _overdue_line_domain(cls, date):
return [
@ -414,7 +430,8 @@ class Collection(ModelSQL, ModelView):
lines = MoveLine.search(cls._overdue_line_domain(date))
move_ids = list(set(ml.move.id for ml in lines))
moves = list(set(ml.move for ml in lines))
moves_exist = cls.search([('move', 'in', move_ids), ])
cls.search([], limit=1)
moves_exist = cls.search([('move', 'in', move_ids)])
moves_exist = [c.move.id for c in moves_exist]
collections = (cls._get_collection(move, date)
for move in moves if not move.id in moves_exist)

View File

@ -1,5 +1,5 @@
[tryton]
version=6.0.3
version=6.0.5
depends:
account
company