-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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][FIX] sale_invoice_policy: compute qty to invoice #3102
Conversation
Yes, the override should be in the quantity to invoice. I wrote it correctly at first instance in the other PR, but then put received quantity in the second comment (now also fixed). Please check pre-commit. |
3aa5173
to
d963d90
Compare
d963d90
to
d780b68
Compare
@pedrobaeza Could it be merged? |
Don't do it yet, because I want to check if I need to modify anything in this field https://github.com/odoo/odoo/blob/16.0/addons/sale/models/sale_order_line.py#L255 |
d780b68
to
683353c
Compare
Update: compute untaxed amount to invoice |
Please check CI |
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.
Hello @ioans73,
Please make sure you are only modifying the lines whose order has invoice_policy_required
set to True. By doing this, all tests will pass without any problem.
Thank you
# were not in so_lines | ||
super(SaleOrderLine, self - done_lines)._compute_qty_to_invoice() | ||
other_lines = self.filtered( | ||
lambda l: l.product_id.type == "service" or not l.order_id.invoice_policy |
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.
Hi,
I think you need to also check if l.order_id.invoice_policy_required
is set on False
, because if it is, you don't need to modify the line's qty_to_invoice
, since it is not required.
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.
done
lambda line: line.product_id.type == "service" | ||
or not line.order_id.invoice_policy | ||
or line.order_id.invoice_policy == line.product_id.invoice_policy | ||
or line.state not in ["sale", "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.
Same here, I think you need to also check if l.order_id.invoice_policy_required
is set on False
, because if it is, you don't need to modify the line, since it is not required.
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.
done
04a44f9
to
b09a9d2
Compare
Hi @ioans73, Please do a rebase so that tests are executed. Thank you |
b09a9d2
to
5882f9d
Compare
@ACheung-FactorLibre I have done it before, but I don't know why the actions are not being executed |
5882f9d
to
ed7fb73
Compare
The tests are now ok |
@@ -36,6 +39,9 @@ def test_sale_order_invoice_order(self): | |||
"invoice_policy": "order", | |||
} | |||
) | |||
so._compute_invoice_policy_required() |
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.
Why do you need to manually call the compute method? It shouldn't be needed.
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'm not really sure, because there is code that comes from the old PR, but I can review it
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.
Removed
ed7fb73
to
129d782
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 major
Hey, thanks for contributing! Proceeding to merge this for you. |
It looks like something changed on |
Congratulations, your PR was merged at e69496e. Thanks a lot for contributing to OCA. ❤️ |
Hello @ACheung-FactorLibre By doing this qty_to_invoice won't be recomputed for any sale order line if the config parameter sale_invoice_policy_required is set to false. Meaning this modules does nothing unless you set sale_invoice_policy_required to True in the settings. It was not the case in previous versions. |
@ioans73 @jguenat In fact, this is not the expected behavior. The initial one was :
So, the required parameter should not avoid using the SO invoice policy. I will make a PR to improve it. |
|
I have cherry-picked the commit of PR #2763, to try to fix the module
Services should be computed based on the policy established in the product, right? Because it makes no sense to do it based on the quantity delivered, if that is the policy established in the order
@ACheung-FactorLibre @pedrobaeza @rousseldenis