| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
from odoo import models |
| 5 |
|
| 6 |
|
| 7 |
class StockMove(models.Model): |
| 8 |
_inherit = "stock.move" |
| 9 |
|
| 10 |
def _is_purchase_return(self): |
| 11 |
res = super()._is_purchase_return() |
| 12 |
return res or self._is_dropshipped_returned() |
| 13 |
|
| 14 |
def _is_dropshipped(self): |
| 15 |
res = super()._is_dropshipped() |
| 16 |
return res or ( |
| 17 |
self.partner_id.property_stock_subcontractor.parent_path |
| 18 |
and self.partner_id.property_stock_subcontractor.parent_path in self.location_id.parent_path |
| 19 |
and self.location_dest_id.usage == 'customer' |
| 20 |
) |
| 21 |
|
| 22 |
def _is_dropshipped_returned(self): |
| 23 |
res = super()._is_dropshipped_returned() |
| 24 |
return res or ( |
| 25 |
self.location_id.usage == 'customer' |
| 26 |
and self.partner_id.property_stock_subcontractor.parent_path |
| 27 |
and self.partner_id.property_stock_subcontractor.parent_path in self.location_dest_id.parent_path |
| 28 |
) |