-
-
Notifications
You must be signed in to change notification settings - Fork 705
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] stock_account #2376
Conversation
7b78041
to
294d649
Compare
294d649
to
640d390
Compare
640d390
to
a154932
Compare
Ready @pedrobaeza |
What a data model nightmare creating these valuation records. Have you got any statistics about the duration of this process, iterating over every done stock move? |
a154932
to
fffa2ad
Compare
I have added the |
Is the performance now reasonable? Have you got an indication? |
@StefanRijnhart A client bbdd with 258500 stock moves (221880 done moves) -> 7 hours 22 min (duration of this post-migration) |
@MiquelRForgeFlow Is |
No, because I disabled tracking as you can see in the code. |
I ask why you added it |
Because the tracking is not needed and can generate side issues. |
Ok, What do you think about use SQL instead of call |
I don't know. Maybe doable by putting some explicit flush() calls to avoid the cache issue? |
I tried but don`t work |
@MiquelRForgeFlow It has to save ~30% time:kos94ok-3D@8c5405f |
112fd61
to
2d3f2c4
Compare
2d3f2c4
to
c09e2f4
Compare
Hi, @pedrobaeza. Do you have a planned date for review it? |
2509528
to
c7b3e3b
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.
@kos94ok-3D How did you manage to get the account move information to introduce it in the layer? I think it would be great if we can preserve that information. |
def _get_related_account_move(env, svl_vals): """ Return Account move related to Stock Valuation Layer""" domain = [] if svl_vals.get('stock_move_id'): domain = expression.AND([domain, [('stock_move_id', '=', svl_vals['stock_move_id'])]]) if svl_vals.get('old_product_price_history_id'): env.cr.execute(""" SELECT create_date FROM product_price_history WHERE id = %s """, (svl_vals['old_product_price_history_id'],)) create_date = env.cr.fetchone()[0] domain = expression.AND([domain, [('create_date', '=', create_date)]]) if not domain: return env['account.move'] account_moves = env['account.move'].search(domain) if len(account_moves) > 1: return env['account.move'] return account_moves |
c7b3e3b
to
8110eea
Compare
@kos94ok-3D If we add your account move filling method, it will affect badly the performance or not? |
@MiquelRForgeFlow I think my function needs to rewrite to SQL, I sent it just as an example. |
4e42b2a
to
a0bc755
Compare
@kos94ok-3D @AaronHForgeFlow Added the account move information in a neat way :) |
ddff843
to
c621dcd
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.
c621dcd
to
087c253
Compare
It is ok for me |
For the fifo case the quantities of the layers is well migrated for the test I have performed so far. However, for the outgoing stock moves, the value in the layers is not correct. For example in standard Odoo 13:
the layer out takes 10 units from layer_in_1 and 2 units from layer_in_2: In a migrated database:
I will propose the changes that fixes this use case here. Thanks all for the work. |
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 think we can merge this now, and then if any issue appears create another PR for that case.
…ck move and Product price history
…ck move and Product price history (Optimized)
9271c25
to
b463aec
Compare
Migration of stock_account.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr