-
-
Notifications
You must be signed in to change notification settings - Fork 693
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
[13.0][MIG] account_invoice_triple_discount #733
[13.0][MIG] account_invoice_triple_discount #733
Conversation
Hi, from my point of view, I prefer this approach as it is less intrusive in core and does not change the original nature of discount field. |
The problem I see here is that this is not inheritance friendly, as it requires to put glue modules when other fields need to touch the same fields and also copies logic from upstream that can be patched in the future. What is the problem with the other approach? |
@benwillig thank you for your close up look.
I would prefer having discount as it was, if it is not too complex. What is your opinion on this? |
Why v12 approach is not valid? |
v12 is valid. v13, to use the same approach is just more complex because of the different nature of account.move. |
OK, then the logic should be a bit modified for that, but the essence should be preserved IMO |
old_values = [] | ||
dp_discount = self.env["decimal.precision"].precision_get("Discount") | ||
for values in values_list: | ||
old_discount = values.get("discount") |
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.
old_discount = values.get("discount") | |
old_discount = values.get("discount", 0.0) |
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.
This will fix the error on installation, with steps:
- Create new database with demo data.
- Install module account_invoice_triple_discount without first install account module.
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.
Thanks, should be fixed now
Functional tested OK, but when run test locally, I found this error message though it is not in travis.
|
@benwillig thank you for this PR, I think your code is as clean as it could be already 👍 |
be7b234
to
d9ab34f
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.
The functional test is ok but small code reviews.
"name": "Account Invoice Triple Discount", | ||
"version": "13.0.1.0.0", | ||
"category": "Accounting & Finance", | ||
"author": "QubiQ," "Tecnativa," "Odoo Community Association (OCA)", |
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.
"author": "QubiQ," "Tecnativa," "Odoo Community Association (OCA)", | |
"author": "QubiQ, Tecnativa, Odoo Community Association (OCA)", |
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.
@ps-tubtim resolved, thanks
d9ab34f
to
3af303d
Compare
@benwillig account_invoice_supplier_ref_unique fix is merged. #754 |
@benwillig do you plan to continue with this? I think just rebase will do. |
Hello @benwillig any progress expected soon on this ? |
Tested functionaly and code LG |
Currently translated at 100,0% (4 of 4 strings) Translation: account-invoicing-11.0/account-invoicing-11.0-account_invoice_triple_discount Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-11-0/account-invoicing-11-0-account_invoice_triple_discount/de/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_triple_discount Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_triple_discount/
Currently translated at 100.0% (4 of 4 strings) Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_triple_discount Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_triple_discount/pt_BR/
3af303d
to
1adcb23
Compare
@santostelmo Just rebased the PR. |
@Cedric-Pigeon tests are still falling on travis |
yes but I do not think the error is linked to this PR. |
@OCA/accounting-maintainers should we merge this PR manually as the Travis error is not related to this module? I mean... same as we did in #852 , for example |
@benwillig @Cedric-Pigeon I was testing your module in a local environment and I found a strange issue. How to reproduce: 1- Create a PO with these details: Line1: 50 units of product A// 7,05 unit price// discount 1: 50% // discount 2: 10% // discount 3: 10% // Taxes (21% Spanish VAT) Subtotal for line 1 = 142,76 Line 2: Product B // 1 unit // 5,50 unit price // no discounts // Taxes (21% Spanish VAT) Subtotal for line 2 = 5,5 PO details: PO total amount = 179,40 2- Generate the invoice of this PO. (Make sure you have received the product units if it's a storable product and it's purchase invoice policy is by delivered units.) Invoice details (With the same data inherited from the PO): Subtotal for line 1 = 142,76 Invoice total amount = 179,45 I don't know why PO totals do not match Invoice totals... Could you check? I've used purchase_triple_discount PR and your PR. THX! |
Hi @HaraldPanten , i'll check it on our local env thanks |
It's related to this. I think it's not easy to solve --> #876 |
the new account.move on v13, as it was already said, its really different than in v12, it's difficult to adapt it, including the new mixin class...im in a mess |
Hello, this pull PR is functional? What problem it has? |
Hello ,using this module ,i have a bug , please try that steps: for example: I think I solved this by changing this code:
|
This PR has the |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Other proposal for the migration of account_invoice_triple_discount. (orginal one is #661).
@legalsylvain @kittiu This PR doesn't change the behavior of
discount
field. But as @kittiu said, it makes the code a bit more complex than the original PR.To avoid that complexity, I think we should try to refactor odoo code to be able to inherit properly and to have the good data at the right time. I know it could not be a few lines changes so it might be impossible that odoo accept this. As you can see here, the subtotal price is computed during the create. It's not possible, without changing the original code, to give the method more data (here, the two new discount field) to have a correct computation of that price. In this method, if the balance given by the UI (computed during onchange) is different than the computed subtotal (during the create), the unit price of the line will be updated. As the odoo method handle only the first discount feld, it results in a difference and the unit price changes.
If I'm not wrong, at the moment it's almost impossible (without writing dirty code) to change the computation of the subtotal of an invoice line. I don't see the use case now, but it could be a problem for other modules.