[FIX] stock_dropshipping: singleton in dropshipping rules

When you want to obtain `dropship_picking_type`, it is possible to have
several results. This will lead to an error when doing
`dropship_picking_type.id`.

```
dropship_picking_type = self.env['stock.picking.type'].search([
    ('company_id', '=', company.id),
    ('default_location_src_id.usage', '=', 'supplier'),
    ('default_location_dest_id.usage', '=', 'customer'),
])
```
The fix ensures that `dropship_picking_type` contains only one element.

closes odoo/odoo#61256

X-original-commit: 3e3b1b335ced1ff20129172e6a7b2b0dcbe1a20d
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
This commit is contained in:
Julian Roussieau
2020-11-03 12:09:30 +00:00
parent ffcc8b9e77
commit 093e86cde6
@@ -89,7 +89,7 @@ class ResCompany(models.Model):
('company_id', '=', company.id),
('default_location_src_id.usage', '=', 'supplier'),
('default_location_dest_id.usage', '=', 'customer'),
])
], limit=1, order='sequence')
dropship_vals.append({
'name': '%s → %s' % (supplier_location.name, customer_location.name),
'action': 'buy',