diff options
| author | Denis Ledoux <dle@odoo.com> | 2017-06-07 17:20:54 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2017-06-07 17:25:12 +0200 |
| commit | be8d0cf716833fd21400e8733d2af8d640af1790 (patch) | |
| tree | 4d49a25a6ec9abb38f9995c5e98abd3afffa0aca /tests/test_program_without_code_operations.py | |
| parent | 803c148769637eb379443cbeb6ce136ef05a4d54 (diff) | |
[FIX] sale_coupon: unlink an empty set of order lines
This is possible that `unlink` is called without any record in self.
In the given case, this is because of
`self.env['sale.order.line'].search([('order_id', 'in', self.ids), ('is_delivery', '=', True)]).unlink()`
in the `undelivery_set` method of the module delivery.
`Unlink` on an empty set is supported, and it should therefore be the case here as well.
This is not because `self.order_id.no_code_promo_program_ids` expects a singleton
for the `self.order_id` part, and this is actually an empty set as `self` is an empty set.
Besides, it makes sense to loop on the lines passed to `self`,
as you could pass several lines, not all having the same
`product_id`, for the above line
`related_program = self.env['sale.coupon.program'].search([('discount_line_product_id', '=', self.product_id.id)])`
opw-746084
Diffstat (limited to 'tests/test_program_without_code_operations.py')
0 files changed, 0 insertions, 0 deletions
