[IMP] rma, rma_sale: added select all, messages for UX

This commit is contained in:
Christopher Ormaza
2022-01-28 11:23:47 -05:00
committed by Lois Rilo
parent 56d4025d03
commit 844db3b93c
4 changed files with 84 additions and 22 deletions

View File

@@ -58,6 +58,22 @@ class RmaAddStockMove(models.TransientModel):
comodel_name="stock.production.lot", string="Lots/Serials selected"
)
def select_all(self):
self.ensure_one()
self.write(
{
"lot_ids": [(6, 0, self.lot_domain_ids.ids)],
}
)
return {
"type": "ir.actions.act_window",
"name": _("Add from Stock Move"),
"view_mode": "form",
"res_model": self._name,
"res_id": self.id,
"target": "new",
}
def _prepare_rma_line_from_stock_move(self, sm, lot=False):
if self.env.context.get("customer"):
operation = (

View File

@@ -42,18 +42,33 @@
</field>
<field name="show_lot_filter" invisible="1" />
<field name="lot_domain_ids" widget="many2many_tags" invisible="1" />
<div
class="oe_grey"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
>
The creation of the RMA Lines will be separated according to the lots or serials selected
</div>
<div class="o_row">
<label
for="lot_ids"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
string="Create rma with lot/serials selected"
string="Selected Lot/Serial Numbers"
/>
<field
name="lot_ids"
widget="many2many_tags"
domain="[('id', 'in', lot_domain_ids)]"
attrs="{'invisible': [('show_lot_filter', '=', False)], 'required': [('show_lot_filter', '=', True)]}"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
options="{'no_create': True}"
/>
<button
name="select_all"
type="object"
string="Select all"
class="oe_inline"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
/>
</div>
<footer>
<button
string="Confirm"

View File

@@ -68,6 +68,22 @@ class RmaAddSale(models.TransientModel):
comodel_name="stock.production.lot", string="Lots/Serials selected"
)
def select_all(self):
self.ensure_one()
self.write(
{
"lot_ids": [(6, 0, self.lot_domain_ids.ids)],
}
)
return {
"type": "ir.actions.act_window",
"name": _("Add Sale Order"),
"view_mode": "form",
"res_model": self._name,
"res_id": self.id,
"target": "new",
}
def _prepare_rma_line_from_sale_order_line(self, line, lot=None):
operation = line.product_id.rma_customer_operation_id
if not operation:

View File

@@ -48,18 +48,33 @@
</field>
<field name="show_lot_filter" invisible="1" />
<field name="lot_domain_ids" widget="many2many_tags" invisible="1" />
<div
class="oe_grey"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
>
The creation of the RMA Lines will be separated according to the lots or serials selected
</div>
<div class="o_row">
<label
for="lot_ids"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
string="Create rma with lot/serials selected"
string="Selected Lot/Serial Numbers"
/>
<field
name="lot_ids"
widget="many2many_tags"
domain="[('id', 'in', lot_domain_ids)]"
attrs="{'invisible': [('show_lot_filter', '=', False)], 'required': [('show_lot_filter', '=', True)]}"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
options="{'no_create': True}"
/>
<button
name="select_all"
type="object"
string="Select all"
class="oe_inline"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
/>
</div>
<footer>
<button
string="Confirm"