-
-
Notifications
You must be signed in to change notification settings - Fork 586
[17.0][MIG] contract_sale_generation: Migration to 17.0 #1234
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
base: 17.0
Are you sure you want to change the base?
Conversation
2324af3 to
38ca288
Compare
|
Hi, I dont understand new codecov errors. It seems like is detecting lines of code not tested, but in my migration commit i only edit xml files. Is a simple migration... why is failing coverage if i did not add any python line. Is mandatory to get this coverage in order to merge this PR? |
@javierjcf As for now (I'm not fond of :-) ), we start from blank base new branches. So, the module you migrate is not present. Coverage will do the full change tests. If you look at your PR, it adds the whole module and not only migration commit. |
|
/ocabot migration contract_sale_generation |
@javierjcf It seems tests are not running at all. Could you check locally (it can maybe be the accounting modules that causes problem) |
|
Thanks @rousseldenis Yes, tests weren't working, there are references in the test cases that are no longer valid. I will try to fix them throughout the week. |
7c5079f to
71d091b
Compare
|
Hi, I need help with a test error.
It doesn't occur in my local environment with a fresh database. However, I did face the same error when accessing contract_line_ids. That field was indeed invisible, and I had to explicitly set contract_form.line_recurrence = True. With that, the tests passed. In CI, the error is triggered by the quantity field. These fields don't have any invisibility modifiers, except for the parent group, which depends on display_type. But if I add display_type to the test to make quantity writable, I get an error saying that display_type is invisible (which is true). Could another module be interfering? In my local environment I only have contract_sale_generation and its dependencies installed, not the entire OCA... I see that if I install the rest of the modules from this repository, I also get the same error locally. Am I supposed to always run the tests with the other modules in the repository? Or with the whole OCA? |
|
I found that module contract_variable_qty is doing: I don't think the solution is to worry about fields introduced by other modules, especially when the default is correctly set...
It still fails the same way. How can I make the quantity field always visible from the test? |
6f682ed to
d116a7a
Compare
d116a7a to
46a6a96
Compare
ofonseca-pyming
left a comment
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.
LGTM
|
|
||
|
|
||
| class TestContractSale(ContractSaleCommon, TransactionCase): | ||
| class TestContractSale(ContractSaleCommon): |
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.
@javierjcf Don't do these changes. They are not needed. Thanks
Currently translated at 100.0% (15 of 15 strings) Translation: contract-16.0/contract-16.0-contract_sale_generation Translate-URL: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_sale_generation/it/
Currently translated at 100.0% (15 of 15 strings) Translation: contract-16.0/contract-16.0-contract_sale_generation Translate-URL: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_sale_generation/pt_BR/
Currently translated at 86.6% (13 of 15 strings) Translation: contract-16.0/contract-16.0-contract_sale_generation Translate-URL: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_sale_generation/hr/
46a6a96 to
c0cfa4e
Compare
|
@javierjcf Could you check tests? |
35c922d to
8b39f96
Compare
"I tried, but I don’t understand what’s failing (it was working before; only the runbiat part was wrong). Analytic accounting has been tricky for me since the v16 changes. In any case, the prepare_sale function propagates the analytic account to the orders (which is now called group_id in the contract). I noticed it’s possible it isn't entering this method because it lacks a date_ref. I’ve updated the test to call the private version of the method, _recurring_create_sale, so I can pass the date_ref and ensure prepare_sale isn't skipped. Even so, it still throws the same error. In the v18 PR, I removed the line that checks for that—not a great solution. However, in a private project using the v18 module, the account is propagating correctly. I’m missing something regarding how the test is designed, but I don't have time this week to look into it in depth. If anyone knows why this is happening, I can change it immediately. Otherwise, I’ll try to review it when I have more time available." |
d8c37b7 to
c72f667
Compare
|
@javierjcf Please avoid using the "remove conflicting call" approach. I recommend reverting it in the v18 PR as well. I'm currently working on a migration that requires this addition. I'll investigate the failing test and share my findings here once I have them. |
be2029c to
b80b6e7
Compare
|
@rrebollo I tried to revert, but in v18 is a key errror. Not analytic_account_id on sale.order
I'm not sure about analytic plan/distribution and the right way to check it. I think test shoud new check analitic_distribution json in lines instead of sale.order level?? i'm not sure... In v17 we still have a general analytic_account_id on sale.order, but makes not sense to me. In v18 this field is removed. If we found a solution heare in v17 i will fix 18 PR as well |
|
I think I found the bug. The analytic account is being set at the contract header level in the common.py file. However, since the lines are created using Form() and group_id is a computed field, the value is lost. Furthermore, the lines in v17 do not have the analytic distribution in the view; perhaps it should be added... Anyway, since I know the group_id field can be lost, I am re-setting it after using Form() to create the lines. (I don't understand why the test data setup mixes direct value assignment in cls with line creation using Form()). This way, cls.contract preserves the analytic account that was initially established:
I don't use v17 or the analytic module myself, so I'm not entirely sure if this is the correct way to test it. It seems more like the new analytic_distribution widget should be at the line level (and visible too, otherwise we can't use Form() to assign a value to it) and then verify that the contract lines have the same analytic distribution as the generated sales order lines. In v18, I think it will have to be this way since the analytic account field doesn't even exist at the sale.order level anymore. |
2a68a34 to
d1475c0
Compare
d1475c0 to
b048e03
Compare
|
@javierjcf To validate your approach—both for the tests and the overall migration—I recommend looking at merged addons in v17.0 branches of OCA repositories related to analytic workflow. A focused code search should be sufficient. You can then compare their implementation with your approach. Thank you for all the effort you're putting into this. I haven't had a chance to review it today. |
|
Hi @rrebollo, the functionality intended for this test (propagating the analytic account from the contract to the sale) is already being tested correctly. Regarding the analytic distribution at the contract line level, that logic is in the 'contract' module, which has already been merged. The base module handles this part correctly, although it doesn't seem to be tested at the line level. Functionally, this module seems correct; the only issue was the test. While the test could be improved, I think it's fine as it is for the migration PR. |
|
This PR has the |




This PR migrates the module
contract_sale_generationfrom 16.0 to 17.0.Superseed #1087.