diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-06-12 16:18:32 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-06-12 16:18:32 +0700 |
| commit | 6616f73259c9e146449af3f2579263b42270bf8b (patch) | |
| tree | 0dfebb75f458c738f63593313b0e19e917e85860 /indoteknik_custom/models/purchase_order.py | |
| parent | b6f63fcf96355bc11f9843a9f661cea0a458475e (diff) | |
Revert "<hafid> commit"
This reverts commit 95cef4d4d3936f8a612dadf00e83f9cddcccc0dc, reversing
changes made to 626e93d3a0bfad2bc87002d9e0a7ae860ea9baba.
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 004a1fa4..21ca55eb 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -65,7 +65,7 @@ class PurchaseOrder(models.Model): sale_order = fields.Char(string='Sale Order') matches_so = fields.Many2many('sale.order', string='Matches SO', compute='_compute_matches_so') is_create_uangmuka = fields.Boolean(string='Uang Muka?') - move_id = fields.Many2one('account.move', string='Journal Entries Uang Muka', domain=[('move_type', '=', 'entry')]) + move_id = fields.Many2one('account.move', string='Account Move') logbook_bill_id = fields.Many2one('report.logbook.bill', string='Logbook Bill') status_printed = fields.Selection([ ('not_printed', 'Belum Print'), @@ -89,28 +89,6 @@ class PurchaseOrder(models.Model): store_name = fields.Char(string='Nama Toko') purchase_order_count = fields.Integer('Purchase Order Count', related='partner_id.purchase_order_count') - is_cab_visible = fields.Boolean(string='Tampilkan Tombol CAB', compute='_compute_is_cab_visible') - - @api.depends('move_id.state') - def _compute_is_cab_visible(self): - for order in self: - move = order.move_id - order.is_cab_visible = bool(move and move.state == 'posted') - - def action_view_journal_uangmuka(self): - self.ensure_one() - if not self.move_id: - raise UserError("Journal Uang Muka belum tersedia.") - - return { - 'type': 'ir.actions.act_window', - 'name': 'Journal Entry', - 'res_model': 'account.move', - 'res_id': self.move_id.id, - 'view_mode': 'form', - 'target': 'current', - } - # cek payment term def _check_payment_term(self): _logger.info("Check Payment Term Terpanggil") @@ -838,7 +816,7 @@ class PurchaseOrder(models.Model): for line in self.order_line: if not line.so_line_id: continue - if line.so_line_id.vendor_id.id != vendor_po: + if line.so_line_id.vendor_id.id != vendor_po and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): self.env.user.notify_danger( title='WARNING!!!', message="Produk "+line.product_id.name+" memiliki vendor berbeda dengan SO (Vendor PO: "+str(self.partner_id.name)+", Vendor SO: "+str(line.so_line_id.vendor_id.name)+")", @@ -856,7 +834,7 @@ class PurchaseOrder(models.Model): if self.amount_untaxed >= 50000000 and not self.env.user.id == 21: raise UserError("Hanya Rafly Hanggara yang bisa approve") - if self.total_percent_margin < self.total_so_percent_margin: + if self.total_percent_margin < self.total_so_percent_margin and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser') and not self.env.user.is_leader: self.env.user.notify_danger( title='WARNING!!!', message='Beda Margin dengan Sale Order', @@ -1024,7 +1002,7 @@ class PurchaseOrder(models.Model): self.approval_status_unlock = 'approvedFinance' else: raise UserError("Bisa langsung Confirm, menunggu persetujuan Finance jika ingin unlock PO") - elif self.env.user.is_leader or self.env.user.has_group('indoteknik_custom.group_role_purchasing'): + elif self.env.user.is_leader or self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): raise UserError("Bisa langsung Confirm") elif self.total_percent_margin == self.total_so_percent_margin and self.matches_so and not greater_than_plafon and not different_vendor_message: raise UserError("Bisa langsung Confirm") |
