From bf6db57611262036be96e2f7cc93e315b208f174 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 25 Oct 2024 14:00:02 +0700 Subject: bills pelunasan --- indoteknik_custom/models/purchase_order.py | 70 ++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index f924174a..c24bdbb3 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -68,6 +68,7 @@ class PurchaseOrder(models.Model): ], string='Printed?', copy=False, tracking=True) date_done_picking = fields.Datetime(string='Date Done Picking', compute='get_date_done') bills_dp_id = fields.Many2one('account.move', string='Bills DP') + bills_pelunasan_id = fields.Many2one('account.move', string='Bills Pelunasan') grand_total = fields.Monetary(string='Grand Total', help='Amount total + amount delivery', compute='_compute_grand_total') total_margin_match = fields.Float(string='Total Margin Match', compute='_compute_total_margin_match') approve_by = fields.Many2one('res.users', string='Approve By') @@ -89,6 +90,75 @@ class PurchaseOrder(models.Model): else: order.grand_total = order.amount_total + def create_bill_pelunasan(self): + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa bikin bill dp') + + # Check for existing vendor bills with the same reference and partner + existing_bill = self.env['account.move'].search([ + ('ref', '=', self.name), + ('partner_id', '=', self.partner_id.id), + ('move_type', '=', 'in_invoice'), + ('state', 'not in', ['cancel', 'posted']) + ], limit=1) + + if existing_bill: + raise UserError(_('Duplicated vendor reference detected. You probably encoded twice the same vendor bill/credit note: %s') % existing_bill.name) + + current_date = datetime.utcnow() + data_bills = { + 'partner_id': self.partner_id.id, + 'partner_shipping_id': self.partner_id.id, + 'ref': self.name, + 'invoice_date': current_date, + 'date': current_date, + 'move_type': 'in_invoice' + } + + bills = self.env['account.move'].create([data_bills]) + + product_dp = self.env['product.product'].browse(229625) + + data_line_bills = [] + + data_line_bills.append({ + 'move_id': bills.id, + 'product_id': product_dp.id, # product down payment + 'name': '[IT.121456] Down Payment', # product down payment + 'account_id': 401, # Uang Muka persediaan barang dagang + 'quantity': -1, + 'product_uom_id': 1, + 'tax_ids': [(5, 0, 0)] + [(4, tax.id) for tax in product_dp.taxes_id], + }) + + for line in self.order_line: + if line.product_id: + data_line_bills.append({ + 'move_id': bills.id, + 'product_id': line.product_id.id, + 'name': self.name + ": " + line.product_id.display_name, + 'account_id': 439, # Uang Muka persediaan barang dagang + 'quantity': line.product_qty, + 'price_unit': line.price_unit, + 'product_uom_id': line.product_uom.id, + 'tax_ids': [(5, 0, 0)] + [(4, tax.id) for tax in line.taxes_id], + }) + + bills_line = self.env['account.move.line'].create(data_line_bills) + + self.bills_pelunasan_id = bills.id + + return { + 'name': _('Account Move'), + 'view_mode': 'tree,form', + 'res_model': 'account.move', + 'target': 'current', + 'type': 'ir.actions.act_window', + 'domain': [('id', '=', bills.id)] + } + + + def create_bill_dp(self): if not self.env.user.is_accounting: raise UserError('Hanya Accounting yang bisa bikin bill dp') -- cgit v1.2.3 From 9206adc3ce8f5011b4b2e42c25a310419c1947d5 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 30 Oct 2024 16:10:56 +0700 Subject: cr bill pelunasan --- indoteknik_custom/models/purchase_order.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index c24bdbb3..393fc562 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -121,11 +121,23 @@ class PurchaseOrder(models.Model): data_line_bills = [] + move_line = self.env['account.move.line'].search([ + ('move_id', '=', self.bills_dp_id.id), + ('product_id', '=', product_dp.id), + ]) + + bills.message_post( + body=f"
" + f"DP :
{move_line.price_unit}
", + subtype_id=self.env.ref("mail.mt_note").id + ) + data_line_bills.append({ 'move_id': bills.id, 'product_id': product_dp.id, # product down payment 'name': '[IT.121456] Down Payment', # product down payment 'account_id': 401, # Uang Muka persediaan barang dagang + # 'price_unit': move_line.price_unit, 'quantity': -1, 'product_uom_id': 1, 'tax_ids': [(5, 0, 0)] + [(4, tax.id) for tax in product_dp.taxes_id], @@ -139,9 +151,11 @@ class PurchaseOrder(models.Model): 'name': self.name + ": " + line.product_id.display_name, 'account_id': 439, # Uang Muka persediaan barang dagang 'quantity': line.product_qty, - 'price_unit': line.price_unit, + # 'price_unit': line.price_subtotal, 'product_uom_id': line.product_uom.id, 'tax_ids': [(5, 0, 0)] + [(4, tax.id) for tax in line.taxes_id], + 'purchase_line_id': line.id, + 'purchase_order_id': line[0].order_id.id, }) bills_line = self.env['account.move.line'].create(data_line_bills) -- cgit v1.2.3 From 7afd1ef51e18f9dcb1c0e71ea1e512b52284d3d1 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 5 Nov 2024 11:09:46 +0700 Subject: add sticky note while ask approval --- indoteknik_custom/models/purchase_order.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 393fc562..6fc0c497 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -730,7 +730,20 @@ class PurchaseOrder(models.Model): elif self.total_percent_margin == self.total_so_percent_margin and self.sale_order_id: raise UserError("Bisa langsung Confirm") else: + reason = '' self.approval_status = 'pengajuan1' + if self.amount_untaxed >= 50000000: + reason = 'above 50jt, ' + if self.total_percent_margin < self.total_so_percent_margin: + reason += 'diff margin, ' + if not self.from_apo and not self.sale_order_id: + reason += 'not link with sales, ' + # Post a highlighted message to lognote + self.message_post( + body=f"
" + f"Note Return (Pinned):
{reason}
", + subtype_id=self.env.ref("mail.mt_note").id + ) def re_calculate(self): if self.from_apo: -- cgit v1.2.3 From 8b54606ef925ff2e6feb2794aabaafa4864e6961 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 6 Nov 2024 17:00:48 +0700 Subject: initial commit max plafon qty order --- indoteknik_custom/models/purchase_order.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 6fc0c497..510695a6 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -583,6 +583,14 @@ class PurchaseOrder(models.Model): picking.scheduled_date = self.date_planned picking.date_deadline = self.date_planned + def _check_qty_plafon_product(self): + for line in self.order_line: + if not line.product_id: + continue + test = line.product_id.plafon_qty + if line.product_uom_qty > line.product_id.plafon_qty: + raise UserError('Product '+line.product_id.name+' melebihi plafon') + def button_confirm(self): res = super(PurchaseOrder, self).button_confirm() current_time = datetime.now() @@ -635,7 +643,8 @@ class PurchaseOrder(models.Model): self.date_planned = delta_time self.date_deadline_ref_date_planned() self.unlink_purchasing_job_state() - + + self._check_qty_plafon_product() return res -- cgit v1.2.3 From f787f06a341f1775151d98be4490fe6126c511cd Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 7 Nov 2024 15:59:57 +0700 Subject: excelude incoming --- indoteknik_custom/models/purchase_order.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 510695a6..231acb4c 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -72,6 +72,8 @@ class PurchaseOrder(models.Model): grand_total = fields.Monetary(string='Grand Total', help='Amount total + amount delivery', compute='_compute_grand_total') total_margin_match = fields.Float(string='Total Margin Match', compute='_compute_total_margin_match') approve_by = fields.Many2one('res.users', string='Approve By') + exclude_incoming = fields.Boolean(string='Exclude Incoming', default=False, + help='Centang jika tidak mau masuk perhitungan Incoming Qty') def _compute_total_margin_match(self): for purchase in self: -- cgit v1.2.3 From 9c54bae83c5fc50d2ca894a7e75d9beb156d3e9c Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 7 Nov 2024 16:13:00 +0700 Subject: must link with matches so if want to skip approval --- indoteknik_custom/models/purchase_order.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 6fc0c497..ef86bc61 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -595,7 +595,7 @@ class PurchaseOrder(models.Model): 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: raise UserError("Beda Margin dengan Sales, harus approval Merchandise") if not self.from_apo: - if not self.sale_order_id and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser') and not self.env.user.is_leader: + if not self.matches_so and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser') and not self.env.user.is_leader: raise UserError("Tidak ada link dengan SO, harus approval Merchandise") send_email = False @@ -727,7 +727,7 @@ class PurchaseOrder(models.Model): raise UserError("Hanya Merchandiser yang bisa approve") if 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.sale_order_id: + elif self.total_percent_margin == self.total_so_percent_margin and self.matches_so: raise UserError("Bisa langsung Confirm") else: reason = '' @@ -736,12 +736,14 @@ class PurchaseOrder(models.Model): reason = 'above 50jt, ' if self.total_percent_margin < self.total_so_percent_margin: reason += 'diff margin, ' - if not self.from_apo and not self.sale_order_id: - reason += 'not link with sales, ' + if not self.from_apo and not self.matches_so: + reason += 'not link with pj and reorder, ' + if not self.matches_so: + reason += 'not link with so, ' # Post a highlighted message to lognote self.message_post( body=f"
" - f"Note Return (Pinned):
{reason}
", + f"Note (Pinned):
{reason}", subtype_id=self.env.ref("mail.mt_note").id ) -- cgit v1.2.3 From 98c75272a5ee571de134b8e5746a026f1654ed80 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 11 Nov 2024 15:51:51 +0700 Subject: add message while check plafon qty --- indoteknik_custom/models/purchase_order.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index f5b5979b..a8fd68e9 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -589,9 +589,8 @@ class PurchaseOrder(models.Model): for line in self.order_line: if not line.product_id: continue - test = line.product_id.plafon_qty if line.product_uom_qty > line.product_id.plafon_qty: - raise UserError('Product '+line.product_id.name+' melebihi plafon') + raise UserError('Product '+line.product_id.name+' melebihi plafon, harus Approval MD') def button_confirm(self): res = super(PurchaseOrder, self).button_confirm() @@ -751,6 +750,10 @@ class PurchaseOrder(models.Model): reason += 'not link with pj and reorder, ' if not self.matches_so: reason += 'not link with so, ' + # Check Plafon Qty and Get Message every Line Product + greater_than_plafon, message = self._get_msg_plafon_qty() + if greater_than_plafon: + reason += message # Post a highlighted message to lognote self.message_post( body=f"
" @@ -758,6 +761,20 @@ class PurchaseOrder(models.Model): subtype_id=self.env.ref("mail.mt_note").id ) + def _get_msg_plafon_qty(self): + message = '' + greater_than_plafon = False + for line in self.order_line: + if not line.product_id: + continue + if line.product_uom_qty > line.product_id.plafon_qty: + message = (message + line.product_id.default_code + 'melebihi plafon ' + + str(line.product_uom_qty) + ' vs ' + str(line.product_id.plafon_qty) + + ', ') + greater_than_plafon = True + print(1) + return greater_than_plafon, message + def re_calculate(self): if self.from_apo: self.re_calculate_from_apo() -- cgit v1.2.3 From 45811de91c682cea9ade1e975f241a651c68b1df Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 12 Nov 2024 10:53:04 +0700 Subject: after UAT plafon --- indoteknik_custom/models/purchase_order.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a8fd68e9..9faa6464 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -589,7 +589,7 @@ class PurchaseOrder(models.Model): for line in self.order_line: if not line.product_id: continue - if line.product_uom_qty > line.product_id.plafon_qty: + if line.product_uom_qty > line.product_id.plafon_qty and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): raise UserError('Product '+line.product_id.name+' melebihi plafon, harus Approval MD') def button_confirm(self): @@ -733,8 +733,8 @@ class PurchaseOrder(models.Model): template.send_mail(self.id, force_send=True) def po_approve(self): - if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): - raise UserError("Hanya Merchandiser yang bisa approve") + # if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): + # raise UserError("Hanya Merchandiser yang bisa approve") if 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: @@ -768,8 +768,8 @@ class PurchaseOrder(models.Model): if not line.product_id: continue if line.product_uom_qty > line.product_id.plafon_qty: - message = (message + line.product_id.default_code + 'melebihi plafon ' - + str(line.product_uom_qty) + ' vs ' + str(line.product_id.plafon_qty) + message = (message + '\n'+line.product_id.default_code + ' melebihi plafon (' + + str(line.product_id.plafon_qty) + ') vs Qty PO ('+str(line.product_uom_qty)+')' + ', ') greater_than_plafon = True print(1) -- cgit v1.2.3 From 9f293c1270e29db78ac8542221a4bbe6d208ea8f Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 12 Nov 2024 13:35:24 +0700 Subject: bf plafon --- indoteknik_custom/models/purchase_order.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 9faa6464..d65e1d66 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -589,7 +589,10 @@ class PurchaseOrder(models.Model): for line in self.order_line: if not line.product_id: continue - if line.product_uom_qty > line.product_id.plafon_qty and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): + # test = line.product_uom_qty + # test2 = line.product_id.plafon_qty + # test3 = test2 + line.product_uom_qty + if line.product_uom_qty > line.product_id.plafon_qty + line.product_uom_qty and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): raise UserError('Product '+line.product_id.name+' melebihi plafon, harus Approval MD') def button_confirm(self): @@ -772,7 +775,6 @@ class PurchaseOrder(models.Model): + str(line.product_id.plafon_qty) + ') vs Qty PO ('+str(line.product_uom_qty)+')' + ', ') greater_than_plafon = True - print(1) return greater_than_plafon, message def re_calculate(self): -- cgit v1.2.3 From 537e3afa70512c084516b7c11aef970252d83e58 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 12 Nov 2024 13:41:57 +0700 Subject: bf plafon in po --- indoteknik_custom/models/purchase_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index d65e1d66..3397616d 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -738,9 +738,10 @@ class PurchaseOrder(models.Model): def po_approve(self): # if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): # raise UserError("Hanya Merchandiser yang bisa approve") + greater_than_plafon, message = self._get_msg_plafon_qty() if 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: + elif self.total_percent_margin == self.total_so_percent_margin and self.matches_so and not greater_than_plafon: raise UserError("Bisa langsung Confirm") else: reason = '' @@ -754,7 +755,6 @@ class PurchaseOrder(models.Model): if not self.matches_so: reason += 'not link with so, ' # Check Plafon Qty and Get Message every Line Product - greater_than_plafon, message = self._get_msg_plafon_qty() if greater_than_plafon: reason += message # Post a highlighted message to lognote -- cgit v1.2.3 From 3f3fd6fcaa74cf3e3dd6e73d7ddb95ff537742b8 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 26 Nov 2024 13:44:33 +0700 Subject: push --- indoteknik_custom/models/purchase_order.py | 34 ++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 3397616d..26dc5102 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -595,10 +595,19 @@ class PurchaseOrder(models.Model): if line.product_uom_qty > line.product_id.plafon_qty + line.product_uom_qty and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): raise UserError('Product '+line.product_id.name+' melebihi plafon, harus Approval MD') + def check_different_vendor_so_po(self): + vendor_po = self.partner_id.id + for line in self.order_line: + if not line.so_line_id: + continue + if line.so_line_id.vendor_id.id != vendor_po: + raise UserError("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)+")") + def button_confirm(self): res = super(PurchaseOrder, self).button_confirm() current_time = datetime.now() self.check_ppn_mix() + self.check_different_vendor_so_po() # self.check_data_vendor() if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): @@ -736,12 +745,12 @@ class PurchaseOrder(models.Model): template.send_mail(self.id, force_send=True) def po_approve(self): - # if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): - # raise UserError("Hanya Merchandiser yang bisa approve") greater_than_plafon, message = self._get_msg_plafon_qty() + different_vendor_message = self.check_different_vendor_so() # Panggil fungsi check_different_vendor_so + if 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: + 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") else: reason = '' @@ -757,13 +766,30 @@ class PurchaseOrder(models.Model): # Check Plafon Qty and Get Message every Line Product if greater_than_plafon: reason += message + # Check for Different Vendor Message + if different_vendor_message: + reason += different_vendor_message + # Post a highlighted message to lognote self.message_post( body=f"
" - f"Note (Pinned):
{reason}
", + f"Note (Pinned):
{reason}
", subtype_id=self.env.ref("mail.mt_note").id ) + + def check_different_vendor_so(self): + vendor_po = self.partner_id.id + message = '' + for line in self.order_line: + if not line.so_line_id: + continue + if line.so_line_id.vendor_id.id != vendor_po: + product_code = line.product_id.display_name or 'Unknown' + message += (f"Produk {product_code} memiliki vendor berbeda dengan SO " + f"(Vendor PO: {self.partner_id.name}, Vendor SO: {line.so_line_id.vendor_id.name}), ") + return message if message else None + def _get_msg_plafon_qty(self): message = '' greater_than_plafon = False -- cgit v1.2.3 From 58bec36c52b223c12fd15511a56ab417ebbd7257 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 26 Nov 2024 16:06:50 +0700 Subject: fix bug po --- indoteknik_custom/models/purchase_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 26dc5102..9388ae4c 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -600,7 +600,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'): raise UserError("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)+")") def button_confirm(self): -- cgit v1.2.3