-
-
Notifications
You must be signed in to change notification settings - Fork 616
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
[15.0][FIX] account_sale_stock_report_non_billed: Date can't be comparated with bool #1058
[15.0][FIX] account_sale_stock_report_non_billed: Date can't be comparated with bool #1058
Conversation
a4c5f03
to
67406b2
Compare
@@ -127,6 +127,8 @@ def _compute_not_invoiced_values(self): | |||
moves_in_date = invoices_not_cancel.mapped("move_line_ids").filtered( | |||
lambda m: m.date_done >= date_start and m.date_done <= date_end | |||
) | |||
if not self.env.context.get("date_check_iterval_restrict", False): | |||
date_start = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why do you need this. Pass the minimum variables in context, and the absence of one of them means that no check should be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we need the date_start and the date_end to filter the move_line_ids in any situation, but when the user doesn't want to use this dates as a range for invoices too the date_start has to be reset to False.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and that's why I say you only need to pass one variable: the start date. If not passed, then you use .get(..., False)
, and being False
means that no check has to be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I need the date_start to take the moves_in_date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'm getting it. They should be independent variables for avoiding that clunky logic. Pass these 3 possible variables to context:
non_billed_date
: Olddate_check_invoiced_moves
non_billed_date_start
: Olddate_check_invoiced_moves_start
non_billed_invoice_date_start
: This one is set toself.stock_move_non_billed_threshold
ifself.interval_restrict_invoices
.
and you get each of them on the computing code, with no inter-dependencies between them.
67406b2
to
0d232de
Compare
0d232de
to
e229ebc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ocabot merge patch
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 9bc9aad. Thanks a lot for contributing to OCA. ❤️ |
cc @Tecnativa TT44745
fw-port of: #953
ping @pedrobaeza @stefan-tecnativa