Skip to content

Commit

Permalink
[UPD] ssi_rma
Browse files Browse the repository at this point in the history
* Menambahkan smart button reception
* Menambahkan smart button delivery
  • Loading branch information
andhit-r committed Nov 25, 2024
1 parent bd9ed14 commit aaaea6e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ssi_rma/models/rma_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,16 @@ def onchange_route_template_id(self):
if self.operation_id:
self.route_template_id = self.operation_id.default_route_template_id.id

def action_open_reception(self):
for record in self.sudo():
result = record._open_reception()
return result

def action_open_delivery(self):
for record in self.sudo():
result = record._open_delivery()
return result

def action_create_reception(self):
for record in self.sudo():
record._create_reception()
Expand Down Expand Up @@ -479,6 +489,36 @@ def _unlink_source_picking(self):
)
self.line_ids.unlink()

def _open_reception(self):
self.ensure_one()
rma_customer_in = self.env.ref("ssi_rma.picking_category_cri")
pickings = self.stock_picking_ids.filtered(
lambda r: r.picking_type_category_id.id == rma_customer_in.id
)
waction = self.env.ref("ssi_rma.customer_rma_in_action").read()[0]
waction.update(
{
"view_mode": "tree,form",
"domain": [("id", "in", pickings.ids)],
}
)
return waction

def _open_delivery(self):
self.ensure_one()
rma_customer_out = self.env.ref("ssi_rma.picking_category_cro")
pickings = self.stock_picking_ids.filtered(
lambda r: r.picking_type_category_id.id == rma_customer_out.id
)
waction = self.env.ref("ssi_rma.customer_rma_out_action").read()[0]
waction.update(
{
"view_mode": "tree,form",
"domain": [("id", "in", pickings.ids)],
}
)
return waction

@ssi_decorator.post_open_action()
def _create_procurement_group(self):
self.ensure_one()
Expand Down
22 changes: 22 additions & 0 deletions ssi_rma/views/rma_mixin_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,28 @@
/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button
name="action_open_reception"
class="oe_stat_button"
type="object"
icon="fa-sign-in"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Reception</span>
</div>
</button>
<button
name="action_open_delivery"
class="oe_stat_button"
type="object"
icon="fa-sign-out"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Delivery</span>
</div>
</button>
</xpath>
<xpath expr="//field[@name='user_id']" position="after">
<field name="type" invisible="1" />
<field name="operation_id" />
Expand Down

0 comments on commit aaaea6e

Please sign in to comment.