From fb47308449ab7958c695be9df643f25c7684b8b1 Mon Sep 17 00:00:00 2001 From: Andhitia Rama Date: Tue, 16 Jul 2024 10:59:55 +0700 Subject: [PATCH] [UPD] ssi_stock_account * Menambahkan tombol pada stock.picking form untuk membuka SVL --- ssi_stock_account/models/stock_picking.py | 18 +++++++++++++++++- .../views/stock_picking_views.xml | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ssi_stock_account/models/stock_picking.py b/ssi_stock_account/models/stock_picking.py index 399195c..99ff58e 100644 --- a/ssi_stock_account/models/stock_picking.py +++ b/ssi_stock_account/models/stock_picking.py @@ -75,9 +75,25 @@ def action_delete_accounting_entry(self): record._delete_accounting_entry() def action_reload_accounting_setting(self): - for record in self: + for record in self.sudo(): record._reload_accounting_setting() + def action_open_svl(self): + for record in self.sudo(): + result = record._open_svl() + return result + + def _open_svl(self): + waction = self.env.ref("stock_account.stock_valuation_layer_action").read()[0] + waction.update( + { + "view_mode": "tree,form", + "domain": [("id", "in", self.stock_valuation_layer_ids.ids)], + "context": {}, + } + ) + return waction + def _create_accounting_entry(self): self.ensure_one() for svl in self.stock_valuation_layer_ids: diff --git a/ssi_stock_account/views/stock_picking_views.xml b/ssi_stock_account/views/stock_picking_views.xml index 71c8b06..8e16a99 100644 --- a/ssi_stock_account/views/stock_picking_views.xml +++ b/ssi_stock_account/views/stock_picking_views.xml @@ -17,6 +17,14 @@ +