Skip to content

Commit

Permalink
T1985 : pre-commit clean
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasGajo committed Nov 27, 2024
1 parent c53da27 commit 4fa1ef0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
19 changes: 13 additions & 6 deletions recurring_contract/models/contract_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ def _should_skip_invoice_generation(self, invoicing_date, contract=None):
),
]

has_all_invoices = bool(self.env["account.move"].search_count(search_filter))
has_all_invoices = bool(
self.env["account.move"].search_count(search_filter)
)
else:
search_filter = [
("invoice_date_due", "=", invoicing_date),
Expand All @@ -354,13 +356,18 @@ def _should_skip_invoice_generation(self, invoicing_date, contract=None):
"in",
self.active_contract_ids.mapped("product_ids").ids,
),
('state', '!=', 'cancel')
("state", "!=", "cancel"),
]

open_invoices = self.env["account.move"].search(search_filter)

has_all_invoices = len(self.active_contract_ids -
open_invoices.mapped("line_ids.contract_id")) == 0
has_all_invoices = (
len(
self.active_contract_ids
- open_invoices.mapped("line_ids.contract_id")
)
== 0
)

is_suspended = (
self.invoice_suspended_until
Expand Down Expand Up @@ -437,8 +444,8 @@ def _process_invoice_generation(self, invoicer, invoicing_date, contract=None):
"payment_mode_id": self.payment_mode_id.id,
}
)
open_invoice.mapped('invoice_line_ids').filtered(
lambda line : line.contract_id in contract_lines_to_inv.contract_id
open_invoice.mapped("invoice_line_ids").filtered(
lambda line: line.contract_id in contract_lines_to_inv.contract_id
).create_analytic_lines()
else:
# Building invoices data
Expand Down
10 changes: 6 additions & 4 deletions recurring_contract/models/recurring_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,12 @@ def _cancel_invoices(self):
)
if remaining_lines:
# We can move or remove the line
invoice.write({
"invoice_line_ids": [(2, inv_line.id)],
"payment_mode_id": invoice.payment_mode_id.id,
})
invoice.write(
{
"invoice_line_ids": [(2, inv_line.id)],
"payment_mode_id": invoice.payment_mode_id.id,
}
)
else:
# The invoice would be empty if we remove the line
empty_invoices |= invoice
Expand Down

0 comments on commit 4fa1ef0

Please sign in to comment.