mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[FIX+IMP] rma_sale: Proper dependency + propagate salesman
- Proper dependency is `sale_stock`, not `sale`, as we are using some fields added by this module. - Propagate salesman from sales order when available. TT25525 rma_sale 12.0.1.4.1
This commit is contained in:
committed by
Ernesto Tejeda
parent
303bd68070
commit
8b62b51e8d
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"name": "Return Merchandise Authorization Management - Link with Sales",
|
||||
"summary": "Sale Order - Return Merchandise Authorization (RMA)",
|
||||
"version": "12.0.1.4.0",
|
||||
"version": "12.0.1.4.1",
|
||||
"development_status": "Beta",
|
||||
"category": "RMA",
|
||||
"website": "https://github.com/OCA/rma",
|
||||
@@ -12,7 +12,7 @@
|
||||
"license": "AGPL-3",
|
||||
"depends": [
|
||||
"rma",
|
||||
"sale",
|
||||
"sale_stock",
|
||||
],
|
||||
"data": [
|
||||
"views/assets.xml",
|
||||
|
||||
@@ -81,3 +81,10 @@ class Rma(models.Model):
|
||||
@api.onchange('order_id')
|
||||
def _onchange_order_id(self):
|
||||
self.product_id = self.picking_id = False
|
||||
|
||||
def _prepare_refund(self, invoice_form, origin):
|
||||
"""Inject salesman from sales order (if any)"""
|
||||
res = super()._prepare_refund(invoice_form, origin)
|
||||
if self.order_id:
|
||||
invoice_form.user_id = self.order_id.user_id
|
||||
return res
|
||||
|
||||
@@ -70,3 +70,16 @@ class TestRmaSale(SavepointCase):
|
||||
rma.reception_move_id.picking_id + self.order_out_picking,
|
||||
order.picking_ids,
|
||||
)
|
||||
# Refund the RMA
|
||||
user = self.env["res.users"].create(
|
||||
{
|
||||
"login": "test_refund_with_so",
|
||||
"name": "Test",
|
||||
}
|
||||
)
|
||||
order.user_id = user.id
|
||||
rma.action_confirm()
|
||||
rma.reception_move_id.quantity_done = rma.product_uom_qty
|
||||
rma.reception_move_id.picking_id.action_done()
|
||||
rma.action_refund()
|
||||
self.assertEqual(rma.refund_id.user_id, user)
|
||||
|
||||
Reference in New Issue
Block a user