Skip to content

Commit

Permalink
Merge PR #396 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jun 20, 2024
2 parents 6713de3 + d1e6a56 commit d8b6d73
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions rma/migrations/16.0.1.4.0/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ def migrate(env, version):
warehouses = env["stock.warehouse"].search([])
warehouses = warehouses.with_context(rma_post_init_hook=True)
for wh in warehouses:
if not wh.rma_in_type_id or not wh.rma_out_type_id:
data = wh._create_or_update_sequences_and_picking_types()
wh.write(data)
route_vals = wh._create_or_update_route()
wh.write(route_vals)
13 changes: 7 additions & 6 deletions rma/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ def _get_picking_type_create_values(self, max_sequence):

def _get_picking_type_update_values(self):
data = super()._get_picking_type_update_values()
data.update(
{
"rma_in_type_id": {"default_location_dest_id": self.rma_loc_id.id},
"rma_out_type_id": {"default_location_src_id": self.rma_loc_id.id},
}
)
picking_types = {
"rma_in_type_id": {"default_location_dest_id": self.rma_loc_id.id},
"rma_out_type_id": {"default_location_src_id": self.rma_loc_id.id},
}
if self.env.context.get("rma_post_init_hook"):
return picking_types
data.update(picking_types)
return data

def _create_or_update_sequences_and_picking_types(self):
Expand Down
2 changes: 2 additions & 0 deletions rma/tests/test_rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from odoo.exceptions import UserError, ValidationError
from odoo.tests import Form, TransactionCase, new_test_user, users
from odoo.tools import mute_logger

from .. import hooks

Expand Down Expand Up @@ -761,6 +762,7 @@ def test_split(self):
self.assertEqual(new_rma.move_id.quantity_done, 10)
self.assertEqual(new_rma.reception_move_id.quantity_done, 10)

@mute_logger("odoo.models.unlink")
def test_rma_to_receive_on_delete_invoice(self):
rma = self._create_confirm_receive(self.partner, self.product, 10, self.rma_loc)
rma.action_refund()
Expand Down

0 comments on commit d8b6d73

Please sign in to comment.