diff --git a/sale_commission_settlement_payment_date/wizard/wizard_settle.py b/sale_commission_settlement_payment_date/wizard/wizard_settle.py index 311b253e2..21d87dca2 100644 --- a/sale_commission_settlement_payment_date/wizard/wizard_settle.py +++ b/sale_commission_settlement_payment_date/wizard/wizard_settle.py @@ -20,12 +20,14 @@ def _get_agent_lines(self, agent, date_to_agent): lambda r: r.commission_id.invoice_state == "paid" and self.date_payment_to != "false" ): - if not self.check_payment_date(line.invoice_id.invoice_payments_widget): + if not self.check_payment_date(line): agent_lines -= line return agent_lines - def check_payment_date(self, payments_widget): - move_dict_content = json.loads(payments_widget)["content"] + def check_payment_date(self, agent_line): + move_dict_content = json.loads(agent_line.invoice_id.invoice_payments_widget)[ + "content" + ] return all( [ self.date_payment_to > datetime.strptime(x["date"], "%Y-%m-%d").date()