Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6324 มุมมอง

Hi,

I'm curious about why it is only possible to increase the quantity to receive and not decrease.

addons/purchase/models/purchase.py#L733
if float_compare(diff_quantity, 0.0,  precision_rounding=self.product_uom.rounding) >0:

Because it is not possible to decrease below received quantity.

addons/purchase/models/purchase.py#L654
if float_compare(line.product_qty, line.qty_received, line.product_uom.rounding) <0:

Nonetheless, you could possibly want to decrease the quantity before you have receive any goods.

Thanks.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I was stuck at this problem as well, but finally I figured out i guess, if you want to allow to decrease the qty on picking while decreasing on po line, update _prepare_stock_moves  method at addons/purchase_stock/model/purchase.py at purchase.order.line model:

        if float_compare(diff_quantity, 0.0,  precision_rounding=self.product_uom.rounding) > 0:
            po_line_uom = self.product_uom
            quant_uom = self.product_id.uom_id
            product_uom_qty, product_uom = po_line_uom._adjust_uom_quantities(diff_quantity, quant_uom)
            template['product_uom_qty'] = product_uom_qty
            template['product_uom'] = product_uom.id
            res.append(template)
        return res


Remove that        if float_compare(diff_quantity, 0.0,  precision_rounding=self.product_uom.rounding) > 0: condition, it should work. Thanks
อวตาร
ละทิ้ง

What do you think of this solution? Is this the right approach? There must be a reason odoo implemented this constraint

คำตอบที่ดีที่สุด

Hi @Bishal what is the value of diff_quantity?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Reset Master Password Odoo 11 แก้ไขแล้ว
3
ก.ค. 24
8827
1
พ.ย. 24
2173
Purchase order downpayment แก้ไขแล้ว
2
มิ.ย. 23
2057
0
ก.พ. 20
5641
2
มี.ค. 18
3616