mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[9.0][FIX]
* rma: receipt_policy selections not matching. * rma_sale: fix _prepare_rma_line_from_sale_order_line.
This commit is contained in:
@@ -42,24 +42,9 @@ class RmaAddSale(models.TransientModel):
|
|||||||
string='Sale Lines')
|
string='Sale Lines')
|
||||||
|
|
||||||
def _prepare_rma_line_from_sale_order_line(self, line):
|
def _prepare_rma_line_from_sale_order_line(self, line):
|
||||||
operation = line.product_id.rma_operation_id and \
|
operation = line.product_id.rma_customer_operation_id
|
||||||
line.product_id.rma_operation_id.id or False
|
|
||||||
if not operation:
|
if not operation:
|
||||||
operation = line.product_id.categ_id.rma_operation_id and \
|
operation = line.product_id.categ_id.rma_customer_operation_id
|
||||||
line.product_id.categ_id.rma_operation_id.id or False
|
|
||||||
data = {
|
|
||||||
'sale_line_id': line.id,
|
|
||||||
'product_id': line.product_id.id,
|
|
||||||
'origin': line.order_id.name,
|
|
||||||
'uom_id': line.product_uom.id,
|
|
||||||
'operation_id': operation,
|
|
||||||
'product_qty': line.product_uom_qty,
|
|
||||||
'delivery_address_id': self.sale_id.partner_id.id,
|
|
||||||
'invoice_address_id': self.sale_id.partner_id.id,
|
|
||||||
'price_unit': line.currency_id.compute(
|
|
||||||
line.price_unit, line.currency_id, round=False),
|
|
||||||
'rma_id': self.rma_id.id
|
|
||||||
}
|
|
||||||
if not operation:
|
if not operation:
|
||||||
operation = self.env['rma.operation'].search(
|
operation = self.env['rma.operation'].search(
|
||||||
[('type', '=', self.rma_id.type)], limit=1)
|
[('type', '=', self.rma_id.type)], limit=1)
|
||||||
@@ -70,16 +55,26 @@ class RmaAddSale(models.TransientModel):
|
|||||||
[('rma_selectable', '=', True)], limit=1)
|
[('rma_selectable', '=', True)], limit=1)
|
||||||
if not route:
|
if not route:
|
||||||
raise ValidationError("Please define an rma route")
|
raise ValidationError("Please define an rma route")
|
||||||
data.update(
|
data = {
|
||||||
{'in_route_id': operation.in_route_id.id or route,
|
'sale_line_id': line.id,
|
||||||
|
'product_id': line.product_id.id,
|
||||||
|
'origin': line.order_id.name,
|
||||||
|
'uom_id': line.product_uom.id,
|
||||||
|
'operation_id': operation.id,
|
||||||
|
'product_qty': line.product_uom_qty,
|
||||||
|
'delivery_address_id': self.sale_id.partner_id.id,
|
||||||
|
'invoice_address_id': self.sale_id.partner_id.id,
|
||||||
|
'price_unit': line.currency_id.compute(
|
||||||
|
line.price_unit, line.currency_id, round=False),
|
||||||
|
'rma_id': self.rma_id.id,
|
||||||
|
'in_route_id': operation.in_route_id.id or route,
|
||||||
'out_route_id': operation.out_route_id.id or route,
|
'out_route_id': operation.out_route_id.id or route,
|
||||||
'receipt_policy': operation.receipt_policy,
|
'receipt_policy': operation.receipt_policy,
|
||||||
'location_id': operation.location_id.id or self.env.ref(
|
'location_id': operation.location_id.id or self.env.ref(
|
||||||
'stock.stock_location_stock').id,
|
'stock.stock_location_stock').id,
|
||||||
'operation_id': operation.id,
|
|
||||||
'refund_policy': operation.refund_policy,
|
'refund_policy': operation.refund_policy,
|
||||||
'delivery_policy': operation.delivery_policy
|
'delivery_policy': operation.delivery_policy
|
||||||
})
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
|||||||
Reference in New Issue
Block a user