-
Notifications
You must be signed in to change notification settings - Fork 25
[FIX][13.0]stock_account: Fix stock valuation layer #339
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: 13.0
Are you sure you want to change the base?
[FIX][13.0]stock_account: Fix stock valuation layer #339
Conversation
e3e9c13 to
1767d83
Compare
|
|
||
|
|
||
| def _prepare_out_svl_vals(move, quantity, unit_cost, product, value=0.0, cost_method=False): | ||
| def _prepare_out_svl_vals(move, quantity, unit_cost, product, value=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.
chỉnh sửa lại hàm này, không cần truyền vào cost_method vì đó chính là cost_method của product
| old_price = history_lines[h_index-1]["cost"] if h_index > 0 else price_history_rec["cost"] | ||
| if float_compare(price_history_rec["cost"], old_price, precision_digits=precision_price): | ||
| if have_qty: | ||
| svl_vals = _prepare_man_svl_vals( | ||
| price_history_rec, previous_price, previous_qty, company, product) | ||
| price_history_rec, old_price, previous_qty, company, product) | ||
| svl_man_vals_list.append(svl_vals) | ||
| old_price = price_history_rec["cost"] |
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.
Khi sinh ra định giá tồn kho do việc điều chỉnh giá thủ công, dựa vào chênh lệch giá giữa các bản ghi trong product.price.history chứ không dựa vào previous_price (không quan tâm previous_price được tính theo công thức nào)
| valuation_price_unit = move["price_unit"] | ||
| if product.cost_method == 'standard': | ||
| valuation_price_unit = price_history_rec["cost"] | ||
| svl_vals = _prepare_in_svl_vals( | ||
| move, move["product_qty"], move["price_unit"], product, is_dropship) | ||
| move, move["product_qty"], valuation_price_unit, product, is_dropship) | ||
| svl_in_vals_list.append(svl_vals) | ||
| previous_qty = total_qty |
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.
Nếu sản phẩm được định giá theo phương pháp "Giá tiêu chuẩn" thì khi sinh ra định giá tồn kho phải lấy giá trên sản phẩm tại thời điểm đó (giá trong bảng product.price.history) chứ không dựa vào đơn giá trên stock.move
Uh oh!
There was an error while loading. Please reload this page.