Skip to content
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

盘点单生成盘亏单据时计算成本bug #1918

Open
grey27 opened this issue Sep 20, 2019 · 0 comments
Open

盘点单生成盘亏单据时计算成本bug #1918

grey27 opened this issue Sep 20, 2019 · 0 comments

Comments

@grey27
Copy link

grey27 commented Sep 20, 2019

bug复现:
A商品为常规不带批号商品
1.采购A商品100个
2.采购A商品20个
3.销售A商品80个 (按照先进先出原则,这80个来自于第一批采购入库)
3,盘点单盘点A产品 账面数量40 设置实际数量为10 (盘亏30个)
4.生成盘点数据报错 商品A的库存数量不够本次出库

bug原因:
wh.inventory.line模型的get_move_line方法
这个方法用于返回其他出库单,并且计算了成本,但是成本计算使用goods模型的get_suggested_cost_by_warehouse方法,传参时,传入lot_id,导致写死为按批号商品计算成本导致计算不带批号的商品时成本计算报错

修复建议:
传参lot_id时加入对商品的判断

cost, cost_unit = inventory.goods_id. \
                get_suggested_cost_by_warehouse(
                    inventory.warehouse_id, abs(inventory.difference_qty),
<<<<<<< HEAD
                    lot_id=inventory.new_lot_id,
=======
                    lot_id=inventory.new_lot_id if inventory.goods_id.using_batch else None,
>>>>>>> fix
                    attribute=inventory.attribute_id)

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

No branches or pull requests

1 participant