Skip to content

Commit

Permalink
[FIX] stock_dropshipping: modify SO
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
nim-odoo committed Mar 19, 2019
1 parent 36435b4 commit 9006e5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/stock_dropshipping/models/sale.py
Expand Up @@ -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')
Expand Down

0 comments on commit 9006e5e

Please sign in to comment.