summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-03-19 09:55:02 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-03-19 09:55:02 +0700
commit4a7b5ebc82de37c6d2bde5e670066336256939d5 (patch)
tree320b8faa3737ee07672f8380d75b6f92e297f4ff
parenta06059e47feab3aa25c35652dfb83b8783273084 (diff)
cr reklas uang muka and permission button cancel stock picking
-rw-r--r--indoteknik_custom/models/invoice_reklas.py6
-rw-r--r--indoteknik_custom/models/stock_picking.py5
2 files changed, 10 insertions, 1 deletions
diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py
index f5bb5a25..d10d4c31 100644
--- a/indoteknik_custom/models/invoice_reklas.py
+++ b/indoteknik_custom/models/invoice_reklas.py
@@ -18,6 +18,12 @@ class InvoiceReklas(models.TransientModel):
('pembelian', 'Pembelian'),
], string='Reklas Tipe')
+ @api.onchange('reklas_type')
+ def _onchange_reklas_type(self):
+ if self.reklas_type == 'penjualan':
+ invoices = self.env['account.move'].browse(self._context.get('active_ids', []))
+ self.pay_amt = invoices.amount_total
+
def create_reklas(self):
if not self.reklas_type:
raise UserError('Reklas Tipe harus diisi')
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index ab8109c7..4229d33e 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -1008,9 +1008,12 @@ class StockPicking(models.Model):
return True
def action_cancel(self):
- if not self.env.user.is_logistic_approver and self.env.context.get('active_model') == 'stock.picking':
+ if not self.env.user.is_logistic_approver:
if self.origin and 'Return of' in self.origin:
raise UserError("Button ini hanya untuk Logistik")
+
+ if not self.env.user.has_group('indoteknik_custom.group_role_it') and not self.env.user.has_group('indoteknik_custom.group_role_logistic'):
+ raise UserError("Button ini hanya untuk Logistik")
res = super(StockPicking, self).action_cancel()
return res