[IMP] *rma*: Avoid RMAs of kits until rma_mrp is installed

This commit is contained in:
Ernesto Tejeda
2020-12-12 10:18:13 -05:00
parent 3d6203d3f3
commit b251dd480d
2 changed files with 16 additions and 9 deletions

View File

@@ -67,7 +67,7 @@
</thead> </thead>
<tbody class="request-rma-tbody"> <tbody class="request-rma-tbody">
<t t-foreach="data_list" t-as="data"> <t t-foreach="data_list" t-as="data">
<t t-if="data['quantity'] > 0"> <t t-if="data['quantity'] > 0 and data['picking']">
<tr> <tr>
<td class="text-left"> <td class="text-left">
<span t-esc="data['product'].display_name"/> <span t-esc="data['product'].display_name"/>
@@ -92,12 +92,10 @@
</div> </div>
</td> </td>
<td class="text-left"> <td class="text-left">
<t t-if="data['picking']"> <span t-esc="data['picking'].name"/>
<span t-esc="data['picking'].name"/> <input type="hidden"
<input type="hidden" t-attf-name="#{data_index}-picking_id"
t-attf-name="#{data_index}-picking_id" t-att-value="data['picking'].id"/>
t-att-value="data['picking'].id"/>
</t>
</td> </td>
<td class="text-left"> <td class="text-left">
<select t-attf-name="#{data_index}-operation_id" <select t-attf-name="#{data_index}-operation_id"

View File

@@ -26,10 +26,19 @@ class WebsiteRMA(http.Controller):
"""Domain used for the products to be shown in selection of """Domain used for the products to be shown in selection of
the web form. the web form.
""" """
return [ domain = [
('name', '=ilike', "%{}%".format(q or '')), ("name", "=ilike", "%{}%".format(q or "")),
("sale_ok", "=", True), ("sale_ok", "=", True),
] ]
# HACK: As there is no glue module for this purpose we have put
# this this condition to check that the mrp module is installed.
if "bom_ids" in request.env["product.product"]._fields:
domain += [
"|",
("bom_ids.type", "!=", "phantom"),
("bom_ids", "=", False),
]
return domain
@http.route(['/requestrma'], type='http', auth="user", website=True) @http.route(['/requestrma'], type='http', auth="user", website=True)
def request_rma(self, **kw): def request_rma(self, **kw):