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

[16.0] [FWP] agreement_rebate: Forward port of changes set on 15.0 #57

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion agreement_rebate/models/agreement_rebate_settlement.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def _reverse_type_map(self, inv_type):

def create_invoice(self):
invoice_dic = {}
for line in self.mapped("line_ids"):
for line in self.mapped("line_ids").filtered(
lambda ln: ln.invoice_status == "to_invoice"
):
key = line._get_invoice_key()
if key not in invoice_dic:
invoice_dic[key] = line._prepare_invoice()
Expand Down
6 changes: 4 additions & 2 deletions agreement_rebate/wizards/invoice_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ def action_create_invoice(self):
settlements -= settlements.filtered(
lambda s: any(
ail.move_id.move_type == self.invoice_type
for ail in s.line_ids.mapped("invoice_line_ids").filtered(
lambda ln: ln.parent_state != "cancel"
for ail in s.line_ids.filtered(
lambda st_line: st_line.invoice_status == "to_invoice"
)
.mapped("invoice_line_ids")
.filtered(lambda ln: ln.parent_state != "cancel")
)
)
invoices = settlements.with_context(
Expand Down
Loading