Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX]account_payment_group:order lines by date maturity #333

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions account_payment_group/models/account_payment_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,22 @@ def _compute_matched_move_line_ids(self):
al revz (debit_move_id vs credit_move_id)
"""
for rec in self:
<<<<<<< HEAD
payment_lines = rec.payment_ids.mapped('line_ids').filtered(lambda x: x.account_internal_type in ['receivable', 'payable'])
rec.matched_move_line_ids = (payment_lines.mapped('matched_debit_ids.debit_move_id') | payment_lines.mapped('matched_credit_ids.credit_move_id')) - payment_lines
||||||| parent of 3fc702af... temp
payment_lines = rec.payment_ids.mapped('move_line_ids').filtered(lambda x: x.account_internal_type in ['receivable', 'payable'])
rec.matched_move_line_ids = (payment_lines.mapped('matched_debit_ids.debit_move_id').sorted(key=lambda x: x.date_maturity) | payment_lines.mapped('matched_credit_ids.credit_move_id')).sorted(key=lambda x: x.date_maturity) - payment_lines
=======
payment_lines = rec.payment_ids.mapped('move_line_ids').filtered(lambda x: x.account_internal_type in ['receivable', 'payable'])
debit_moves = payment_lines.mapped('matched_debit_ids.debit_move_id')
credit_moves = payment_lines.mapped('matched_credit_ids.credit_move_id')
debit_lines_sorted = debit_moves.filtered(lambda x: x.date_maturity != False).sorted(key=lambda x: x.date_maturity)
credit_lines_sorted = credit_moves.filtered(lambda x: x.date_maturity != False).sorted(key=lambda x: x.date_maturity)
debit_lines_without_date_maturity = debit_moves - debit_lines_sorted
credit_lines_without_date_maturity = credit_moves - credit_lines_sorted
rec.matched_move_line_ids = ((debit_lines_sorted + debit_lines_without_date_maturity) | (credit_lines_sorted + credit_lines_without_date_maturity)) - payment_lines
>>>>>>> 3fc702af... temp

@api.depends('payment_ids.line_ids')
def _compute_move_lines(self):
Expand Down