From cef5137584f5cef30971c0cae8319588283074bf Mon Sep 17 00:00:00 2001 From: jordan <jordan@le-filament.com> Date: Mon, 3 May 2021 15:40:17 +0200 Subject: [PATCH] [fix] function lettrage --- models/scop_cotisations_idf.py | 16 ++++++++-------- models/scop_invoice_idf.py | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/models/scop_cotisations_idf.py b/models/scop_cotisations_idf.py index c6f153d..699379f 100644 --- a/models/scop_cotisations_idf.py +++ b/models/scop_cotisations_idf.py @@ -172,14 +172,14 @@ class ScopCotisationsIDF(models.Model): ['partner_id', '=', partner.id], ['type', '=', 'inv']]) letters = set(invoice_lines.mapped('lettrage')) - if letters: - lines_to_lettre = self.filtered( - lambda l: l.partner_id.id == partner.id - and l.type != 'inv') - for line in lines_to_lettre: - if line.lettrage in letters: - line.invoice_id = invoice_lines.filtered( - lambda l: l.lettrage == line.lettrage)[0] + lines_to_lettre = self.search([ + ['year', '=', year], + ['partner_id', '=', partner.id], + ['type', '!=', 'inv']]) + for line in lines_to_lettre: + if line.lettrage in letters: + line.invoice_id = invoice_lines.filtered( + lambda l: l.lettrage == line.lettrage)[0] def action_open_payment(self): return { diff --git a/models/scop_invoice_idf.py b/models/scop_invoice_idf.py index 72be7e9..f48a732 100644 --- a/models/scop_invoice_idf.py +++ b/models/scop_invoice_idf.py @@ -149,14 +149,14 @@ class ScopinvoiceIDF(models.Model): ['partner_id', '=', partner.id], ['type', '=', 'inv']]) letters = set(invoice_lines.mapped('lettrage')) - if letters: - lines_to_lettre = self.filtered( - lambda l: l.partner_id.id == partner.id - and l.type != 'inv') - for line in lines_to_lettre: - if line.lettrage in letters: - line.invoice_id = invoice_lines.filtered( - lambda l: l.lettrage == line.lettrage)[0] + lines_to_lettre = self.search([ + ['year', '=', year], + ['partner_id', '=', partner.id], + ['type', '!=', 'inv']]) + for line in lines_to_lettre: + if line.lettrage in letters: + line.invoice_id = invoice_lines.filtered( + lambda l: l.lettrage == line.lettrage)[0] def action_open_payment(self): return { -- GitLab