[IMP] rma: set rma to received on invoice delete + incoming picking type use existing lot by default.

[IMP] rma: set rma to received on invoice delete.

Remove 'waiting_refund' rma state.
RMAs go from received to refunded.
When the linked refund is deleted the rma is set to received.

[UPD] Update rma.pot

rma 12.0.1.4.2

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: rma-12.0/rma-12.0-rma
Translate-URL: https://translation.odoo-community.org/projects/rma-12-0/rma-12-0-rma/

[IMP] rma: incoming picking type use existing lot by default.

rma 12.0.1.4.3
This commit is contained in:
Ernesto Tejeda
2020-09-15 16:04:43 -04:00
committed by Víctor Martínez
parent 54fc124f25
commit e0b110bf67
8 changed files with 94 additions and 83 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "Return Merchandise Authorization Management",
"summary": "Return Merchandise Authorization (RMA)",
"version": "12.0.1.4.1",
"version": "12.0.1.4.3",
"development_status": "Beta",
"category": "RMA",
"website": "https://github.com/OCA/rma",

View File

@@ -536,7 +536,7 @@ msgid "Draft RMA"
msgstr "RMA en estado Borrador"
#. module: rma
#: code:addons/rma/models/rma.py:1098
#: code:addons/rma/models/rma.py:1097
#, python-format
msgid ""
"E-mail subject: %s\n"
@@ -639,7 +639,7 @@ msgstr ""
"sin eliminarlo."
#. module: rma
#: code:addons/rma/models/rma.py:1102
#: code:addons/rma/models/rma.py:1101
#, python-format
msgid "Incoming e-mail"
msgstr "Correo electrónico entrante"
@@ -745,8 +745,8 @@ msgid "Name"
msgstr "Nombre"
#. module: rma
#: code:addons/rma/models/rma.py:31 code:addons/rma/models/rma.py:495
#: code:addons/rma/models/rma.py:1101
#: code:addons/rma/models/rma.py:31 code:addons/rma/models/rma.py:494
#: code:addons/rma/models/rma.py:1100
#, python-format
msgid "New"
msgstr "Nuevo"
@@ -767,13 +767,13 @@ msgid "Next Activity Type"
msgstr "Siguiente tipo de actividad"
#. module: rma
#: code:addons/rma/models/rma.py:773
#: code:addons/rma/models/rma.py:772
#, python-format
msgid "None of the selected RMAs can perform a replacement."
msgstr "Ninguno de los RMAs seleccionados puede realizar un reemplazo."
#. module: rma
#: code:addons/rma/models/rma.py:756
#: code:addons/rma/models/rma.py:755
#, python-format
msgid "None of the selected RMAs can perform a return."
msgstr "Ninguno de los RMAs seleccionados puede realizar una devolución."
@@ -954,7 +954,7 @@ msgid "Quantity to extract"
msgstr "Cantidad a extraer"
#. module: rma
#: code:addons/rma/models/rma.py:806
#: code:addons/rma/models/rma.py:805
#, python-format
msgid ""
"Quantity to extract cannot be greater than remaining delivery quantity (%s "
@@ -1132,7 +1132,7 @@ msgid "Reference of the document that generated this RMA."
msgstr "Referencia al documento que generó este RMA."
#. module: rma
#: code:addons/rma/models/rma.py:694
#: code:addons/rma/models/rma.py:693
#: model:ir.model.fields,field_description:rma.field_rma__refund_id
#: model_terms:ir.ui.view,arch_db:rma.rma_view_form
#: model:rma.operation,name:rma.rma_operation_refund
@@ -1188,7 +1188,7 @@ msgid "Replaced"
msgstr "Reemplazado"
#. module: rma
#: code:addons/rma/models/rma.py:1011
#: code:addons/rma/models/rma.py:1010
#, python-format
msgid ""
"Replacement: Move <a href=\"#\" data-oe-model=\"stock.move\" data-oe-id=\"%d"
@@ -1200,7 +1200,7 @@ msgstr ""
"picking\" data-oe-id=\"%d\">%s</a>) ha sido creado."
#. module: rma
#: code:addons/rma/models/rma.py:1022
#: code:addons/rma/models/rma.py:1021
#, python-format
msgid ""
"Replacement:<br/>Product <a href=\"#\" data-oe-model=\"product.product\" "
@@ -1224,7 +1224,7 @@ msgid "Requested operation"
msgstr "Operación solicitada"
#. module: rma
#: code:addons/rma/models/rma.py:737
#: code:addons/rma/models/rma.py:736
#, python-format
msgid "Required field(s):%s"
msgstr "Campo(s) requerido(s):%s"
@@ -1253,7 +1253,7 @@ msgid "Return to customer"
msgstr "Devolver al cliente"
#. module: rma
#: code:addons/rma/models/rma.py:972
#: code:addons/rma/models/rma.py:971
#, python-format
msgid ""
"Return: <a href=\"#\" data-oe-model=\"stock.picking\" data-oe-id=\"%d\">%s</"
@@ -1341,7 +1341,7 @@ msgid "Split RMA"
msgstr "Dividir RMA"
#. module: rma
#: code:addons/rma/models/rma.py:890
#: code:addons/rma/models/rma.py:889
#, python-format
msgid ""
"Split: <a href=\"#\" data-oe-model=\"rma\" data-oe-id=\"%d\">%s</a> has been "
@@ -1447,7 +1447,7 @@ msgstr ""
"inicial porque el movimiento está enlazado a un RMA (%s)."
#. module: rma
#: code:addons/rma/models/rma.py:794
#: code:addons/rma/models/rma.py:793
#, python-format
msgid "The quantity to return is greater than remaining quantity."
msgstr "La cantidad a devolver es mayor que la cantidad restante del RMA."
@@ -1463,19 +1463,19 @@ msgstr ""
"cantidad especificada en el RMA asociado."
#. module: rma
#: code:addons/rma/models/rma.py:783
#: code:addons/rma/models/rma.py:782
#, python-format
msgid "This RMA cannot be split."
msgstr "Este RMA no puede ser dividido."
#. module: rma
#: code:addons/rma/models/rma.py:770
#: code:addons/rma/models/rma.py:769
#, python-format
msgid "This RMA cannot perform a replacement."
msgstr "Este RMA no puede realizar un reemplazo."
#. module: rma
#: code:addons/rma/models/rma.py:753
#: code:addons/rma/models/rma.py:752
#, python-format
msgid "This RMA cannot perform a return."
msgstr "Este RMA no puede realizar una devolución."
@@ -1564,11 +1564,6 @@ msgstr "Usuarios"
msgid "Very Urgent"
msgstr "Muy Urgente"
#. module: rma
#: selection:rma,state:0
msgid "Waiting for refund"
msgstr "Esperando por reembolso"
#. module: rma
#: selection:rma,state:0
msgid "Waiting for replacement"
@@ -1599,7 +1594,7 @@ msgid "Website communication history"
msgstr "Historial de comunicaciones del sitio web"
#. module: rma
#: code:addons/rma/models/rma.py:517
#: code:addons/rma/models/rma.py:516
#, python-format
msgid "You cannot delete RMAs that are not in draft state"
msgstr "No puede eliminar RMAs que no estén en estado borrador"
@@ -1635,5 +1630,8 @@ msgstr ""
"El usuario tendrá acceso a la configuración de RMA y a los informes "
"estadísticos."
#~ msgid "Waiting for refund"
#~ msgstr "Esperando por reembolso"
#~ msgid "New RMA in draft state"
#~ msgstr "Nuevo RMA en estado Borrador"

View File

@@ -535,7 +535,7 @@ msgid "Draft RMA"
msgstr "Rascunho do RMA"
#. module: rma
#: code:addons/rma/models/rma.py:1098
#: code:addons/rma/models/rma.py:1097
#, python-format
msgid ""
"E-mail subject: %s\n"
@@ -638,7 +638,7 @@ msgstr ""
"sem removê-lo."
#. module: rma
#: code:addons/rma/models/rma.py:1102
#: code:addons/rma/models/rma.py:1101
#, python-format
msgid "Incoming e-mail"
msgstr "E-mail recebido"
@@ -744,8 +744,8 @@ msgid "Name"
msgstr "Nome"
#. module: rma
#: code:addons/rma/models/rma.py:31 code:addons/rma/models/rma.py:495
#: code:addons/rma/models/rma.py:1101
#: code:addons/rma/models/rma.py:31 code:addons/rma/models/rma.py:494
#: code:addons/rma/models/rma.py:1100
#, python-format
msgid "New"
msgstr "Novo(a)"
@@ -766,13 +766,13 @@ msgid "Next Activity Type"
msgstr "Tipo da Próxima Atividade"
#. module: rma
#: code:addons/rma/models/rma.py:773
#: code:addons/rma/models/rma.py:772
#, python-format
msgid "None of the selected RMAs can perform a replacement."
msgstr "Nenhum dos RMAs selecionados pode executar uma substituição."
#. module: rma
#: code:addons/rma/models/rma.py:756
#: code:addons/rma/models/rma.py:755
#, python-format
msgid "None of the selected RMAs can perform a return."
msgstr "Nenhum dos RMAs selecionados pode executar uma devolução."
@@ -953,7 +953,7 @@ msgid "Quantity to extract"
msgstr "Quantidade a extrair"
#. module: rma
#: code:addons/rma/models/rma.py:806
#: code:addons/rma/models/rma.py:805
#, python-format
msgid ""
"Quantity to extract cannot be greater than remaining delivery quantity (%s "
@@ -1130,7 +1130,7 @@ msgid "Reference of the document that generated this RMA."
msgstr "Referência do documento que gerou este RMA."
#. module: rma
#: code:addons/rma/models/rma.py:694
#: code:addons/rma/models/rma.py:693
#: model:ir.model.fields,field_description:rma.field_rma__refund_id
#: model_terms:ir.ui.view,arch_db:rma.rma_view_form
#: model:rma.operation,name:rma.rma_operation_refund
@@ -1186,7 +1186,7 @@ msgid "Replaced"
msgstr "Substituído"
#. module: rma
#: code:addons/rma/models/rma.py:1011
#: code:addons/rma/models/rma.py:1010
#, python-format
msgid ""
"Replacement: Move <a href=\"#\" data-oe-model=\"stock.move\" data-oe-id=\"%d"
@@ -1198,7 +1198,7 @@ msgstr ""
"data-oe-id=\"%d\">%s</a> foi criada."
#. module: rma
#: code:addons/rma/models/rma.py:1022
#: code:addons/rma/models/rma.py:1021
#, python-format
msgid ""
"Replacement:<br/>Product <a href=\"#\" data-oe-model=\"product.product\" "
@@ -1222,7 +1222,7 @@ msgid "Requested operation"
msgstr "Operação Solicitada"
#. module: rma
#: code:addons/rma/models/rma.py:737
#: code:addons/rma/models/rma.py:736
#, python-format
msgid "Required field(s):%s"
msgstr "Campo(s) Solicitado(s):%s"
@@ -1251,7 +1251,7 @@ msgid "Return to customer"
msgstr "Retornar ao cliente"
#. module: rma
#: code:addons/rma/models/rma.py:972
#: code:addons/rma/models/rma.py:971
#, python-format
msgid ""
"Return: <a href=\"#\" data-oe-model=\"stock.picking\" data-oe-id=\"%d\">%s</"
@@ -1339,7 +1339,7 @@ msgid "Split RMA"
msgstr "Dividir RMA"
#. module: rma
#: code:addons/rma/models/rma.py:890
#: code:addons/rma/models/rma.py:889
#, python-format
msgid ""
"Split: <a href=\"#\" data-oe-model=\"rma\" data-oe-id=\"%d\">%s</a> has been "
@@ -1444,7 +1444,7 @@ msgstr ""
"inicial, porque a movimentação do estoque está vinculada a uma RMA (%s)."
#. module: rma
#: code:addons/rma/models/rma.py:794
#: code:addons/rma/models/rma.py:793
#, python-format
msgid "The quantity to return is greater than remaining quantity."
msgstr "A quantidade a retornar é maior que a quantidade restante."
@@ -1460,19 +1460,19 @@ msgstr ""
"especificada na sua RMA vinculada."
#. module: rma
#: code:addons/rma/models/rma.py:783
#: code:addons/rma/models/rma.py:782
#, python-format
msgid "This RMA cannot be split."
msgstr "Esta RMA não pode ser dividida."
#. module: rma
#: code:addons/rma/models/rma.py:770
#: code:addons/rma/models/rma.py:769
#, python-format
msgid "This RMA cannot perform a replacement."
msgstr "Esta RMA não pode executar uma substituição."
#. module: rma
#: code:addons/rma/models/rma.py:753
#: code:addons/rma/models/rma.py:752
#, python-format
msgid "This RMA cannot perform a return."
msgstr "Este RMA não pode executar uma devolução."
@@ -1561,11 +1561,6 @@ msgstr "Usuários"
msgid "Very Urgent"
msgstr "Muito Urgente"
#. module: rma
#: selection:rma,state:0
msgid "Waiting for refund"
msgstr "Aguardando Restituição"
#. module: rma
#: selection:rma,state:0
msgid "Waiting for replacement"
@@ -1596,7 +1591,7 @@ msgid "Website communication history"
msgstr "Histórico de Comunicação Através do Site"
#. module: rma
#: code:addons/rma/models/rma.py:517
#: code:addons/rma/models/rma.py:516
#, python-format
msgid "You cannot delete RMAs that are not in draft state"
msgstr "Você não pode apagar RMAs que não estejam na situação \"Rascunho\""
@@ -1631,5 +1626,8 @@ msgstr ""
"o usuário terá acesso à configuração RMA, bem como aos relatórios "
"estatísticos."
#~ msgid "Waiting for refund"
#~ msgstr "Aguardando Restituição"
#~ msgid "New RMA in draft state"
#~ msgstr "Novo Rascunho de RMA"

View File

@@ -486,7 +486,7 @@ msgid "Draft RMA"
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:1098
#: code:addons/rma/models/rma.py:1097
#, python-format
msgid "E-mail subject: %s\n"
"\n"
@@ -576,7 +576,7 @@ msgid "If the active field is set to false, it will allow you to hide the RMA Te
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:1102
#: code:addons/rma/models/rma.py:1101
#, python-format
msgid "Incoming e-mail"
msgstr ""
@@ -683,8 +683,8 @@ msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:31
#: code:addons/rma/models/rma.py:495
#: code:addons/rma/models/rma.py:1101
#: code:addons/rma/models/rma.py:494
#: code:addons/rma/models/rma.py:1100
#, python-format
msgid "New"
msgstr ""
@@ -705,13 +705,13 @@ msgid "Next Activity Type"
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:773
#: code:addons/rma/models/rma.py:772
#, python-format
msgid "None of the selected RMAs can perform a replacement."
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:756
#: code:addons/rma/models/rma.py:755
#, python-format
msgid "None of the selected RMAs can perform a return."
msgstr ""
@@ -875,7 +875,7 @@ msgid "Quantity to extract"
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:806
#: code:addons/rma/models/rma.py:805
#, python-format
msgid "Quantity to extract cannot be greater than remaining delivery quantity (%s %s)"
msgstr ""
@@ -1049,7 +1049,7 @@ msgid "Reference of the document that generated this RMA."
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:694
#: code:addons/rma/models/rma.py:693
#: model:ir.model.fields,field_description:rma.field_rma__refund_id
#: model_terms:ir.ui.view,arch_db:rma.rma_view_form
#: model:rma.operation,name:rma.rma_operation_refund
@@ -1105,13 +1105,13 @@ msgid "Replaced"
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:1011
#: code:addons/rma/models/rma.py:1010
#, python-format
msgid "Replacement: Move <a href=\"#\" data-oe-model=\"stock.move\" data-oe-id=\"%d\">%s</a> (Picking <a href=\"#\" data-oe-model=\"stock.picking\" data-oe-id=\"%d\">%s</a>) has been created."
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:1022
#: code:addons/rma/models/rma.py:1021
#, python-format
msgid "Replacement:<br/>Product <a href=\"#\" data-oe-model=\"product.product\" data-oe-id=\"%d\">%s</a><br/>Quantity %f %s<br/>This replacement did not create a new move, but one of the previously created moves was updated with this data."
msgstr ""
@@ -1127,7 +1127,7 @@ msgid "Requested operation"
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:737
#: code:addons/rma/models/rma.py:736
#, python-format
msgid "Required field(s):%s"
msgstr ""
@@ -1156,7 +1156,7 @@ msgid "Return to customer"
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:972
#: code:addons/rma/models/rma.py:971
#, python-format
msgid "Return: <a href=\"#\" data-oe-model=\"stock.picking\" data-oe-id=\"%d\">%s</a> has been created."
msgstr ""
@@ -1240,7 +1240,7 @@ msgid "Split RMA"
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:890
#: code:addons/rma/models/rma.py:889
#, python-format
msgid "Split: <a href=\"#\" data-oe-model=\"rma\" data-oe-id=\"%d\">%s</a> has been created."
msgstr ""
@@ -1314,7 +1314,7 @@ msgid "The quantity done for the product '%s' must be equal to its initial deman
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:794
#: code:addons/rma/models/rma.py:793
#, python-format
msgid "The quantity to return is greater than remaining quantity."
msgstr ""
@@ -1326,19 +1326,19 @@ msgid "There is at least one invoice lines whose quantity is less than the quant
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:783
#: code:addons/rma/models/rma.py:782
#, python-format
msgid "This RMA cannot be split."
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:770
#: code:addons/rma/models/rma.py:769
#, python-format
msgid "This RMA cannot perform a replacement."
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:753
#: code:addons/rma/models/rma.py:752
#, python-format
msgid "This RMA cannot perform a return."
msgstr ""
@@ -1427,11 +1427,6 @@ msgstr ""
msgid "Very Urgent"
msgstr ""
#. module: rma
#: selection:rma,state:0
msgid "Waiting for refund"
msgstr ""
#. module: rma
#: selection:rma,state:0
msgid "Waiting for replacement"
@@ -1462,7 +1457,7 @@ msgid "Website communication history"
msgstr ""
#. module: rma
#: code:addons/rma/models/rma.py:517
#: code:addons/rma/models/rma.py:516
#, python-format
msgid "You cannot delete RMAs that are not in draft state"
msgstr ""

View File

@@ -21,11 +21,12 @@ class AccountInvoice(models.Model):
raise ValidationError(
_("There is at least one invoice lines whose quantity is "
"less than the quantity specified in its linked RMA."))
res = super().action_invoice_open()
self.sudo().mapped('invoice_line_ids.rma_id').write(
{'state': 'refunded'}
)
return res
return super().action_invoice_open()
def unlink(self):
rma = self.mapped('invoice_line_ids.rma_id')
rma.write({'state': 'received'})
return super().unlink()
class AccountInvoiceLine(models.Model):

View File

@@ -164,7 +164,6 @@ class Rma(models.Model):
("draft", "Draft"),
("confirmed", "Confirmed"),
("received", "Received"),
("waiting_refund", "Waiting for refund"),
("waiting_return", "Waiting for return"),
("waiting_replacement", "Waiting for replacement"),
("refunded", "Refunded"),
@@ -402,7 +401,7 @@ class Rma(models.Model):
def _compute_can_be_locked(self):
for r in self:
r.can_be_locked = (r.remaining_qty_to_done > 0
and r.state in ['received', 'waiting_refund',
and r.state in ['received',
'waiting_return',
'waiting_replacement'])
@@ -590,7 +589,7 @@ class Rma(models.Model):
rma.write({
'refund_line_id': line.id,
'refund_id': refund.id,
'state': 'waiting_refund',
'state': 'refunded',
})
refund.message_post_with_view(
'mail.message_origin_link',

View File

@@ -72,8 +72,8 @@ class StockWarehouse(models.Model):
'rma_in_type_id': {
'name': _('RMA Receipts'),
'code': 'incoming',
'use_create_lots': True,
'use_existing_lots': False,
'use_create_lots': False,
'use_existing_lots': True,
'default_location_src_id': False,
'default_location_dest_id': self.rma_loc_id.id,
'sequence': max_sequence + 1,

View File

@@ -266,7 +266,7 @@ class TestRma(SavepointCase):
self.assertEqual(rma.refund_line_id.product_id, rma.product_id)
self.assertEqual(rma.refund_line_id.quantity, 10)
self.assertEqual(rma.refund_line_id.uom_id, rma.product_uom)
self.assertEqual(rma.state, 'waiting_refund')
self.assertEqual(rma.state, 'refunded')
self.assertFalse(rma.can_be_refunded)
self.assertFalse(rma.can_be_returned)
self.assertFalse(rma.can_be_replaced)
@@ -275,7 +275,6 @@ class TestRma(SavepointCase):
rma.refund_id.action_invoice_open()
rma.refund_line_id.quantity = 10
rma.refund_id.action_invoice_open()
self.assertEqual(rma.state, 'refunded')
self.assertFalse(rma.can_be_refunded)
self.assertFalse(rma.can_be_returned)
self.assertFalse(rma.can_be_replaced)
@@ -311,6 +310,8 @@ class TestRma(SavepointCase):
ctx = dict(self.env.context)
ctx.update(active_ids=all_rmas.ids, active_model='rma')
action.with_context(ctx).run()
# After that all RMAs are in 'refunded' state
self.assertEqual(all_rmas.mapped('state'), ['refunded'] * 4)
# Two refunds were created
refund_1 = (rma_1 | rma_2 | rma_3).mapped('refund_id')
refund_2 = rma_4.refund_id
@@ -351,7 +352,6 @@ class TestRma(SavepointCase):
rma_2.refund_line_id.quantity = 15
refund_1.action_invoice_open()
refund_2.action_invoice_open()
self.assertEqual(all_rmas.mapped('state'), ['refunded']*4)
def test_replace(self):
# Create, confirm and receive an RMA
@@ -636,3 +636,23 @@ class TestRma(SavepointCase):
self.assertEqual(new_rma.product_uom_qty + rma.product_uom_qty, 10)
self.assertEqual(new_rma.move_id.quantity_done, 10)
self.assertEqual(new_rma.reception_move_id.quantity_done, 10)
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()
self.assertEqual(rma.state, 'refunded')
rma.refund_id.unlink()
self.assertFalse(rma.refund_id)
self.assertEqual(rma.state, 'received')
self.assertTrue(rma.can_be_refunded)
self.assertTrue(rma.can_be_returned)
self.assertTrue(rma.can_be_replaced)
def test_rma_picking_type_default_values(self):
warehouse = self.env['stock.warehouse'].create({
'name': 'Stock - RMA Test',
'code': 'SRT',
})
self.assertFalse(warehouse.rma_in_type_id.use_create_lots)
self.assertTrue(warehouse.rma_in_type_id.use_existing_lots)