odoo-addon-rma 16.0.4.0.0__py3-none-any.whl → 16.0.5.0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -125,6 +125,13 @@ msgid ""
125
125
  "title=\"Download\"/>"
126
126
  msgstr ""
127
127
 
128
+ #. module: rma
129
+ #: model_terms:ir.ui.view,arch_db:rma.rma_operation_kanban
130
+ msgid ""
131
+ "<i class=\"fa fa-ellipsis-v\" role=\"img\" aria-label=\"Manage\" "
132
+ "title=\"Manage\"/>"
133
+ msgstr ""
134
+
128
135
  #. module: rma
129
136
  #: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
130
137
  msgid ""
@@ -236,6 +243,26 @@ msgid ""
236
243
  "specific.\" groups=\"base.group_multi_company\"/>"
237
244
  msgstr ""
238
245
 
246
+ #. module: rma
247
+ #: model_terms:ir.ui.view,arch_db:rma.rma_operation_kanban
248
+ msgid "<span>Awaiting action</span>"
249
+ msgstr ""
250
+
251
+ #. module: rma
252
+ #: model_terms:ir.ui.view,arch_db:rma.rma_operation_kanban
253
+ msgid "<span>Draft</span>"
254
+ msgstr ""
255
+
256
+ #. module: rma
257
+ #: model_terms:ir.ui.view,arch_db:rma.rma_operation_kanban
258
+ msgid "<span>New</span>"
259
+ msgstr ""
260
+
261
+ #. module: rma
262
+ #: model_terms:ir.ui.view,arch_db:rma.rma_operation_kanban
263
+ msgid "<span>Processed</span>"
264
+ msgstr ""
265
+
239
266
  #. module: rma
240
267
  #: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
241
268
  msgid "<strong class=\"d-block mb-1\">Delivery</strong>"
@@ -438,13 +465,34 @@ msgstr ""
438
465
  msgid "Attachment Count"
439
466
  msgstr ""
440
467
 
468
+ #. module: rma
469
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__auto_confirm_reception
470
+ msgid "Auto Confirm Reception"
471
+ msgstr ""
472
+
473
+ #. module: rma
474
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_delivery__automatic_after_receipt
475
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_refund__automatic_after_receipt
476
+ msgid "Automatically After Receipt"
477
+ msgstr ""
478
+
479
+ #. module: rma
480
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_delivery__automatic_on_confirm
481
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_receipt__automatic_on_confirm
482
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_refund__automatic_on_confirm
483
+ msgid "Automatically on Confirm"
484
+ msgstr ""
485
+
441
486
  #. module: rma
442
487
  #: model_terms:ir.ui.view,arch_db:rma.rma_team_view_form
443
488
  msgid "Avatar"
444
489
  msgstr ""
445
490
 
446
491
  #. module: rma
492
+ #. odoo-python
493
+ #: code:addons/rma/models/rma_operation.py:0
447
494
  #: model_terms:ir.ui.view,arch_db:rma.rma_view_search
495
+ #, python-format
448
496
  msgid "Awaiting Action"
449
497
  msgstr ""
450
498
 
@@ -512,6 +560,11 @@ msgstr ""
512
560
  msgid "Closed"
513
561
  msgstr ""
514
562
 
563
+ #. module: rma
564
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__color
565
+ msgid "Color"
566
+ msgstr ""
567
+
515
568
  #. module: rma
516
569
  #: model:ir.model.fields,field_description:rma.field_rma_tag__color
517
570
  msgid "Color Index"
@@ -546,6 +599,7 @@ msgstr ""
546
599
 
547
600
  #. module: rma
548
601
  #: model:ir.ui.menu,name:rma.rma_configuration_menu
602
+ #: model_terms:ir.ui.view,arch_db:rma.rma_operation_kanban
549
603
  msgid "Configuration"
550
604
  msgstr ""
551
605
 
@@ -574,16 +628,42 @@ msgid ""
574
628
  "same category. The conversion will be made based on the ratios."
575
629
  msgstr ""
576
630
 
631
+ #. module: rma
632
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__count_rma_awaiting_action
633
+ msgid "Count Rma Awaiting Action"
634
+ msgstr ""
635
+
636
+ #. module: rma
637
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__count_rma_draft
638
+ msgid "Count Rma Draft"
639
+ msgstr ""
640
+
641
+ #. module: rma
642
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__count_rma_processed
643
+ msgid "Count Rma Processed"
644
+ msgstr ""
645
+
577
646
  #. module: rma
578
647
  #: model:ir.model.fields,field_description:rma.field_stock_return_picking__create_rma
579
648
  msgid "Create RMAs"
580
649
  msgstr ""
581
650
 
651
+ #. module: rma
652
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__action_create_receipt
653
+ #: model_terms:ir.ui.view,arch_db:rma.rma_view_form
654
+ msgid "Create Receipt"
655
+ msgstr ""
656
+
582
657
  #. module: rma
583
658
  #: model_terms:ir.actions.act_window,help:rma.action_rma_finalization
584
659
  msgid "Create a new RMA finalization"
585
660
  msgstr ""
586
661
 
662
+ #. module: rma
663
+ #: model_terms:ir.actions.act_window,help:rma.rma_dashboard_action
664
+ msgid "Create a new RMA operation"
665
+ msgstr ""
666
+
587
667
  #. module: rma
588
668
  #: model_terms:ir.actions.act_window,help:rma.action_rma_tag
589
669
  msgid "Create a new RMA tag"
@@ -657,6 +737,21 @@ msgstr ""
657
737
  msgid "Default Values"
658
738
  msgstr ""
659
739
 
740
+ #. module: rma
741
+ #: model:ir.model.fields,help:rma.field_rma_operation__action_create_delivery
742
+ msgid "Define how the delivery action should be handled."
743
+ msgstr ""
744
+
745
+ #. module: rma
746
+ #: model:ir.model.fields,help:rma.field_rma_operation__action_create_receipt
747
+ msgid "Define how the receipt action should be handled."
748
+ msgstr ""
749
+
750
+ #. module: rma
751
+ #: model:ir.model.fields,help:rma.field_rma_operation__action_create_refund
752
+ msgid "Define how the refund action should be handled."
753
+ msgstr ""
754
+
660
755
  #. module: rma
661
756
  #: model_terms:ir.ui.view,arch_db:rma.rma_redelivery_wizard_view_form
662
757
  msgid "Deliver"
@@ -682,6 +777,11 @@ msgstr ""
682
777
  msgid "Delivery"
683
778
  msgstr ""
684
779
 
780
+ #. module: rma
781
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__action_create_delivery
782
+ msgid "Delivery Action"
783
+ msgstr ""
784
+
685
785
  #. module: rma
686
786
  #: model:ir.model.fields,field_description:rma.field_rma__delivery_picking_count
687
787
  msgid "Delivery count"
@@ -698,6 +798,13 @@ msgstr ""
698
798
  msgid "Description"
699
799
  msgstr ""
700
800
 
801
+ #. module: rma
802
+ #: model:ir.model.fields,field_description:rma.field_rma__different_return_product
803
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__different_return_product
804
+ #: model:ir.model.fields,field_description:rma.field_stock_return_picking_line__different_return_product
805
+ msgid "Different Return Product"
806
+ msgstr ""
807
+
701
808
  #. module: rma
702
809
  #: model:ir.model.fields,field_description:rma.field_rma__display_name
703
810
  #: model:ir.model.fields,field_description:rma.field_rma_delivery_wizard__display_name
@@ -711,8 +818,11 @@ msgid "Display Name"
711
818
  msgstr ""
712
819
 
713
820
  #. module: rma
821
+ #. odoo-python
822
+ #: code:addons/rma/models/rma_operation.py:0
714
823
  #: model:ir.model.fields.selection,name:rma.selection__rma__state__draft
715
824
  #: model_terms:ir.ui.view,arch_db:rma.rma_view_search
825
+ #, python-format
716
826
  msgid "Draft"
717
827
  msgstr ""
718
828
 
@@ -773,6 +883,13 @@ msgstr ""
773
883
  msgid "Email sent to the customer when they place an RMA from the portal"
774
884
  msgstr ""
775
885
 
886
+ #. module: rma
887
+ #: model:ir.model.fields,help:rma.field_rma_operation__auto_confirm_reception
888
+ msgid ""
889
+ "Enable this option to automatically confirm the reception when the RMA is "
890
+ "confirmed."
891
+ msgstr ""
892
+
776
893
  #. module: rma
777
894
  #. odoo-python
778
895
  #: code:addons/rma/wizard/rma_split.py:0
@@ -894,6 +1011,15 @@ msgstr ""
894
1011
  msgid "Icon to indicate an exception activity."
895
1012
  msgstr ""
896
1013
 
1014
+ #. module: rma
1015
+ #: model:ir.model.fields,help:rma.field_rma__different_return_product
1016
+ #: model:ir.model.fields,help:rma.field_rma_operation__different_return_product
1017
+ #: model:ir.model.fields,help:rma.field_stock_return_picking_line__different_return_product
1018
+ msgid ""
1019
+ "If checked, allows the return of a product different from the one originally "
1020
+ "ordered. Used if the delivery is created automatically"
1021
+ msgstr ""
1022
+
897
1023
  #. module: rma
898
1024
  #: model:ir.model.fields,help:rma.field_rma__message_needaction
899
1025
  #: model:ir.model.fields,help:rma.field_rma_team__message_needaction
@@ -1043,6 +1169,19 @@ msgstr ""
1043
1169
  msgid "Manager"
1044
1170
  msgstr ""
1045
1171
 
1172
+ #. module: rma
1173
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_delivery__manual_after_receipt
1174
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_refund__manual_after_receipt
1175
+ msgid "Manually After Receipt"
1176
+ msgstr ""
1177
+
1178
+ #. module: rma
1179
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_delivery__manual_on_confirm
1180
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_receipt__manual_on_confirm
1181
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_refund__manual_on_confirm
1182
+ msgid "Manually on Confirm"
1183
+ msgstr ""
1184
+
1046
1185
  #. module: rma
1047
1186
  #: model:ir.model.fields,field_description:rma.field_rma__message_has_error
1048
1187
  #: model:ir.model.fields,field_description:rma.field_rma_team__message_has_error
@@ -1077,6 +1216,11 @@ msgstr ""
1077
1216
  msgid "New"
1078
1217
  msgstr ""
1079
1218
 
1219
+ #. module: rma
1220
+ #: model:ir.actions.act_window,name:rma.action_rma_form
1221
+ msgid "New RMA"
1222
+ msgstr ""
1223
+
1080
1224
  #. module: rma
1081
1225
  #: model:ir.model.fields,field_description:rma.field_rma__activity_date_deadline
1082
1226
  msgid "Next Activity Deadline"
@@ -1140,6 +1284,12 @@ msgstr ""
1140
1284
  msgid "Operation"
1141
1285
  msgstr ""
1142
1286
 
1287
+ #. module: rma
1288
+ #: model:ir.actions.act_window,name:rma.rma_operation_act_window
1289
+ #: model:ir.ui.menu,name:rma.rma_operation_menu
1290
+ msgid "Operations"
1291
+ msgstr ""
1292
+
1143
1293
  #. module: rma
1144
1294
  #: model:ir.model.fields,help:rma.field_rma_team__alias_force_thread_id
1145
1295
  msgid ""
@@ -1173,6 +1323,11 @@ msgstr ""
1173
1323
  msgid "Other Information"
1174
1324
  msgstr ""
1175
1325
 
1326
+ #. module: rma
1327
+ #: model:ir.ui.menu,name:rma.rma_dashboard_menu
1328
+ msgid "Overview"
1329
+ msgstr ""
1330
+
1176
1331
  #. module: rma
1177
1332
  #: model:ir.model.fields,field_description:rma.field_rma_team__alias_user_id
1178
1333
  msgid "Owner"
@@ -1227,7 +1382,10 @@ msgid "Priority"
1227
1382
  msgstr ""
1228
1383
 
1229
1384
  #. module: rma
1385
+ #. odoo-python
1386
+ #: code:addons/rma/models/rma_operation.py:0
1230
1387
  #: model_terms:ir.ui.view,arch_db:rma.rma_view_search
1388
+ #, python-format
1231
1389
  msgid "Processed"
1232
1390
  msgstr ""
1233
1391
 
@@ -1248,6 +1406,13 @@ msgstr ""
1248
1406
  msgid "Product qty"
1249
1407
  msgstr ""
1250
1408
 
1409
+ #. module: rma
1410
+ #: model:ir.model.fields,help:rma.field_rma__return_product_id
1411
+ #: model:ir.model.fields,help:rma.field_stock_return_picking_line__return_product_id
1412
+ msgid ""
1413
+ "Product to be returned if it's different from the originally delivered item."
1414
+ msgstr ""
1415
+
1251
1416
  #. module: rma
1252
1417
  #: model:ir.model.fields,field_description:rma.field_rma_tag__is_public
1253
1418
  msgid "Public Tag"
@@ -1296,6 +1461,7 @@ msgstr ""
1296
1461
  #: model:ir.module.category,name:rma.rma_module_category
1297
1462
  #: model:ir.ui.menu,name:rma.rma_menu
1298
1463
  #: model_terms:ir.ui.view,arch_db:rma.res_config_settings_view_form
1464
+ #: model_terms:ir.ui.view,arch_db:rma.rma_operation_kanban
1299
1465
  #: model_terms:ir.ui.view,arch_db:rma.view_partner_form
1300
1466
  #: model_terms:ir.ui.view,arch_db:rma.view_picking_form
1301
1467
  msgid "RMA"
@@ -1407,6 +1573,11 @@ msgstr ""
1407
1573
  msgid "RMA Out Type"
1408
1574
  msgstr ""
1409
1575
 
1576
+ #. module: rma
1577
+ #: model:ir.actions.act_window,name:rma.rma_dashboard_action
1578
+ msgid "RMA Overview"
1579
+ msgstr ""
1580
+
1410
1581
  #. module: rma
1411
1582
  #: model_terms:ir.ui.view,arch_db:rma.res_config_settings_view_form
1412
1583
  msgid "RMA Receipt Confirmation Email"
@@ -1551,7 +1722,10 @@ msgid "Reason Name"
1551
1722
  msgstr ""
1552
1723
 
1553
1724
  #. module: rma
1725
+ #. odoo-python
1726
+ #: code:addons/rma/models/rma.py:0
1554
1727
  #: model_terms:ir.ui.view,arch_db:rma.rma_view_form
1728
+ #, python-format
1555
1729
  msgid "Receipt"
1556
1730
  msgstr ""
1557
1731
 
@@ -1586,6 +1760,11 @@ msgstr ""
1586
1760
  msgid "Refund"
1587
1761
  msgstr "退货"
1588
1762
 
1763
+ #. module: rma
1764
+ #: model:ir.model.fields,field_description:rma.field_rma_operation__action_create_refund
1765
+ msgid "Refund Action"
1766
+ msgstr ""
1767
+
1589
1768
  #. module: rma
1590
1769
  #: model:ir.model.fields,field_description:rma.field_rma__refund_line_id
1591
1770
  msgid "Refund Line"
@@ -1705,6 +1884,12 @@ msgstr ""
1705
1884
  msgid "Return Picking Line"
1706
1885
  msgstr ""
1707
1886
 
1887
+ #. module: rma
1888
+ #: model:ir.model.fields,field_description:rma.field_rma__return_product_id
1889
+ #: model:ir.model.fields,field_description:rma.field_stock_return_picking_line__return_product_id
1890
+ msgid "Return Product"
1891
+ msgstr ""
1892
+
1708
1893
  #. module: rma
1709
1894
  #: model:ir.actions.act_window,name:rma.rma_delivery_wizard_action
1710
1895
  #: model:ir.model.fields.selection,name:rma.selection__rma_delivery_wizard__type__return
@@ -1833,6 +2018,7 @@ msgstr ""
1833
2018
  #. module: rma
1834
2019
  #: model:ir.actions.act_window,name:rma.action_rma_config_settings
1835
2020
  #: model:ir.ui.menu,name:rma.menu_rma_general_settings
2021
+ #: model_terms:ir.ui.view,arch_db:rma.rma_operation_form_view
1836
2022
  msgid "Settings"
1837
2023
  msgstr ""
1838
2024
 
@@ -1851,6 +2037,26 @@ msgstr ""
1851
2037
  msgid "Shipping address for current RMA."
1852
2038
  msgstr ""
1853
2039
 
2040
+ #. module: rma
2041
+ #: model:ir.model.fields,field_description:rma.field_rma__show_create_receipt
2042
+ msgid "Show Create Receipt Button"
2043
+ msgstr ""
2044
+
2045
+ #. module: rma
2046
+ #: model:ir.model.fields,field_description:rma.field_rma__show_create_return
2047
+ msgid "Show Create Return Button"
2048
+ msgstr ""
2049
+
2050
+ #. module: rma
2051
+ #: model:ir.model.fields,field_description:rma.field_rma__show_create_refund
2052
+ msgid "Show Create refund Button"
2053
+ msgstr ""
2054
+
2055
+ #. module: rma
2056
+ #: model:ir.model.fields,field_description:rma.field_rma__show_create_replace
2057
+ msgid "Show Create replace Button"
2058
+ msgstr ""
2059
+
1854
2060
  #. module: rma
1855
2061
  #: model:ir.model.fields,field_description:rma.field_rma__origin
1856
2062
  msgid "Source Document"
@@ -1945,6 +2151,13 @@ msgstr ""
1945
2151
  msgid "That operation name already exists !"
1946
2152
  msgstr ""
1947
2153
 
2154
+ #. module: rma
2155
+ #: model_terms:ir.actions.act_window,help:rma.rma_dashboard_action
2156
+ msgid ""
2157
+ "The RMA operation system allows you to configure each return operation\n"
2158
+ " with specific settings that will adjust its behavior."
2159
+ msgstr ""
2160
+
1948
2161
  #. module: rma
1949
2162
  #: model:ir.model.fields,help:rma.field_rma_tag__active
1950
2163
  msgid "The active field allows you to hide the category without removing it."
@@ -1990,6 +2203,15 @@ msgstr ""
1990
2203
  msgid "The quantity to return is greater than remaining quantity."
1991
2204
  msgstr ""
1992
2205
 
2206
+ #. module: rma
2207
+ #. odoo-python
2208
+ #: code:addons/rma/models/rma.py:0
2209
+ #, python-format
2210
+ msgid ""
2211
+ "The selected operation requires a return product different from the "
2212
+ "originally delivered item. Please select the product to return."
2213
+ msgstr ""
2214
+
1993
2215
  #. module: rma
1994
2216
  #: model:ir.model.fields,help:rma.field_rma_tag__is_public
1995
2217
  msgid "The tag is visible in the portal view"
@@ -2077,6 +2299,11 @@ msgstr ""
2077
2299
  msgid "UoM"
2078
2300
  msgstr ""
2079
2301
 
2302
+ #. module: rma
2303
+ #: model:ir.model.fields.selection,name:rma.selection__rma_operation__action_create_refund__update_quantity
2304
+ msgid "Update Quantities"
2305
+ msgstr ""
2306
+
2080
2307
  #. module: rma
2081
2308
  #: model:ir.model.fields.selection,name:rma.selection__rma__priority__1
2082
2309
  msgid "Urgent"
@@ -317,6 +317,63 @@ class Rma(models.Model):
317
317
  copy=False,
318
318
  )
319
319
 
320
+ show_create_receipt = fields.Boolean(
321
+ string="Show Create Receipt Button", compute="_compute_show_create_receipt"
322
+ )
323
+ show_create_return = fields.Boolean(
324
+ string="Show Create Return Button", compute="_compute_show_create_return"
325
+ )
326
+ show_create_replace = fields.Boolean(
327
+ string="Show Create replace Button", compute="_compute_show_create_replace"
328
+ )
329
+ show_create_refund = fields.Boolean(
330
+ string="Show Create refund Button", compute="_compute_show_refund_replace"
331
+ )
332
+ return_product_id = fields.Many2one(
333
+ "product.product",
334
+ help="Product to be returned if it's different from the originally delivered "
335
+ "item.",
336
+ )
337
+ different_return_product = fields.Boolean(
338
+ related="operation_id.different_return_product"
339
+ )
340
+
341
+ @api.depends("operation_id.action_create_receipt", "state", "reception_move_id")
342
+ def _compute_show_create_receipt(self):
343
+ for rec in self:
344
+ rec.show_create_receipt = (
345
+ not rec.reception_move_id
346
+ and rec.operation_id.action_create_receipt == "manual_on_confirm"
347
+ and rec.state == "confirmed"
348
+ )
349
+
350
+ @api.depends("operation_id.action_create_delivery", "can_be_returned")
351
+ def _compute_show_create_return(self):
352
+ for rec in self:
353
+ rec.show_create_return = (
354
+ rec.operation_id.action_create_delivery
355
+ in ("manual_on_confirm", "manual_after_receipt")
356
+ and rec.can_be_returned
357
+ )
358
+
359
+ @api.depends("operation_id.action_create_delivery", "can_be_replaced")
360
+ def _compute_show_create_replace(self):
361
+ for rec in self:
362
+ rec.show_create_replace = (
363
+ rec.operation_id.action_create_delivery
364
+ in ("manual_on_confirm", "manual_after_receipt")
365
+ and rec.can_be_replaced
366
+ )
367
+
368
+ @api.depends("operation_id.action_create_refund", "can_be_refunded")
369
+ def _compute_show_refund_replace(self):
370
+ for rec in self:
371
+ rec.show_create_refund = (
372
+ rec.operation_id.action_create_refund
373
+ in ("manual_on_confirm", "manual_after_receipt")
374
+ and rec.can_be_refunded
375
+ )
376
+
320
377
  def _compute_delivery_picking_count(self):
321
378
  for rma in self:
322
379
  rma.delivery_picking_count = len(rma.delivery_move_ids.picking_id)
@@ -394,9 +451,17 @@ class Rma(models.Model):
394
451
  an rma can be refunded. It is used in rma.action_refund method.
395
452
  """
396
453
  for record in self:
397
- record.can_be_refunded = record.state == "received"
454
+ record.can_be_refunded = (
455
+ record.operation_id.action_create_refund
456
+ in ("manual_after_receipt", "automatic_after_receipt")
457
+ and record.state == "received"
458
+ ) or (
459
+ record.operation_id.action_create_refund
460
+ in ("manual_on_confirm", "automatic_on_confirm")
461
+ and record.state == "confirmed"
462
+ )
398
463
 
399
- @api.depends("remaining_qty", "state")
464
+ @api.depends("remaining_qty", "state", "operation_id.action_create_delivery")
400
465
  def _compute_can_be_returned(self):
401
466
  """Compute 'can_be_returned'. This field controls the visibility
402
467
  of the 'Return to customer' button in the rma form
@@ -406,8 +471,17 @@ class Rma(models.Model):
406
471
  rma._ensure_can_be_returned.
407
472
  """
408
473
  for r in self:
409
- r.can_be_returned = (
410
- r.state in ["received", "waiting_return"] and r.remaining_qty > 0
474
+ r.can_be_returned = r.remaining_qty > 0 and (
475
+ (
476
+ r.operation_id.action_create_delivery
477
+ in ("manual_after_receipt", "automatic_after_receipt")
478
+ and r.state in ["received", "waiting_return"]
479
+ )
480
+ or (
481
+ r.operation_id.action_create_delivery
482
+ in ("manual_on_confirm", "automatic_on_confirm")
483
+ and r.state == "confirmed"
484
+ )
411
485
  )
412
486
 
413
487
  @api.depends("state")
@@ -420,11 +494,20 @@ class Rma(models.Model):
420
494
  rma._ensure_can_be_replaced.
421
495
  """
422
496
  for r in self:
423
- r.can_be_replaced = r.state in [
424
- "received",
425
- "waiting_replacement",
426
- "replaced",
427
- ]
497
+ r.can_be_replaced = (
498
+ r.operation_id.action_create_delivery
499
+ in ("manual_after_receipt", "automatic_after_receipt")
500
+ and r.state
501
+ in [
502
+ "received",
503
+ "waiting_replacement",
504
+ "replaced",
505
+ ]
506
+ ) or (
507
+ r.operation_id.action_create_delivery
508
+ in ("manual_on_confirm", "automatic_on_confirm")
509
+ and r.state == "confirmed"
510
+ )
428
511
 
429
512
  @api.depends("state", "remaining_qty")
430
513
  def _compute_can_be_finished(self):
@@ -699,8 +782,11 @@ class Rma(models.Model):
699
782
  vals = self._prepare_common_procurement_vals(group=group)
700
783
  vals["route_ids"] = self.warehouse_id.rma_in_route_id
701
784
  vals["rma_receiver_ids"] = [(6, 0, self.ids)]
785
+ vals["to_refund"] = self.operation_id.action_create_refund == "update_quantity"
702
786
  if self.move_id:
703
787
  vals["origin_returned_move_id"] = self.move_id.id
788
+ if not self.operation_id.different_return_product:
789
+ vals["move_orig_ids"] = [(6, 0, self.move_id.ids)]
704
790
  return vals
705
791
 
706
792
  def _prepare_reception_procurements(self):
@@ -712,13 +798,24 @@ class Rma(models.Model):
712
798
  group = rma.procurement_group_id
713
799
  if not group:
714
800
  group = group_model.create(rma._prepare_procurement_group_vals())
801
+ product = self.product_id
802
+ if self.different_return_product:
803
+ if not self.return_product_id:
804
+ raise ValidationError(
805
+ _(
806
+ "The selected operation requires a return product different"
807
+ " from the originally delivered item. Please select the "
808
+ "product to return."
809
+ )
810
+ )
811
+ product = self.return_product_id
715
812
  procurements.append(
716
813
  group_model.Procurement(
717
- rma.product_id,
814
+ product,
718
815
  rma.product_uom_qty,
719
816
  rma.product_uom,
720
817
  rma.location_id,
721
- rma.product_id.display_name,
818
+ product.display_name,
722
819
  group.name,
723
820
  rma.company_id,
724
821
  rma._prepare_reception_procurement_vals(group),
@@ -726,20 +823,54 @@ class Rma(models.Model):
726
823
  )
727
824
  return procurements
728
825
 
826
+ def _create_receipt(self):
827
+ procurements = self._prepare_reception_procurements()
828
+ if procurements:
829
+ self.env["procurement.group"].run(procurements)
830
+ self.reception_move_id.picking_id.action_assign()
831
+ if self.operation_id.auto_confirm_reception:
832
+ self.reception_move_id._set_quantities_to_reservation()
833
+ self.reception_move_id._action_done()
834
+
835
+ def action_create_receipt(self):
836
+ self.ensure_one()
837
+ self._create_receipt()
838
+ self.ensure_one()
839
+ return {
840
+ "name": _("Receipt"),
841
+ "type": "ir.actions.act_window",
842
+ "view_type": "form",
843
+ "view_mode": "form",
844
+ "res_model": "stock.picking",
845
+ "views": [[False, "form"]],
846
+ "res_id": self.reception_move_id.picking_id.id,
847
+ }
848
+
729
849
  def action_confirm(self):
730
850
  """Invoked when 'Confirm' button in rma form view is clicked."""
731
851
  self._ensure_required_fields()
732
852
  self = self.filtered(lambda rma: rma.state == "draft")
733
853
  if not self:
734
854
  return
735
- procurements = self._prepare_reception_procurements()
736
- if procurements:
737
- self.env["procurement.group"].run(procurements)
738
- self.reception_move_id.picking_id.action_assign()
739
855
  self.write({"state": "confirmed"})
740
856
  for rma in self:
741
857
  rma._add_message_subscribe_partner()
742
858
  self._send_confirmation_email()
859
+ for rec in self:
860
+ if rec.operation_id.action_create_receipt == "automatic_on_confirm":
861
+ rec._create_receipt()
862
+ if rec.operation_id.action_create_delivery == "automatic_on_confirm":
863
+ rec.with_context(
864
+ rma_return_grouping=rec.env.company.rma_return_grouping
865
+ ).create_replace(
866
+ fields.Datetime.now(),
867
+ rec.warehouse_id,
868
+ rec.product_id,
869
+ rec.product_uom_qty,
870
+ rec.product_uom,
871
+ )
872
+ if rec.operation_id.action_create_refund == "automatic_on_confirm":
873
+ rec.action_refund()
743
874
 
744
875
  def action_refund(self):
745
876
  """Invoked when 'Refund' button in rma form view is clicked
@@ -1377,6 +1508,20 @@ class Rma(models.Model):
1377
1508
  """
1378
1509
  self.write({"state": "received"})
1379
1510
  self._send_receipt_confirmation_email()
1511
+ for rec in self:
1512
+ if rec.operation_id.action_create_delivery == "automatic_after_receipt":
1513
+ rec.with_context(
1514
+ rma_return_grouping=rec.env.company.rma_return_grouping
1515
+ ).create_replace(
1516
+ fields.Datetime.now(),
1517
+ rec.warehouse_id,
1518
+ rec.product_id,
1519
+ rec.product_uom_qty,
1520
+ rec.product_uom,
1521
+ )
1522
+
1523
+ if rec.operation_id.action_create_refund == "automatic_after_receipt":
1524
+ rec.action_refund()
1380
1525
 
1381
1526
  def update_received_state(self):
1382
1527
  """Invoked by: