[FIX] stock_dropshipping: Dropship created after editing an existing quotation

Steps to reproduce the bug:
- Create a quotation and a SO line SOL with one product and route "Dropship"
- Confirm the SO and a PO is created
- Validate PO and process the dropship picking
- Add 4 units to the SO line SOL

Bug:

A new PO was created but the related picking was type "Receipts" instead of "Dropship"

opw:2034398

closes odoo/odoo#35323

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-07-31 12:09:57 +00:00
parent 1b1175556b
commit e5a8b0632f
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -114,8 +114,8 @@ class SaleOrderLine(models.Model):
decreased_values = {}
if 'product_uom_qty' in values:
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
increased_lines = self.sudo().filtered(lambda r: r.purchase_line_count and float_compare(r.product_uom_qty, values['product_uom_qty'], precision_digits=precision) == -1)
decreased_lines = self.sudo().filtered(lambda r: r.purchase_line_count and float_compare(r.product_uom_qty, values['product_uom_qty'], precision_digits=precision) == 1)
increased_lines = self.sudo().filtered(lambda r: r.product_id.service_to_purchase and r.purchase_line_count and float_compare(r.product_uom_qty, values['product_uom_qty'], precision_digits=precision) == -1)
decreased_lines = self.sudo().filtered(lambda r: r.product_id.service_to_purchase and r.purchase_line_count and float_compare(r.product_uom_qty, values['product_uom_qty'], precision_digits=precision) == 1)
increased_values = {line.id: line.product_uom_qty for line in increased_lines}
decreased_values = {line.id: line.product_uom_qty for line in decreased_lines}
@@ -45,7 +45,7 @@ class TestDropship(common.TransactionCase):
self.assertAlmostEqual(po_line.product_qty, 1.00)
# Update qty on SO and check PO
so.order_line.product_uom_qty = 2.00
so.write({'order_line': [[1, so.order_line.id, {'product_uom_qty': 2.00}]]})
self.assertAlmostEqual(po_line.product_qty, 2.00)
# Create a new so line