Skip to content
Extraits de code Groupes Projets
Valider d5db3cc9 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[fix] schedule error

parent 40f40656
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -383,20 +383,22 @@ class Bordereau(models.Model): ...@@ -383,20 +383,22 @@ class Bordereau(models.Model):
MoveLine = self.env['account.move.line'] MoveLine = self.env['account.move.line']
for bordereau in self: for bordereau in self:
inv_ids = bordereau.invoice_ids.ids inv_ids = bordereau.invoice_ids.ids
print(inv_ids) move_lines = MoveLine.search([
schedule = MoveLine.read_group([
('invoice_id', 'in', inv_ids), ('invoice_id', 'in', inv_ids),
('account_id.internal_type', '=', 'receivable')], ('account_id.internal_type', '=', 'receivable')],
['date_maturity', 'credit', 'debit'], order='date_maturity',
groupby=['date_maturity:day'],
orderby='date_maturity',
) )
schedule_plan = [ schedule = list(dict.fromkeys(move_lines.mapped('date_maturity')))
{ schedule_plan = []
'date': datetime.strptime( for date in schedule:
l['date_maturity:day'], '%d %b %Y').strftime('%d/%m/%Y'), amount = 0
'amount': l['debit'] - l['credit'] for item in move_lines:
} for l in schedule] if item.date_maturity == date:
amount += item.debit - item.credit
schedule_plan.append({
'date': date.strftime('%d/%m/%Y'),
'amount': amount
})
return schedule_plan return schedule_plan
def get_contribution_type(self): def get_contribution_type(self):
......
...@@ -161,7 +161,6 @@ ...@@ -161,7 +161,6 @@
report_type="qweb-pdf" report_type="qweb-pdf"
name="cgscop_cotisation_cg.report_bordereau" name="cgscop_cotisation_cg.report_bordereau"
file="cgscop_cotisation_cg.report_bordereau" file="cgscop_cotisation_cg.report_bordereau"
menu="True"
/> />
</data> </data>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter