From a695077283db234296e79c392638211dfb7fc263 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 10 Feb 2023 14:21:51 +0700 Subject: only accounting can create bill from purchase order --- indoteknik_custom/models/purchase_order.py | 6 ++++++ indoteknik_custom/views/sale_order.xml | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 2f3d2ec4..0ef6a9f2 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -38,6 +38,12 @@ class PurchaseOrder(models.Model): summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty') count_line_product = fields.Float('Total Item', compute='compute_count_line_product') + def action_create_invoice(self): + res = super(PurchaseOrder, self).action_create_invoice() + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa membuat Bill') + return res + def calculate_line_no(self): line_no = 0 for line in self.order_line: diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 59c46e5f..1b6f31aa 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -7,6 +7,10 @@