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[IMP]account_commission: add payment date limit on settle commissions #588

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

matteonext
Copy link

@matteonext matteonext commented Dec 20, 2024

Porting #441

@OCA-git-bot
Copy link
Contributor

Hi @pedrobaeza,
some modules you are maintaining are being modified, check this out!

@matteonext matteonext force-pushed the 16.0-imp-account_commission branch from ba276da to 50f6a32 Compare December 20, 2024 10:21
@matteonext matteonext changed the title [IMP]account_commission: possibility to add payment date limit on set… [16.0[IMP]account_commission: add payment date limit on settle commissions Dec 20, 2024
Copy link

@PicchiSeba PicchiSeba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

@@ -251,7 +251,30 @@ def _skip_settlement(self):
:return: bool
"""
self.ensure_one()
payment_based_commission = (
True if self.commission_id.invoice_state == "paid" else False

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: this expression could be simplified

Suggested change
True if self.commission_id.invoice_state == "paid" else False
self.commission_id.invoice_state == "paid"

@matteonext matteonext force-pushed the 16.0-imp-account_commission branch from 50f6a32 to 8a9338b Compare December 20, 2024 10:56
Copy link

@odooNextev odooNextev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +57 to +59
context_date_payment = self.env.context.copy()
context_date_payment["date_payment_to"] = self.date_payment_to
self.env.context = context_date_payment
Copy link

@PicchiSeba PicchiSeba Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: aren't these operations equivalent to

self.env.context["date_payment_to"] = self.date_payment_to

?

Or am I missing something?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @PicchiSeba, self.env.context is a frozendict, which is an immutable dictionary. Because of this, I couldn't add self.date_payment_to directly as you suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants