Skip to content

Conversation

@lathuat1997
Copy link

@lathuat1997 lathuat1997 commented Sep 28, 2022

@lathuat1997 lathuat1997 force-pushed the v13_fix_stock_account_valuation branch from e3e9c13 to 1767d83 Compare September 29, 2022 01:20


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):
Copy link
Author

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

Comment on lines +169 to +175
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"]
Copy link
Author

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)

Comment on lines +188 to 194
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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant