[FIX+IMP] rma: views permissions + portal permissions + teams flow

[FIX] rma: views permissions

Regular users don't have permissions to rma models, so we should avoid
loading views that lead to permission errors.

TT24986

rma_sale 12.0.1.1.0

[FIX] rma_sale: portal permissions

Some operations need to be sudoed to be reachable by the portal user

[UPD] Update rma_sale.pot

rma_sale 12.0.1.1.1

Update translation files

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

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

Update translation files

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

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

[IMP] rma: teams flow

- If no RMA Team is set, we'll assign a default one to the new RMA.
- A sequence is now used to search for the top team and assign it.
- No default user is assigned when it's not in the context (i.e. portal
rmas).

[UPD] Update rma_sale.pot

rma_sale 12.0.1.2.0

Update translation files

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

Translation: rma-12.0/rma-12.0-rma_sale
Translate-URL: https://translation.odoo-community.org/projects/rma-12-0/rma-12-0-rma_sale/
This commit is contained in:
david
2020-08-14 12:15:42 +02:00
committed by Alex Vining
parent 5212ab6905
commit 26ecb18f95
7 changed files with 26 additions and 23 deletions

View File

@@ -3,7 +3,7 @@
{ {
"name": "Return Merchandise Authorization Management - Link with Sales", "name": "Return Merchandise Authorization Management - Link with Sales",
"summary": "Sale Order - Return Merchandise Authorization (RMA)", "summary": "Sale Order - Return Merchandise Authorization (RMA)",
"version": "12.0.1.0.1", "version": "12.0.1.2.0",
"development_status": "Beta", "development_status": "Beta",
"category": "RMA", "category": "RMA",
"website": "https://github.com/OCA/rma", "website": "https://github.com/OCA/rma",

View File

@@ -25,12 +25,13 @@ class CustomerPortal(CustomerPortal):
mapped_vals.setdefault(row, {}).update({field_name: value}) mapped_vals.setdefault(row, {}).update({field_name: value})
line_vals = [(0, 0, vals) for vals in mapped_vals.values()] line_vals = [(0, 0, vals) for vals in mapped_vals.values()]
# Create wizard an generate rmas # Create wizard an generate rmas
location_id = order_obj.browse(order_id).warehouse_id.rma_loc_id.id order = order_obj.browse(order_id).sudo()
location_id = order.warehouse_id.rma_loc_id.id
wizard = wizard_obj.with_context(active_id=order_id).create({ wizard = wizard_obj.with_context(active_id=order_id).create({
'line_ids': line_vals, 'line_ids': line_vals,
'location_id': location_id 'location_id': location_id
}) })
rma = wizard.create_rma(from_portal=True) rma = wizard.sudo().create_rma(from_portal=True)
for rec in rma: for rec in rma:
rec.origin += _(' (Portal)') rec.origin += _(' (Portal)')
if len(rma) == 0: if len(rma) == 0:

View File

@@ -18,19 +18,19 @@ msgstr ""
"X-Generator: Poedit 2.0.6\n" "X-Generator: Poedit 2.0.6\n"
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/controllers/sale_portal.py:35 #: code:addons/rma_sale/controllers/sale_portal.py:36
#, python-format #, python-format
msgid " (Portal)" msgid " (Portal)"
msgstr "" msgstr ""
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:48 #: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:45
#, python-format #, python-format
msgid " has been created." msgid " has been created."
msgstr " ha sido creado." msgstr " ha sido creado."
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:50 #: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:47
#, python-format #, python-format
msgid " have been created." msgid " have been created."
msgstr " han sido creados." msgstr " han sido creados."
@@ -116,7 +116,6 @@ msgstr ""
#: model:ir.model.fields,field_description:rma_sale.field_rma__allowed_picking_ids #: model:ir.model.fields,field_description:rma_sale.field_rma__allowed_picking_ids
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__allowed_picking_ids #: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__allowed_picking_ids
#, fuzzy #, fuzzy
#| msgid "Picking"
msgid "Allowed Picking" msgid "Allowed Picking"
msgstr "Dominio de órdenes de entrega" msgstr "Dominio de órdenes de entrega"
@@ -124,7 +123,6 @@ msgstr "Dominio de órdenes de entrega"
#: model:ir.model.fields,field_description:rma_sale.field_rma__allowed_product_ids #: model:ir.model.fields,field_description:rma_sale.field_rma__allowed_product_ids
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__allowed_product_ids #: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__allowed_product_ids
#, fuzzy #, fuzzy
#| msgid "Product"
msgid "Allowed Product" msgid "Allowed Product"
msgstr "Producto" msgstr "Producto"

View File

@@ -17,19 +17,19 @@ msgstr ""
"X-Generator: Weblate 3.10\n" "X-Generator: Weblate 3.10\n"
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/controllers/sale_portal.py:35 #: code:addons/rma_sale/controllers/sale_portal.py:36
#, python-format #, python-format
msgid " (Portal)" msgid " (Portal)"
msgstr " (Portal)" msgstr " (Portal)"
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:48 #: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:45
#, python-format #, python-format
msgid " has been created." msgid " has been created."
msgstr " foi criado(a)." msgstr " foi criado(a)."
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:50 #: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:47
#, python-format #, python-format
msgid " have been created." msgid " have been created."
msgstr " foi criado(a)." msgstr " foi criado(a)."
@@ -56,15 +56,19 @@ msgstr "<i class=\"fa fa-times\"/> Cancelar"
#. module: rma_sale #. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content #: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid "<span class=\"fa fa-reply\" role=\"img\" aria-label=\"RMA\" title=\"RMA\"/>" msgid ""
"<span class=\"fa fa-reply\" role=\"img\" aria-label=\"RMA\" title=\"RMA\"/>"
msgstr "" msgstr ""
"<span class=\"fa fa-reply\" role=\"img\" aria-label=\"RMA\" title=\"RMA\"/>" "<span class=\"fa fa-reply\" role=\"img\" aria-label=\"RMA\" title=\"RMA\"/>"
#. module: rma_sale #. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template #: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "<span>\n" msgid ""
" If an RMA has already been created for a product in this sales order, it will not\n" "<span>\n"
" be possible to create another one from the web portal.\n" " If an RMA has already been created for a "
"product in this sales order, it will not\n"
" be possible to create another one from the "
"web portal.\n"
" </span>" " </span>"
msgstr "" msgstr ""
"<span>\n" "<span>\n"
@@ -138,7 +142,9 @@ msgstr "Encerrar"
#. module: rma_sale #. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id #: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid "Conversion between Units of Measure can only occur if they belong to the same category. The conversion will be made based on the ratios." msgid ""
"Conversion between Units of Measure can only occur if they belong to the "
"same category. The conversion will be made based on the ratios."
msgstr "" msgstr ""
"Uma conversão entre unidades de medida só poderá ocorrer se pertencer à " "Uma conversão entre unidades de medida só poderá ocorrer se pertencer à "
"mesma categoria. A conversão será feita com base nas proporções." "mesma categoria. A conversão será feita com base nas proporções."

View File

@@ -14,19 +14,19 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/controllers/sale_portal.py:35 #: code:addons/rma_sale/controllers/sale_portal.py:36
#, python-format #, python-format
msgid " (Portal)" msgid " (Portal)"
msgstr "" msgstr ""
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:48 #: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:45
#, python-format #, python-format
msgid " has been created." msgid " has been created."
msgstr "" msgstr ""
#. module: rma_sale #. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:50 #: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:47
#, python-format #, python-format
msgid " have been created." msgid " have been created."
msgstr "" msgstr ""

View File

@@ -4,6 +4,7 @@
<field name="name">sale.order.form.inherit</field> <field name="name">sale.order.form.inherit</field>
<field name="model">sale.order</field> <field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/> <field name="inherit_id" ref="sale.view_order_form"/>
<field name="groups_id" eval="[(4, ref('rma.rma_group_user_own'))]"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<button name="action_done" position="after"> <button name="action_done" position="after">
<button name="action_create_rma" <button name="action_create_rma"

View File

@@ -29,9 +29,6 @@ class SaleOrderRmaWizard(models.TransientModel):
default=lambda r: r.order_id.warehouse_id.rma_loc_id.id, default=lambda r: r.order_id.warehouse_id.rma_loc_id.id,
) )
def create_rma_from_portal(self):
self.ensure_one()
def create_rma(self, from_portal=None): def create_rma(self, from_portal=None):
self.ensure_one() self.ensure_one()
lines = self.line_ids.filtered(lambda r: r.quantity > 0.0) lines = self.line_ids.filtered(lambda r: r.quantity > 0.0)