[FIX] stock_dropshipping: modify SO

- Create a SO with a dropship product, set a qty of 1.0
- Validate the SO
- Validate the corresponding PO
- Change the qty to the SO to 2.0

2 PO are created: the first one with a qty of 1.0, another with a qty of
3.0.

There is an overlap of functionality between:
- `_purchase_increase_ordered_qty` from `sale_purchase` (first PO)
- `_action_launch_stock_rule` from `sale_stock` (second PO)

The quantity is incorrectly computed since the quantity on the PO is
taken into account only if the no stock move exist.

We remove the latter condition, so the procurement quantity is computed
correctly.

opw-1950076

closes odoo/odoo#31963

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-03-19 11:50:46 +00:00
parent 716ff76d5e
commit 68860fcc9d
+1 -1
View File
@@ -13,7 +13,7 @@ class SaleOrderLine(models.Model):
def _get_qty_procurement(self):
# People without purchase rights should be able to do this operation
purchase_lines_sudo = self.sudo().purchase_line_ids
if not self.move_ids.filtered(lambda r: r.state != 'cancel') and purchase_lines_sudo.filtered(lambda r: r.state != 'cancel'):
if purchase_lines_sudo.filtered(lambda r: r.state != 'cancel'):
qty = 0.0
for po_line in purchase_lines_sudo.filtered(lambda r: r.state != 'cancel'):
qty += po_line.product_uom._compute_quantity(po_line.product_qty, self.product_uom, rounding_method='HALF-UP')