Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
6305 Переглядів

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 Відповіді Переглядів Дія
3
лип. 24
8812
1
лист. 24
2146
2
черв. 23
2053
0
лют. 20
5612
2
бер. 18
3610