From ff058e22f64cd3e2dbd69d835f68877f530820c3 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Tue, 30 Dec 2025 10:45:15 +0700 Subject: (andri) has magento + sync to mirroring to test --- indoteknik_custom/models/product_template.py | 3 ++- indoteknik_custom/models/solr/apache_solr.py | 8 +++++--- indoteknik_custom/models/solr/product_product.py | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 2eed0f0d..5730b08b 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -84,7 +84,6 @@ class ProductTemplate(models.Model): merchandise_ok = fields.Boolean(string='Product Promotion') print_barcode = fields.Boolean(string='Print Barcode', default=True) # qr_code = fields.Binary("QR Code", compute='_compute_qr_code') - # has_magento = fields.Boolean(string='Has Magento?', default=False) @api.model def create(self, vals): @@ -940,6 +939,8 @@ class ProductProduct(models.Model): qty_pcs_box = fields.Float("Pcs Box") barcode_box = fields.Char("Barcode Box") + has_magento = fields.Boolean(string='Has Magento?', default=False) + def generate_product_sla(self): product_variant_ids = self.env.context.get('active_ids', []) product_variant = self.search([('id', 'in', product_variant_ids)]) diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index c2283421..8ae98dd7 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -10,9 +10,9 @@ _logger = logging.getLogger(__name__) # _solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30) # _variants_solr = pysolr.Solr('http://10.148.0.5:8983/solr/variants/', always_commit=True, timeout=30) # _recommendation_solr = pysolr.Solr('http://10.148.0.5:8983/solr/recommendation/', always_commit=True, timeout=30) -_solr = pysolr.Solr('http://localhost:8983/solr/product/', always_commit=True, timeout=30) -_variants_solr = pysolr.Solr('http://localhost:8983/solr/variants/', always_commit=True, timeout=30) -_recommendation_solr = pysolr.Solr('http://localhost:8983/solr/recommendation/', always_commit=True, timeout=30) +_solr = pysolr.Solr('http://35.219.88.139/solr/product/', always_commit=True, timeout=30) +_variants_solr = pysolr.Solr('http://35.219.88.139/solr/variants/', always_commit=True, timeout=30) +_recommendation_solr = pysolr.Solr('http://35.219.88.139/solr/recommendation/', always_commit=True, timeout=30) # _solr = pysolr.Solr('http://34.101.189.218:8983/solr/product/', always_commit=True, timeout=30) # for development only @@ -258,6 +258,7 @@ class ApacheSolr(models.Model): 'id': variant.id, 'display_name_s': variant.display_name, 'name_s': variant.name, + 'search_keywords_t': variant.display_name, 'default_code_s': variant.default_code or '', 'product_rating_f': variant.product_tmpl_id.virtual_rating, 'product_id_i': variant.id, @@ -269,6 +270,7 @@ class ApacheSolr(models.Model): 'tax_f': tax, 'stock_total_f': variant.qty_stock_vendor, 'weight_f': variant.product_tmpl_id.weight, + 'has_magento_b': variant.has_magento, 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index 7df56e57..a90bcb98 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -64,6 +64,7 @@ class ProductProduct(models.Model): 'id': variant.id, 'display_name_s': variant.display_name, 'name_s': variant.name, + 'search_keywords_t': variant.display_name, 'default_code_s': variant.default_code or '', 'product_rating_f': variant.product_tmpl_id.virtual_rating, 'product_id_i': variant.id, @@ -73,6 +74,7 @@ class ProductProduct(models.Model): 'image_mobile_s': ir_attachment.api_image('product.template', 'image_256', variant.product_tmpl_id.id), 'stock_total_f': variant.qty_free_bandengan, 'weight_f': variant.weight, + 'has_magento_b': variant.has_magento, 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, -- cgit v1.2.3 From 7b0a84a6e834fc20784812536e17adb5f7817cc4 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Mon, 5 Jan 2026 18:48:14 +0700 Subject: copy date maturity to date now --- indoteknik_custom/models/account_move.py | 84 ++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 31 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 37808f94..e1360cfa 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -49,7 +49,7 @@ class AccountMove(models.Model): states={'draft': [('readonly', False)], 'sent': [('readonly', False)], 'sale': [('readonly', False)]}, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", help="Dipakai untuk alamat tempel") - + address_invoice = fields.Char(related='real_invoice_id.street', string='Invoice Address', readonly=True) bills_efaktur_exporter = fields.Many2one('res.users', string='Efaktur Exporter') bills_date_efaktur = fields.Datetime(string="eFaktur Exported Date", required=False) @@ -176,7 +176,7 @@ class AccountMove(models.Model): lambda p: move.id in p.reconciled_invoice_ids.ids ) - if payment: + if payment: move.payment_date = payment[0].date elif move.reklas_misc_id: move.payment_date = move.reklas_misc_id.date @@ -185,7 +185,7 @@ class AccountMove(models.Model): def action_sync_promise_date(self): self.ensure_one() - finance_user_ids = [688] + finance_user_ids = [688] is_it = self.env.user.has_group('indoteknik_custom.group_role_it') if self.env.user.id not in finance_user_ids and not is_it: raise UserError('Hanya Finance (Widya) yang dapat menggunakan fitur ini.') @@ -286,7 +286,7 @@ class AccountMove(models.Model): if all(inv.reminder_sent_date == today for inv in invs): _logger.info(f"Reminder untuk {partner.name} sudah terkirim hari ini, skip.") continue - + promise_dates = [inv.customer_promise_date for inv in invs if inv.customer_promise_date] if promise_dates: earliest_promise = min(promise_dates) # ambil janji paling awal @@ -300,11 +300,11 @@ class AccountMove(models.Model): # skip semua jika partner centang dont_send_reminder_inv_all if partner.dont_send_reminder_inv_all: _logger.info(f"Partner {partner.name} skip karena dont_send_reminder_inv_all aktif") - continue + continue # cek parent hanya dengan flag dont_sent_reminder_inv_parent if not partner.dont_send_reminder_inv_parent and partner.email: emails.append(partner.email) - + # Ambil child contact yang di-checklist reminder_invoices reminder_contacts = self.env['res.partner'].search([ ('parent_id', '=', partner.id), @@ -312,7 +312,7 @@ class AccountMove(models.Model): ('email', '!=', False), ]) _logger.info(f"Email Reminder Child {reminder_contacts}") - + emails += reminder_contacts.mapped('email') if reminder_contacts: _logger.info(f"Email Reminder Child {reminder_contacts}") @@ -381,7 +381,7 @@ class AccountMove(models.Model): # tempo_link = 'http://localhost:2100/my/tempo' # payment_term = partner.previous_payment_term_id if partner.is_cbd_locked else partner.property_payment_term_id payment_term = invs[0].invoice_payment_term_id - + limit_info_html = f"""

Informasi Tambahan:

    @@ -391,11 +391,11 @@ class AccountMove(models.Model): Sisa Kredit Limit: {formatLang(self.env, blocking_limit - outstanding_amount, currency_obj=currency)}
  • - Kredit Limit Terpakai: {formatLang(self.env, outstanding_amount, currency_obj=currency)} + Kredit Limit Terpakai: {formatLang(self.env, outstanding_amount, currency_obj=currency)} ({len(outstanding_invoices)} Transaksi)
  • - Jatuh Tempo: {formatLang(self.env, overdue_amount, currency_obj=currency)} + Jatuh Tempo: {formatLang(self.env, overdue_amount, currency_obj=currency)} ({len(overdue_invoices)} Invoice)
@@ -472,7 +472,7 @@ class AccountMove(models.Model): values = { 'subject': f"Reminder Invoice Due - {partner.name}", # 'email_to': 'andrifebriyadiputra@gmail.com', - 'email_to': email_to, + 'email_to': email_to, 'email_from': 'finance@indoteknik.co.id', 'email_cc': ",".join(sorted(set(cc_list))), 'body_html': body_html, @@ -528,7 +528,7 @@ class AccountMove(models.Model): # payment_term = rec.invoice_payment_term_id.line_ids[0].days # terima_faktur = rec.date_terima_tukar_faktur # payment = self.search([('ref', '=', rec.name), ('move_type', '=', 'entry')], limit=1) - + # if payment and terima_faktur: # date_diff = terima_faktur - payment.date # rec.length_of_payment = date_diff.days + payment_term @@ -589,7 +589,7 @@ class AccountMove(models.Model): template = self.env.ref('indoteknik_custom.mail_template_efaktur_document') for record in records: - if record.invoice_payment_term_id.id == 26: + if record.invoice_payment_term_id.id == 26: attachment = self.generate_attachment(record) email_values = { 'attachment_ids': [(4, attachment.id)] @@ -605,7 +605,7 @@ class AccountMove(models.Model): @api.model def create(self, vals): - vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0' + vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0' result = super(AccountMove, self).create(vals) # Tambahan: jika ini Vendor Bill dan tanggal belum diisi @@ -640,13 +640,13 @@ class AccountMove(models.Model): record.flag_delivery_amt = True else: record.flag_delivery_amt = False - + def compute_delivery_amt_text(self): tb = Terbilang() for record in self: res = '' - + try: if record.sale_id.delivery_amt > 0: tb.parse(int(record.sale_id.delivery_amt)) @@ -654,7 +654,7 @@ class AccountMove(models.Model): record.delivery_amt_text = res + ' Rupiah' except: record.delivery_amt_text = res - + @api.constrains('bills_efaktur_document') def _constrains_efaktur_document(self): @@ -722,13 +722,35 @@ class AccountMove(models.Model): raise UserError('Data Hanya Bisa Di Cancel') return res + def copy(self, default=None): + default = dict(default or {}) + + today = fields.Date.context_today(self) + + if self.invoice_date_due: + default.update({ + 'invoice_date_due': today, + }) + + move = super().copy(default) + + for line in move.line_ids: + if ( + line.account_id.user_type_id.type in ('receivable', 'payable') + and line.date_maturity + ): + line.date_maturity = today + + return move + + def button_cancel(self): res = super(AccountMove, self).button_cancel() if self.move_type == 'entry': po = self.env['purchase.order'].search([ ('move_id', 'in', [self.id]) ]) - + for order in po: if order: order.is_create_uangmuka = False @@ -741,7 +763,7 @@ class AccountMove(models.Model): res = super(AccountMove, self).button_draft() if not self.env.user.is_accounting: raise UserError('Hanya Accounting yang bisa Reset to Draft') - + for rec in self.line_ids: if rec.write_date != rec.create_date: if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.statement_line_id.statement_id.state == 'confirm': @@ -751,7 +773,7 @@ class AccountMove(models.Model): def action_post(self): if self._name != 'account.move': return super(AccountMove, self).action_post() - + # validation cant qty invoice greater than qty order if self.move_type == 'out_invoice': query = ["&",("name","=",self.invoice_origin),"|",("state","=","sale"),("state","=","done")] @@ -777,7 +799,7 @@ class AccountMove(models.Model): # raise UserError('Hanya Accounting yang bisa Posting') # if self._name == 'account.move': # for entry in self: - # entry.date_completed = datetime.utcnow() + # entry.date_completed = datetime.utcnow() # for line in entry.line_ids: # line.date_maturity = entry.date @@ -787,7 +809,7 @@ class AccountMove(models.Model): if not self.env.user.is_accounting: raise UserError("Hanya Finence yang bisa ubah data") return res - + def _compute_invoice_day_to_due(self): for invoice in self: invoice_day_to_due = 0 @@ -801,7 +823,7 @@ class AccountMove(models.Model): new_invoice_day_to_due = new_invoice_day_to_due.days invoice.invoice_day_to_due = invoice_day_to_due invoice.new_invoice_day_to_due = new_invoice_day_to_due - + def _compute_bill_day_to_due(self): for rec in self: rec.bill_day_to_due = rec.payment_schedule or rec.invoice_date_due @@ -831,21 +853,21 @@ class AccountMove(models.Model): add_days += line.days due_date = tukar_date + timedelta(days=add_days) invoice.invoice_date_due = due_date - + def open_form_multi_update(self): action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_account_move_multi_update') action['context'] = { 'move_ids': [x.id for x in self] } return action - + def open_form_multi_update_bills(self): action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_account_move_multi_update_bills') action['context'] = { 'move_ids': [x.id for x in self] } return action - + @api.constrains('efaktur_id', 'ref', 'date', 'journal_id', 'name') def constrains_edit(self): for rec in self.line_ids: @@ -859,10 +881,10 @@ class AccountMove(models.Model): # if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.statement_line_id.statement_id.state == 'confirm': # raise UserError('Bank Statement di Lock, Minta admin reconcile untuk unlock') # return res - + def validate_faktur_for_export(self): - invoices = self.filtered(lambda inv: not inv.is_efaktur_exported and - inv.state == 'posted' and + invoices = self.filtered(lambda inv: not inv.is_efaktur_exported and + inv.state == 'posted' and inv.move_type == 'out_invoice') invalid_invoices = self - invoices @@ -874,10 +896,10 @@ class AccountMove(models.Model): )) return invoices - + def export_faktur_to_xml(self): valid_invoices = self - + coretax_faktur = self.env['coretax.faktur'].create({}) response = coretax_faktur.export_to_download( -- cgit v1.2.3 From 7b7e6e99fa88804a931125b500d02ac23082147c Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Wed, 7 Jan 2026 12:44:00 +0700 Subject: (andri) add cancel PUM reimburse --- .../models/advance_payment_request.py | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/advance_payment_request.py b/indoteknik_custom/models/advance_payment_request.py index f973a9da..d0805598 100644 --- a/indoteknik_custom/models/advance_payment_request.py +++ b/indoteknik_custom/models/advance_payment_request.py @@ -55,6 +55,7 @@ class AdvancePaymentRequest(models.Model): ('pengajuan2', 'Menunggu Approval AP'), ('pengajuan3', 'Menunggu Approval Pimpinan'), ('approved', 'Approved'), + ('cancel','Cancel') ], string='Status', default='draft', tracking=3, index=True, track_visibility='onchange') @@ -816,6 +817,51 @@ class AdvancePaymentRequest(models.Model): rec._compute_grand_total_reimburse() rec.nominal = rec.grand_total_reimburse return rec + + def action_open_cancel_wizard(self): + """Membuka Wizard Pop-up untuk Cancel PUM/Reimburse""" + self.ensure_one() + + if self.move_id: + raise UserError(_("Pengajuan tidak dapat dibatalkan karena Journal sudah terbentuk.")) + + if self.settlement_ids and any(s.status != 'draft' for s in self.settlement_ids): + raise UserError(_("Pengajuan tidak dapat dibatalkan karena sudah ada proses realisasi.")) + + return { + 'name': _('Alasan Pembatalan'), + 'type': 'ir.actions.act_window', + 'res_model': 'advance.payment.cancel.wizard', + 'view_mode': 'form', + 'target': 'new', + 'context': { + 'default_request_id': self.id, + } + } + +class AdvancePaymentCancelWizard(models.TransientModel): + _name = 'advance.payment.cancel.wizard' + _description = 'Wizard untuk Membatalkan PUM/Reimburse' + + request_id = fields.Many2one('advance.payment.request', string='Dokumen', readonly=True) + reason = fields.Text(string='Alasan Pembatalan', required=True) + + def action_confirm_cancel(self): + self.ensure_one() + request = self.request_id + if request.move_id: + raise UserError("Tidak bisa melakukan cancel karena Jurnal (Move ID) sudah terbentuk.") + + request.write({'status': 'cancel'}) + + request.message_post( + body=f"Pengajuan telah DIBATALKAN oleh {self.env.user.name}.
" + f"Alasan: {self.reason}", + message_type="comment", + subtype_xmlid="mail.mt_note", + ) + + return {'type': 'ir.actions.act_window_close'} class AdvancePaymentUsageLine(models.Model): -- cgit v1.2.3 From 723d1ee7685d9abaac0b5b7cd8abbe0c8b64791b Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 8 Jan 2026 16:04:35 +0700 Subject: (andri) off sementara validasi confirm PO --- indoteknik_custom/models/purchase_order.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 3d22b0f0..61d59eb9 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1079,15 +1079,15 @@ class PurchaseOrder(models.Model): ) % order.name) def button_confirm(self): - if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan - if '/PJ/' in self.name: - low_margin_lines = self.order_sales_match_line.filtered( - lambda match: match.so_header_margin <= 15.0 - ) - price_change_detected = any(line.price_unit_before for line in self.order_line) - if low_margin_lines and price_change_detected: - # raise UserError("Matches SO terdapat item dengan header margin SO <= 15%. Approval Pimpinan diperlukan.") - raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line yang Matches SO item memiliki header margin SO <= 15%") + # if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan + # if '/PJ/' in self.name: + # low_margin_lines = self.order_sales_match_line.filtered( + # lambda match: match.so_header_margin <= 15.0 + # ) + # price_change_detected = any(line.price_unit_before for line in self.order_line) + # if low_margin_lines and price_change_detected: + # # raise UserError("Matches SO terdapat item dengan header margin SO <= 15%. Approval Pimpinan diperlukan.") + # raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line yang Matches SO item memiliki header margin SO <= 15%") # else: # is_po_manual = '/A/' not in self.name and '/MO/' not in self.name # if is_po_manual: -- cgit v1.2.3 From ae961c97d736359f6611db82ee484707f581ab0f Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 8 Jan 2026 16:24:19 +0700 Subject: (andri) on & fix validasi confirm PO --- indoteknik_custom/models/purchase_order.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 61d59eb9..a114743f 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1079,15 +1079,18 @@ class PurchaseOrder(models.Model): ) % order.name) def button_confirm(self): - # if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan - # if '/PJ/' in self.name: - # low_margin_lines = self.order_sales_match_line.filtered( - # lambda match: match.so_header_margin <= 15.0 - # ) - # price_change_detected = any(line.price_unit_before for line in self.order_line) - # if low_margin_lines and price_change_detected: - # # raise UserError("Matches SO terdapat item dengan header margin SO <= 15%. Approval Pimpinan diperlukan.") - # raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line yang Matches SO item memiliki header margin SO <= 15%") + if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan + if '/PJ/' in self.name: + price_change_detected = any(line.price_unit_before for line in self.order_line) + if price_change_detected: + if self.total_percent_margin <= 15.0: + raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + else: + low_margin_match_so = self.order_sales_match_line.filtered( + lambda match: match.so_header_margin <= 15.0 + ) + if low_margin_match_so: + raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") # else: # is_po_manual = '/A/' not in self.name and '/MO/' not in self.name # if is_po_manual: -- cgit v1.2.3 From f80e95677fc8144e09830f619a08814928cf3fad Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 11:55:51 +0700 Subject: matiin validasi approval pimpinan PO --- indoteknik_custom/models/purchase_order.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a114743f..7557045f 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1079,18 +1079,18 @@ class PurchaseOrder(models.Model): ) % order.name) def button_confirm(self): - if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan - if '/PJ/' in self.name: - price_change_detected = any(line.price_unit_before for line in self.order_line) - if price_change_detected: - if self.total_percent_margin <= 15.0: - raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") - else: - low_margin_match_so = self.order_sales_match_line.filtered( - lambda match: match.so_header_margin <= 15.0 - ) - if low_margin_match_so: - raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") + # if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan + # if '/PJ/' in self.name: + # price_change_detected = any(line.price_unit_before for line in self.order_line) + # if price_change_detected: + # if self.total_percent_margin <= 15.0: + # raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + # else: + # low_margin_match_so = self.order_sales_match_line.filtered( + # lambda match: match.so_header_margin <= 15.0 + # ) + # if low_margin_match_so: + # raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") # else: # is_po_manual = '/A/' not in self.name and '/MO/' not in self.name # if is_po_manual: -- cgit v1.2.3 From b352a2c5f5899f7e8e46fbf728fb387efdda0fb7 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 12:01:05 +0700 Subject: balikin approval pimpinan PO --- indoteknik_custom/models/purchase_order.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 7557045f..a114743f 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1079,18 +1079,18 @@ class PurchaseOrder(models.Model): ) % order.name) def button_confirm(self): - # if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan - # if '/PJ/' in self.name: - # price_change_detected = any(line.price_unit_before for line in self.order_line) - # if price_change_detected: - # if self.total_percent_margin <= 15.0: - # raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") - # else: - # low_margin_match_so = self.order_sales_match_line.filtered( - # lambda match: match.so_header_margin <= 15.0 - # ) - # if low_margin_match_so: - # raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") + if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan + if '/PJ/' in self.name: + price_change_detected = any(line.price_unit_before for line in self.order_line) + if price_change_detected: + if self.total_percent_margin <= 15.0: + raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + else: + low_margin_match_so = self.order_sales_match_line.filtered( + lambda match: match.so_header_margin <= 15.0 + ) + if low_margin_match_so: + raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") # else: # is_po_manual = '/A/' not in self.name and '/MO/' not in self.name # if is_po_manual: -- cgit v1.2.3 From ba1b0ca10182a734dfa99a52270c95c73e4b8522 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Tue, 13 Jan 2026 10:01:20 +0700 Subject: add category description for website --- indoteknik_custom/models/product_public_category.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/product_public_category.py b/indoteknik_custom/models/product_public_category.py index 1039ec52..dadcb181 100755 --- a/indoteknik_custom/models/product_public_category.py +++ b/indoteknik_custom/models/product_public_category.py @@ -15,6 +15,7 @@ class ProductPublicCategory(models.Model): child_frontend_id = fields.One2many('product.public.category', 'parent_frontend_id', string='Children Frontend Categories') child_frontend_id2 = fields.Many2many('product.public.category', relation='website_categories_child_frontend_rel', column1='website_categories_homepage_id', column2='product_public_category_id', string='Category Level 3') sequence_frontend = fields.Integer(help="Gives the sequence order when displaying a list of product categories.", index=True) + short_desc = fields.Char(string='Short Description') # @api.model # def _onchange_child_frontend_id2(self, parent): -- cgit v1.2.3 From b99d9b8b770f6ae24e9de87e50b66868052d0de5 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Tue, 13 Jan 2026 15:56:45 +0700 Subject: filter brand --- indoteknik_custom/models/commision.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py index 441dd54f..983c07fe 100644 --- a/indoteknik_custom/models/commision.py +++ b/indoteknik_custom/models/commision.py @@ -489,7 +489,10 @@ class CustomerCommision(models.Model): raise UserError('Line sudah ada, tidak bisa di generate ulang') if self.commision_type == 'fee': - self._generate_customer_commision_fee() + if self.brand_ids: + self._generate_customer_commision_rebate() + else: + self._generate_customer_commision_fee() else: self._generate_customer_commision_rebate() -- cgit v1.2.3 From 4bc8f960504ac8cdfc904c159eee03c4d62be334 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Thu, 15 Jan 2026 13:22:24 +0700 Subject: Push --- indoteknik_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 2465fa96..c8f7bb5b 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1685,7 +1685,7 @@ class StockPicking(models.Model): ]) for line in po.order_sales_match_line: - if not line.bu_pick: + if not line.bu_pick and line.hold_outgoing_so: continue line.bu_pick.action_assign() -- cgit v1.2.3 From 019d86b384cd3b10d6db8b1faa8500b27bb9ac9f Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Thu, 15 Jan 2026 13:58:58 +0700 Subject: refund bug lagi --- indoteknik_custom/models/refund_sale_order.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index c22e84ab..722a125e 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -592,7 +592,9 @@ class RefundSaleOrder(models.Model): for rec in self: move_links = [] - invoice_ids = rec.sale_order_ids.mapped('invoice_ids') + invoice_ids = rec.sale_order_ids.mapped('invoice_ids').filtered( + lambda inv: inv.state == 'posted' + ) moves = self.env['account.move'].search([ ('sale_id', 'in', rec.sale_order_ids.ids), -- cgit v1.2.3 From 6c5e3f59d14efe691e581fb7524a013737215fb3 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 15 Jan 2026 14:36:40 +0700 Subject: (andri) add cancel pada status payment reimburse --- indoteknik_custom/models/advance_payment_request.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/advance_payment_request.py b/indoteknik_custom/models/advance_payment_request.py index d0805598..ed0b0809 100644 --- a/indoteknik_custom/models/advance_payment_request.py +++ b/indoteknik_custom/models/advance_payment_request.py @@ -62,6 +62,7 @@ class AdvancePaymentRequest(models.Model): status_pay_down_payment = fields.Selection([ ('pending', 'Pending'), ('payment', 'Payment'), + ('cancel','Cancel') ], string='Status Pembayaran', default='pending', tracking=3) name_approval_departement = fields.Char(string='Approval Departement') @@ -853,6 +854,7 @@ class AdvancePaymentCancelWizard(models.TransientModel): raise UserError("Tidak bisa melakukan cancel karena Jurnal (Move ID) sudah terbentuk.") request.write({'status': 'cancel'}) + request.write({'status_pay_down_payment': 'cancel'}) request.message_post( body=f"Pengajuan telah DIBATALKAN oleh {self.env.user.name}.
" -- cgit v1.2.3 From d2c33bcf58080579f3a888bfe8b0ddf12926deac Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 15 Jan 2026 15:48:15 +0700 Subject: (andri) live --- indoteknik_custom/models/solr/apache_solr.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index 8ae98dd7..dbc057c9 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -7,12 +7,12 @@ import time from odoo.tools.config import config _logger = logging.getLogger(__name__) -# _solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30) -# _variants_solr = pysolr.Solr('http://10.148.0.5:8983/solr/variants/', always_commit=True, timeout=30) -# _recommendation_solr = pysolr.Solr('http://10.148.0.5:8983/solr/recommendation/', always_commit=True, timeout=30) -_solr = pysolr.Solr('http://35.219.88.139/solr/product/', always_commit=True, timeout=30) -_variants_solr = pysolr.Solr('http://35.219.88.139/solr/variants/', always_commit=True, timeout=30) -_recommendation_solr = pysolr.Solr('http://35.219.88.139/solr/recommendation/', always_commit=True, timeout=30) +_solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30) +_variants_solr = pysolr.Solr('http://10.148.0.5:8983/solr/variants/', always_commit=True, timeout=30) +_recommendation_solr = pysolr.Solr('http://10.148.0.5:8983/solr/recommendation/', always_commit=True, timeout=30) +# _solr = pysolr.Solr('http://35.219.88.139/solr/product/', always_commit=True, timeout=30) +# _variants_solr = pysolr.Solr('http://35.219.88.139/solr/variants/', always_commit=True, timeout=30) +# _recommendation_solr = pysolr.Solr('http://35.219.88.139/solr/recommendation/', always_commit=True, timeout=30) # _solr = pysolr.Solr('http://34.101.189.218:8983/solr/product/', always_commit=True, timeout=30) # for development only -- cgit v1.2.3 From 25baecd1038b6b629e96d8b9eb9651bec95050b3 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 15 Jan 2026 15:49:53 +0700 Subject: fix --- indoteknik_custom/models/solr/apache_solr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index dbc057c9..21fb15d2 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -27,7 +27,7 @@ class ApacheSolr(models.Model): if env == 'development': url = 'http://localhost:8983/solr/' elif env == 'production': - url = 'http://locahost:8983/solr/' + url = 'http://34.101.189.218:8983/solr/' return pysolr.Solr(url + schema, always_commit=False, timeout=10) -- cgit v1.2.3 From e42aee6c9af962edad71603eaaaeceea8589dc7a Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 15 Jan 2026 16:16:04 +0700 Subject: fix invalid field --- indoteknik_custom/models/product_template.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 5730b08b..4ff2dffa 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -15,16 +15,15 @@ _logger = logging.getLogger(__name__) class ProductTemplate(models.Model): _inherit = "product.template" - x_attribute_set_id = fields.Integer( - string="Magento Attribute Set ID", - default=0, - index=True, - help="Attribute Set ID dari Magento" - ) - x_attribute_set_name = fields.Char( - string="Magento Attribute Set Name", - help="Attribute Set Name dari Magento" - ) + # x_attribute_set_id = fields.Integer( + # string="Magento Attribute Set ID", + # default=0, + # help="Attribute Set ID dari Magento" + # ) + # x_attribute_set_name = fields.Char( + # string="Magento Attribute Set Name", + # help="Attribute Set Name dari Magento" + # ) image_carousel_lines = fields.One2many( comodel_name="image.carousel", @@ -939,7 +938,7 @@ class ProductProduct(models.Model): qty_pcs_box = fields.Float("Pcs Box") barcode_box = fields.Char("Barcode Box") - has_magento = fields.Boolean(string='Has Magento?', default=False) + # has_magento = fields.Boolean(string='Has Magento?', default=False, readonly=True) def generate_product_sla(self): product_variant_ids = self.env.context.get('active_ids', []) -- cgit v1.2.3 From 662ece47fb1e2c3ad814007b9bd2930dd1261d79 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 15 Jan 2026 16:24:26 +0700 Subject: fix --- indoteknik_custom/models/solr/apache_solr.py | 6 +++--- indoteknik_custom/models/solr/product_product.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index 21fb15d2..4d6f8db2 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -270,9 +270,9 @@ class ApacheSolr(models.Model): 'tax_f': tax, 'stock_total_f': variant.qty_stock_vendor, 'weight_f': variant.product_tmpl_id.weight, - 'has_magento_b': variant.has_magento, - 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, - 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', + # 'has_magento_b': variant.has_magento, + # 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, + # 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', 'manufacture_name': variant.product_tmpl_id.x_manufacture.x_name or '', diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index a90bcb98..529aabbb 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -74,9 +74,9 @@ class ProductProduct(models.Model): 'image_mobile_s': ir_attachment.api_image('product.template', 'image_256', variant.product_tmpl_id.id), 'stock_total_f': variant.qty_free_bandengan, 'weight_f': variant.weight, - 'has_magento_b': variant.has_magento, - 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, - 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', + # 'has_magento_b': variant.has_magento, + # 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, + # 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', 'manufacture_name': variant.product_tmpl_id.x_manufacture.x_name or '', -- cgit v1.2.3 From a571ac15c0cf643542acaf7051ccc8db6976c9d6 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 15 Jan 2026 19:31:43 +0700 Subject: field has magento & attribute set --- indoteknik_custom/models/product_template.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 4ff2dffa..2c798f43 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -15,15 +15,16 @@ _logger = logging.getLogger(__name__) class ProductTemplate(models.Model): _inherit = "product.template" - # x_attribute_set_id = fields.Integer( - # string="Magento Attribute Set ID", - # default=0, - # help="Attribute Set ID dari Magento" - # ) - # x_attribute_set_name = fields.Char( - # string="Magento Attribute Set Name", - # help="Attribute Set Name dari Magento" - # ) + x_attribute_set_id = fields.Integer( + string="Magento Attribute Set ID", + help="Attribute Set ID dari Magento", + readonly=True + ) + x_attribute_set_name = fields.Char( + string="Magento Attribute Set Name", + help="Attribute Set Name dari Magento", + readonly=True + ) image_carousel_lines = fields.One2many( comodel_name="image.carousel", @@ -938,7 +939,7 @@ class ProductProduct(models.Model): qty_pcs_box = fields.Float("Pcs Box") barcode_box = fields.Char("Barcode Box") - # has_magento = fields.Boolean(string='Has Magento?', default=False, readonly=True) + has_magento = fields.Boolean(string='Has Magento?', default=False, readonly=True) def generate_product_sla(self): product_variant_ids = self.env.context.get('active_ids', []) -- cgit v1.2.3 From fe4923c5a9b6b7bff15ee47113849be57e620c15 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 15 Jan 2026 19:41:04 +0700 Subject: add field magento & attribute set to solr --- indoteknik_custom/models/solr/apache_solr.py | 6 +++--- indoteknik_custom/models/solr/product_product.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index 4d6f8db2..21fb15d2 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -270,9 +270,9 @@ class ApacheSolr(models.Model): 'tax_f': tax, 'stock_total_f': variant.qty_stock_vendor, 'weight_f': variant.product_tmpl_id.weight, - # 'has_magento_b': variant.has_magento, - # 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, - # 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', + 'has_magento_b': variant.has_magento, + 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, + 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', 'manufacture_name': variant.product_tmpl_id.x_manufacture.x_name or '', diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index 529aabbb..a90bcb98 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -74,9 +74,9 @@ class ProductProduct(models.Model): 'image_mobile_s': ir_attachment.api_image('product.template', 'image_256', variant.product_tmpl_id.id), 'stock_total_f': variant.qty_free_bandengan, 'weight_f': variant.weight, - # 'has_magento_b': variant.has_magento, - # 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, - # 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', + 'has_magento_b': variant.has_magento, + 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0, + 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '', 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', 'manufacture_name': variant.product_tmpl_id.x_manufacture.x_name or '', -- cgit v1.2.3 From a0ed09201804fd6970cdb7d0fb1f800577e4c57f Mon Sep 17 00:00:00 2001 From: Mqdd Date: Mon, 19 Jan 2026 09:48:39 +0700 Subject: balikin --- indoteknik_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index c8f7bb5b..2465fa96 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1685,7 +1685,7 @@ class StockPicking(models.Model): ]) for line in po.order_sales_match_line: - if not line.bu_pick and line.hold_outgoing_so: + if not line.bu_pick: continue line.bu_pick.action_assign() -- cgit v1.2.3 From 69f817b006b459160b890560cf69835e16365be5 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Mon, 19 Jan 2026 12:25:52 +0700 Subject: fix confirm --- indoteknik_custom/models/purchase_order.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a114743f..35fa79a8 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1083,8 +1083,9 @@ class PurchaseOrder(models.Model): if '/PJ/' in self.name: price_change_detected = any(line.price_unit_before for line in self.order_line) if price_change_detected: - if self.total_percent_margin <= 15.0: - raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + if self.order_sales_match_line: + if self.total_percent_margin <= 15.0: + raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") else: low_margin_match_so = self.order_sales_match_line.filtered( lambda match: match.so_header_margin <= 15.0 -- cgit v1.2.3 From 33f01a131c10b7352ade3b52072cfd5b6b2333f0 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Tue, 20 Jan 2026 15:58:07 +0700 Subject: (andri) add note detail pj --- indoteknik_custom/models/purchasing_job.py | 4 +++- indoteknik_custom/models/purchasing_job_state.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index 7a7e70b4..e457b86c 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -24,7 +24,8 @@ class PurchasingJob(models.Model): ('apo', 'APO') ], string='APO?') purchase_representative_id = fields.Many2one('res.users', string="Purchase Representative", readonly=True) - note = fields.Char(string="Note Detail") + note = fields.Char(string="Note") + note_detail = fields.Text(string="Note Detail") date_po = fields.Datetime(string='Date PO', copy=False) so_number = fields.Text(string='SO Number', copy=False) check_pj = fields.Boolean(compute='_get_check_pj', string='Linked') @@ -126,6 +127,7 @@ class PurchasingJob(models.Model): pmp.action, max(pjs.status_apo::text) AS status_apo, max(pjs.note::text) AS note, + max(pjs.note_detail::text) AS note_detail, max(pjs.date_po::text) AS date_po, pmp.so_number, CASE diff --git a/indoteknik_custom/models/purchasing_job_state.py b/indoteknik_custom/models/purchasing_job_state.py index d014edfe..ca557de1 100644 --- a/indoteknik_custom/models/purchasing_job_state.py +++ b/indoteknik_custom/models/purchasing_job_state.py @@ -14,5 +14,6 @@ class PurchasingJobState(models.Model): ('not_apo', 'Belum APO'), ('apo', 'APO') ], string='APO?', copy=False) - note = fields.Char(string="Note Detail", copy=False) + note = fields.Char(string="Note", copy=False) + note_detail = fields.Text(string="Note Detail", copy=False) date_po = fields.Datetime(string='Date PO', copy=False) -- cgit v1.2.3 From d5ff9c0dce0cb83bb9f2f4853097dc4dfb104f40 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 21 Jan 2026 09:03:21 +0700 Subject: add pricing group up to 10 --- indoteknik_custom/models/price_group.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/price_group.py b/indoteknik_custom/models/price_group.py index 1b1c817f..fce78fff 100644 --- a/indoteknik_custom/models/price_group.py +++ b/indoteknik_custom/models/price_group.py @@ -18,6 +18,8 @@ class PriceGroup(models.Model): group6 = fields.Float(string='Kelompok 6 (%)') group7 = fields.Float(string='Kelompok 7 (%)') group8 = fields.Float(string='Kelompok 8 (%)') + group9 = fields.Float(string='Kelompok 9 (%)') + group10 = fields.Float(string='Kelompok 10 (%)') def collect_price_group(self): PRICE_GROUP_ID = { @@ -47,4 +49,6 @@ class Manufacture(models.Model): ('group6', 'Kelompok 6'), ('group7', 'Kelompok 7'), ('group8', 'Kelompok 8'), + ('group9', 'Kelompok 9'), + ('group10', 'Kelompok 10'), ], string='Pricing Group', copy=False) -- cgit v1.2.3 From 035fbe33404455ba3fb016d3dc7d614fb4c3cd69 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Wed, 21 Jan 2026 14:52:43 +0700 Subject: (andri) fix confirm MO --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 17691798..9eed236f 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2305,7 +2305,7 @@ class SaleOrder(models.Model): search_bom = self.env['mrp.production'].search([('product_id', '=', line.product_id.id), ('sale_order', '=', order.id), ('state', '!=', 'cancel')], order='name desc') if search_bom: - confirmed_bom = search_bom.filtered(lambda x: x.state == 'confirmed' or x.state == 'done') + confirmed_bom = search_bom.filtered(lambda x: x.state in ['confirmed', 'to_close', 'progress', 'done']) if not confirmed_bom: raise UserError( "Product BOM belum dikonfirmasi di Manufacturing Orders. Silakan hubungi Purchasing.") -- cgit v1.2.3 From 230027f0bfedfedc27e5067d0b25d167f751688b Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 22 Jan 2026 09:49:07 +0700 Subject: fix edit note pj --- indoteknik_custom/models/purchasing_job_multi_update.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchasing_job_multi_update.py b/indoteknik_custom/models/purchasing_job_multi_update.py index 80a43e45..0eca499f 100644 --- a/indoteknik_custom/models/purchasing_job_multi_update.py +++ b/indoteknik_custom/models/purchasing_job_multi_update.py @@ -20,10 +20,19 @@ class PurchasingJobMultiUpdate(models.TransientModel): # purchasing_job_state.unlink() - purchasing_job_state.create({ - 'purchasing_job_id': product.id, - 'status_apo': 'apo', - }) + vals = { + 'purchasing_job_id': product.id, # Pastikan ID ini benar mapping ke ID produk + 'status_apo': 'apo', + } + + if purchasing_job_state: + purchasing_job_state.write(vals) + else: + purchasing_job_state.create(vals) + # purchasing_job_state.create({ + # 'purchasing_job_id': product.id, + # 'status_apo': 'apo', + # }) apo = self.env['automatic.purchase'].generate_regular_purchase(products) return { -- cgit v1.2.3 From 9e64a74e4576a150d172359999c9eb3cef8505a8 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Thu, 22 Jan 2026 17:46:05 +0700 Subject: cab inv --- indoteknik_custom/models/refund_sale_order.py | 38 +++++++++++++++++++++------ indoteknik_custom/models/sale_order.py | 11 +++++++- indoteknik_custom/models/x_manufactures.py | 1 + 3 files changed, 41 insertions(+), 9 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 722a125e..1c482619 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -242,7 +242,7 @@ class RefundSaleOrder(models.Model): ) invoices = sale_orders.mapped('invoice_ids').filtered( - lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.state != 'cancel' + lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.payment_state == 'paid' ) if invoices: vals['invoice_ids'] = [(6, 0, invoices.ids)] @@ -296,6 +296,7 @@ class RefundSaleOrder(models.Model): ]) piutangbca = self.env['account.move'] piutangmdr = self.env['account.move'] + cabinvoice = self.env['account.move'] for inv_name in invoices.mapped('name'): piutangbca |= self.env['account.move'].search([ @@ -308,6 +309,11 @@ class RefundSaleOrder(models.Model): ('journal_id', '=', 7), ('state', '=', 'posted'), ]) + cabinvoice |= self.env['account.move'].search([ + ('ref', 'ilike', inv_name), + ('journal_id', '=', 11), + ('state', '=', 'posted'), + ]) misc = self.env['account.move'] if invoices: @@ -378,6 +384,7 @@ class RefundSaleOrder(models.Model): has_moves3 = bool(moves3) has_piutangmdr = bool(piutangmdr) has_piutangbca = bool(piutangbca) + has_cabinvoice = bool(cabinvoice) has_misc = bool(misc) has_ongkir = bool(moves_ongkir) ssos = self.env['sale.order'].browse(so_ids) @@ -385,7 +392,7 @@ class RefundSaleOrder(models.Model): sisa_uang_masuk = 0.0 - has_journal = has_moves or has_moves2 or has_moves3 or has_piutangbca or has_piutangmdr or has_misc + has_journal = has_moves or has_moves2 or has_moves3 or has_piutangbca or has_piutangmdr or has_misc or has_cabinvoice if has_moves: sisa_uang_masuk += sum(moves.mapped('amount_total_signed')) @@ -397,6 +404,8 @@ class RefundSaleOrder(models.Model): sisa_uang_masuk += sum(moves3.mapped('amount_total_signed')) if has_piutangbca: sisa_uang_masuk += sum(piutangbca.mapped('amount_total_signed')) + if has_cabinvoice: + sisa_uang_masuk += sum(cabinvoice.mapped('amount_total_signed')) if has_piutangmdr: sisa_uang_masuk += sum(piutangmdr.mapped('amount_total_signed')) if has_misc: @@ -483,7 +492,7 @@ class RefundSaleOrder(models.Model): valid_invoices = sale_orders.mapped('invoice_ids').filtered( - lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.state != 'cancel' + lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.payment_state == 'paid' ) vals['invoice_ids'] = [(6, 0, valid_invoices.ids)] vals['ongkir'] = sum(so.delivery_amt or 0.0 for so in sale_orders) @@ -592,9 +601,7 @@ class RefundSaleOrder(models.Model): for rec in self: move_links = [] - invoice_ids = rec.sale_order_ids.mapped('invoice_ids').filtered( - lambda inv: inv.state == 'posted' - ) + invoice_ids = rec.sale_order_ids.mapped('invoice_ids') moves = self.env['account.move'].search([ ('sale_id', 'in', rec.sale_order_ids.ids), @@ -604,6 +611,7 @@ class RefundSaleOrder(models.Model): piutangbca = self.env['account.move'] piutangmdr = self.env['account.move'] + cabinvoice = self.env['account.move'] for inv_name in invoice_ids.mapped('name'): piutangbca |= self.env['account.move'].search([ @@ -616,6 +624,11 @@ class RefundSaleOrder(models.Model): ('journal_id', '=', 7), ('state', '=', 'posted'), ]) + cabinvoice |= self.env['account.move'].search([ + ('ref', 'ilike', inv_name), + ('journal_id', '=', 11), + ('state', '=', 'posted'), + ]) moves2 = self.env['account.move'] if rec.sale_order_ids: @@ -669,7 +682,7 @@ class RefundSaleOrder(models.Model): moves_ongkir = self.env['account.move'].search(domain) - all_moves = moves | piutangbca | piutangmdr | misc | moves2 | moves_ongkir + all_moves = moves | piutangbca | piutangmdr | misc | moves2 | moves_ongkir | cabinvoice for move in all_moves: url = f"/web#id={move.id}&model=account.move&view_type=form" @@ -697,7 +710,7 @@ class RefundSaleOrder(models.Model): for so in self.sale_order_ids: self.ongkir += so.delivery_amt or 0.0 valid_invoices = so.invoice_ids.filtered( - lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.state != 'cancel' + lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.payment_state == 'paid' ) all_invoices |= valid_invoices total_invoice += sum(valid_invoices.mapped('amount_total_signed')) @@ -715,6 +728,7 @@ class RefundSaleOrder(models.Model): piutangbca = self.env['account.move'] piutangmdr = self.env['account.move'] + cabinvoice = self.env['account.move'] for inv_name in all_invoices.mapped('name'): piutangbca |= self.env['account.move'].search([ @@ -727,6 +741,11 @@ class RefundSaleOrder(models.Model): ('journal_id', '=', 7), ('state', '=', 'posted'), ]) + cabinvoice |= self.env['account.move'].search([ + ('ref', 'ilike', inv_name), + ('journal_id', '=', 11), + ('state', '=', 'posted'), + ]) misc = self.env['account.move'] if all_invoices: @@ -801,6 +820,7 @@ class RefundSaleOrder(models.Model): has_moves3 = bool(moves3) has_piutangmdr = bool(piutangmdr) has_piutangbca = bool(piutangbca) + has_cabinvoice = bool(cabinvoice) has_misc = bool(misc) has_ongkir = bool(moves_ongkir) ssos = self.env['sale.order'].browse(so_ids) @@ -814,6 +834,8 @@ class RefundSaleOrder(models.Model): sisa_uang_masuk += sum(moves.mapped('amount_total_signed')) if has_moves2: sisa_uang_masuk += sum(moves2.mapped('amount_total_signed')) + if has_cabinvoice: + sisa_uang_masuk += sum(cabinvoice.mapped('amount_total_signed')) if has_moves3: sisa_uang_masuk += sum(moves3.mapped('amount_total_signed')) if has_piutangbca: diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 9eed236f..469509d4 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -3438,7 +3438,7 @@ class SaleOrder(models.Model): def button_refund(self): self.ensure_one() - invoice_ids = self.invoice_ids.filtered(lambda inv: inv.state != 'cancel') + invoice_ids = self.invoice_ids.filtered(lambda inv: inv.payment_state == 'paid') moves = self.env['account.move'].search([ ('sale_id', '=', self.id), @@ -3447,6 +3447,7 @@ class SaleOrder(models.Model): ]) piutangbca = self.env['account.move'] piutangmdr = self.env['account.move'] + cabinvoice = self.env['account.move'] for inv_name in invoice_ids.mapped('name'): piutangbca |= self.env['account.move'].search([ @@ -3459,6 +3460,11 @@ class SaleOrder(models.Model): ('journal_id', '=', 7), ('state', '=', 'posted'), ]) + cabinvoice |= self.env['account.move'].search([ + ('ref', 'ilike', inv_name), + ('journal_id', '=', 11), + ('state', '=', 'posted'), + ]) moves2 = self.env['account.move'].search([ ('ref', 'ilike', self.name), @@ -3473,6 +3479,7 @@ class SaleOrder(models.Model): has_moves2 = bool(moves2) has_piutangmdr = bool(piutangmdr) has_piutangbca = bool(piutangbca) + has_cabinvoice = bool(cabinvoice) has_settlement = self.payment_status == 'settlement' if has_moves and has_settlement: @@ -3483,6 +3490,8 @@ class SaleOrder(models.Model): total_uang_muka = sum(moves2.mapped('amount_total_signed')) elif has_settlement: total_uang_muka = self.gross_amount + elif has_cabinvoice: + total_uang_muka = sum(cabinvoice.mapped('amount_total_signed')) elif has_piutangbca: total_uang_muka = sum(piutangbca.mapped('amount_total_signed')) elif has_piutangmdr: diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index b4b61296..9e214d92 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -50,6 +50,7 @@ class XManufactures(models.Model): # user_id = fields.Many2one('res.users', string='Responsible', domain="['|'('id', '=', 19), ('id', '=', 6)]", help="Siapa yang bertanggung jawab") user_id = fields.Many2one('res.users', string='Responsible', help="Siapa yang bertanggung jawab") override_vendor_id = fields.Many2one('res.partner', string='Override Vendor') + # cashback_percent = fields.Float(string='Cashback Percent') def _compute_vendor_ids(self): for manufacture in self: -- cgit v1.2.3 From 9496bae642b86438f0dcef1595255e2f01384040 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 23 Jan 2026 09:40:35 +0700 Subject: fix --- indoteknik_custom/models/purchase_order.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 35fa79a8..50418fc9 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1086,12 +1086,12 @@ class PurchaseOrder(models.Model): if self.order_sales_match_line: if self.total_percent_margin <= 15.0: raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") - else: - low_margin_match_so = self.order_sales_match_line.filtered( - lambda match: match.so_header_margin <= 15.0 - ) - if low_margin_match_so: - raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") + # else: + # low_margin_match_so = self.order_sales_match_line.filtered( + # lambda match: match.so_header_margin <= 15.0 + # ) + # if low_margin_match_so: + # raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") # else: # is_po_manual = '/A/' not in self.name and '/MO/' not in self.name # if is_po_manual: -- cgit v1.2.3 From e700b4017f5f33564386dec52f3633b84a7e35a8 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 23 Jan 2026 09:43:28 +0700 Subject: fix --- indoteknik_custom/models/purchase_order.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 50418fc9..2154fb8c 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1079,14 +1079,14 @@ class PurchaseOrder(models.Model): ) % order.name) def button_confirm(self): - if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan - if '/PJ/' in self.name: - price_change_detected = any(line.price_unit_before for line in self.order_line) - if price_change_detected: - if self.order_sales_match_line: - if self.total_percent_margin <= 15.0: - raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") - # else: + # if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan + # if '/PJ/' in self.name: + # price_change_detected = any(line.price_unit_before for line in self.order_line) + # if price_change_detected: + # if self.order_sales_match_line: + # if self.total_percent_margin <= 15.0: + # raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + # # else: # low_margin_match_so = self.order_sales_match_line.filtered( # lambda match: match.so_header_margin <= 15.0 # ) -- cgit v1.2.3 From f2fbd1496a5ef1f86df794f69c8d0430f7caed63 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 23 Jan 2026 09:57:46 +0700 Subject: fix --- indoteknik_custom/models/purchase_order.py | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 2154fb8c..e16c8d61 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1079,24 +1079,13 @@ class PurchaseOrder(models.Model): ) % order.name) def button_confirm(self): - # if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan - # if '/PJ/' in self.name: - # price_change_detected = any(line.price_unit_before for line in self.order_line) - # if price_change_detected: - # if self.order_sales_match_line: - # if self.total_percent_margin <= 15.0: - # raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") - # # else: - # low_margin_match_so = self.order_sales_match_line.filtered( - # lambda match: match.so_header_margin <= 15.0 - # ) - # if low_margin_match_so: - # raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") - # else: - # is_po_manual = '/A/' not in self.name and '/MO/' not in self.name - # if is_po_manual: - # if not self.order_sales_match_line: - # raise UserError("Tidak ada matches SO, Approval Pimpinan diperlukan.") + if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan + if '/PJ/' in self.name: + price_change_detected = any(line.price_unit_before for line in self.order_line) + if price_change_detected: + if self.order_sales_match_line: + if self.total_percent_margin <= 15.0: + raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") self._check_assets_note() # self._check_payment_term() # check payment term -- cgit v1.2.3 From 7be11b56799d45e044f5af5927f63180c419e36e Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 23 Jan 2026 11:07:11 +0700 Subject: fix hitung qty purchase --- indoteknik_custom/models/automatic_purchase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 4b0ce325..0b2f7d1b 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -499,7 +499,8 @@ class AutomaticPurchase(models.Model): # _logger.info('test %s' % point.product_id.name) if point.product_id.qty_available_bandengan > point.product_min_qty: continue - qty_purchase = point.product_max_qty - point.product_id.qty_incoming_bandengan - point.product_id.qty_available_bandengan + # qty_purchase = point.product_max_qty - point.product_id.qty_incoming_bandengan - point.product_id.qty_available_bandengan + qty_purchase = point.product_max_qty - point.product_id.qty_available_bandengan po_line = self.env['purchase.order.line'].search([('product_id', '=', point.product_id.id), ('order_id.state', '=', 'done')], order='id desc', limit=1) if self.vendor_id: -- cgit v1.2.3 From abe9e16dff1d7b65530b258a306a6376b71c655b Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Fri, 23 Jan 2026 13:39:30 +0700 Subject: cashback brand --- indoteknik_custom/models/sale_order_line.py | 17 +++++++++++++++++ indoteknik_custom/models/x_manufactures.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 1df1a058..7b97bd85 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -17,6 +17,7 @@ class SaleOrderLine(models.Model): help="Total % Margin in Sales Order Header") item_percent_margin_before = fields.Float('%Margin Before', compute='_compute_item_percent_margin_before', help="Total % Margin excluding third party in Sales Order Header") + amount_cashback = fields.Float('Cashback Brand', compute='_compute_cashback_brand', help='Cashback from product who has cashback percent in manufacture') initial_discount = fields.Float('Initial Discount') vendor_id = fields.Many2one( 'res.partner', string='Vendor', readonly=True, @@ -212,6 +213,8 @@ class SaleOrderLine(models.Model): sales_price -= line.delivery_amt_line # if line.order_id.fee_third_party > 0: # sales_price -= line.fee_third_party_line + if line.amount_cashback > 0: + sales_price += line.amount_cashback purchase_price = line.purchase_price if line.purchase_tax_id.price_include: @@ -247,6 +250,20 @@ class SaleOrderLine(models.Model): margin_per_item = sales_price - purchase_price line.item_before_margin = margin_per_item + def _compute_cashback_brand(self): + for line in self: + line.amount_cashback = 0 + + if not line.product_id: + continue + + cashback_percent = line.product_id.x_manufacture.cashback_percent or 0 + if cashback_percent <= 0: + continue + + price, taxes, vendor_id = self._get_purchase_price(line.product_id) + line.amount_cashback = price * cashback_percent + # @api.onchange('vendor_id') # def onchange_vendor_id(self): # # TODO : need to change this logic @stephan diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index 9e214d92..0c3bfa3b 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -50,7 +50,7 @@ class XManufactures(models.Model): # user_id = fields.Many2one('res.users', string='Responsible', domain="['|'('id', '=', 19), ('id', '=', 6)]", help="Siapa yang bertanggung jawab") user_id = fields.Many2one('res.users', string='Responsible', help="Siapa yang bertanggung jawab") override_vendor_id = fields.Many2one('res.partner', string='Override Vendor') - # cashback_percent = fields.Float(string='Cashback Percent') + cashback_percent = fields.Float(string='Cashback Percent', default=0) def _compute_vendor_ids(self): for manufacture in self: -- cgit v1.2.3 From c63ed469e0431f054668cf4e44318ce3c8953a83 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 26 Jan 2026 09:36:09 +0700 Subject: error block code --- indoteknik_custom/models/refund_sale_order.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 1c482619..7615711b 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -675,10 +675,10 @@ class RefundSaleOrder(models.Model): ('line_ids.account_id', '=', 668), ] - if so_names: - domain += ['|'] * (len(so_names) - 1) - for name in so_names: - domain.append(('ref', 'ilike', name)) + if so_names: + domain += ['|'] * (len(so_names) - 1) + for name in so_names: + domain.append(('ref', 'ilike', name)) moves_ongkir = self.env['account.move'].search(domain) -- cgit v1.2.3 From 534bd428dd3548e9e501bd5e0e16892da7f7ff42 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 26 Jan 2026 09:41:52 +0700 Subject: error block code --- indoteknik_custom/models/refund_sale_order.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 7615711b..646376ab 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -674,13 +674,11 @@ class RefundSaleOrder(models.Model): ('line_ids.account_id', '=', 450), ('line_ids.account_id', '=', 668), ] + domain += ['|'] * (len(so_names) - 1) + for name in so_names: + domain.append(('ref', 'ilike', name)) - if so_names: - domain += ['|'] * (len(so_names) - 1) - for name in so_names: - domain.append(('ref', 'ilike', name)) - - moves_ongkir = self.env['account.move'].search(domain) + moves_ongkir = self.env['account.move'].search(domain) all_moves = moves | piutangbca | piutangmdr | misc | moves2 | moves_ongkir | cabinvoice -- cgit v1.2.3 From d74fa661fad2d83483d23e935836165359c0a1d2 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Tue, 27 Jan 2026 09:47:05 +0700 Subject: cashback brand done --- indoteknik_custom/models/sale_order_line.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 7b97bd85..c9e75fc7 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -213,12 +213,13 @@ class SaleOrderLine(models.Model): sales_price -= line.delivery_amt_line # if line.order_id.fee_third_party > 0: # sales_price -= line.fee_third_party_line - if line.amount_cashback > 0: - sales_price += line.amount_cashback purchase_price = line.purchase_price if line.purchase_tax_id.price_include: - purchase_price = line.purchase_price / 1.11 + purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) + + if line.amount_cashback > 0: + purchase_price = purchase_price - line.amount_cashback purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price @@ -252,7 +253,7 @@ class SaleOrderLine(models.Model): def _compute_cashback_brand(self): for line in self: - line.amount_cashback = 0 + line.amount_cashback = 0 if not line.product_id: continue @@ -261,8 +262,18 @@ class SaleOrderLine(models.Model): if cashback_percent <= 0: continue - price, taxes, vendor_id = self._get_purchase_price(line.product_id) - line.amount_cashback = price * cashback_percent + price, taxes, vendor = self._get_purchase_price(line.product_id) + + price_tax_excl = price + + if taxes: + tax = self.env['account.tax'].browse(taxes) + if tax.price_include: + price_tax_excl = price / (1 + (tax.amount / 100)) + else: + price_tax_excl = price + + line.amount_cashback = price_tax_excl * cashback_percent # @api.onchange('vendor_id') # def onchange_vendor_id(self): -- cgit v1.2.3 From 4560970a9bdfd9fab483019f24d78cfe78330e32 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Fri, 30 Jan 2026 14:20:18 +0700 Subject: fix cashback --- indoteknik_custom/models/sale_order_line.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index c9e75fc7..d36c03e5 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -165,7 +165,10 @@ class SaleOrderLine(models.Model): purchase_price = line.purchase_price if line.purchase_tax_id.price_include: - purchase_price = line.purchase_price / 1.11 + purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) + + if line.amount_cashback > 0: + purchase_price = purchase_price - line.amount_cashback purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price @@ -187,7 +190,7 @@ class SaleOrderLine(models.Model): purchase_price = line.purchase_price if line.purchase_tax_id and line.purchase_tax_id.price_include: - purchase_price = line.purchase_price / 1.11 + purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) purchase_price = purchase_price * line.product_uom_qty @@ -245,7 +248,7 @@ class SaleOrderLine(models.Model): purchase_price = line.purchase_price if line.purchase_tax_id.price_include: - purchase_price = line.purchase_price / 1.11 + purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price -- cgit v1.2.3 From 4ac8b06616a0dce80029e1063078b31b6100084e Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Fri, 30 Jan 2026 15:52:21 +0700 Subject: refund kebutuhan BA dan cahsback --- indoteknik_custom/models/refund_sale_order.py | 53 ++++++++++++++++++++------- indoteknik_custom/models/sale_order_line.py | 42 ++++++++++----------- 2 files changed, 61 insertions(+), 34 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 1c482619..c3b7a356 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -62,7 +62,8 @@ class RefundSaleOrder(models.Model): ('uang', 'Refund Lebih Bayar'), ('retur_half', 'Refund Retur Sebagian'), ('retur', 'Refund Retur Full'), - ('salah_transfer', 'Salah Transfer') + ('salah_transfer', 'Salah Transfer'), + ('berita_acara', 'Kebutuhan Berita Acara') ], string='Refund Type', required=True) tukar_guling_ids = fields.One2many( @@ -251,7 +252,7 @@ class RefundSaleOrder(models.Model): invoice_ids_data = vals.get('invoice_ids', []) invoice_ids = invoice_ids_data[0][2] if invoice_ids_data and invoice_ids_data[0][0] == 6 else [] invoices = self.env['account.move'].browse(invoice_ids) - if invoice_ids and refund_type and refund_type not in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half']: + if invoice_ids and refund_type and refund_type not in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half', 'berita_acara']: raise UserError("Refund type Hanya Bisa Lebih Bayar, Barang Kosong Sebagian, atau Retur jika ada invoice") if not invoice_ids and refund_type and refund_type in ['uang', 'barang_kosong_sebagian', 'retur_half']: @@ -434,13 +435,17 @@ class RefundSaleOrder(models.Model): total_invoice = sum(self.env['account.move'].browse(invoice_ids).mapped('amount_total_signed')) if invoice_ids else 0.0 vals['total_invoice'] = total_invoice amount_refund = vals.get('amount_refund', 0.0) - can_refund = sisa_uang_masuk - total_invoice - - if amount_refund > can_refund or can_refund == 0.0: - raise ValidationError( - _("Maksimal refund yang bisa dilakukan adalah sebesar %s. " - "Silakan sesuaikan jumlah refund.") % (can_refund) - ) + can_refund = 0.0 + if refund_type == 'berita_acara': + can_refund = sisa_uang_masuk + else: + can_refund = sisa_uang_masuk - total_invoice + if refund_type != 'berita_acara': + if amount_refund > can_refund or can_refund == 0.0: + raise ValidationError( + _("Maksimal refund yang bisa dilakukan adalah sebesar %s. " + "Silakan sesuaikan jumlah refund.") % (can_refund) + ) if amount_refund <= 0.00: raise ValidationError('Total Refund harus lebih dari 0 jika ingin mengajukan refund') @@ -451,7 +456,11 @@ class RefundSaleOrder(models.Model): raise UserError("❌ Refund multi SO hanya bisa 1 kali.") vals['remaining_refundable'] = 0.0 elif so_ids and len(so_ids) == 1 and refund_type != 'salah_transfer': - remaining = vals['uang_masuk'] - amount_refund + remaining = 0.0 + if refund_type == 'berita_acara': + vals['remaining_refundable'] = vals['uang_masuk'] - amount_refund + else: + vals['remaining_refundable'] = remaining if remaining < 0: raise ValidationError("❌ Tidak ada sisa transaksi untuk di-refund di SO ini. Semua dana sudah dikembalikan.") vals['remaining_refundable'] = remaining @@ -548,10 +557,28 @@ class RefundSaleOrder(models.Model): if any(field in vals for field in ['uang_masuk', 'invoice_ids', 'ongkir', 'sale_order_ids', 'amount_refund']): total_invoice = sum(self.env['account.move'].browse(invoice_ids).mapped('amount_total_signed')) vals['total_invoice'] = total_invoice - uang_masuk = rec.uang_masuk - can_refund = uang_masuk - total_invoice - + uang_masuk = vals.get('uang_masuk', rec.uang_masuk) amount_refund = vals.get('amount_refund', rec.amount_refund) + can_refund = 0.0 + total_refunded = 0.0 + + if refund_type == 'berita_acara': + can_refund = uang_masuk + remaining = uang_masuk - amount_refund + else: + can_refund = uang_masuk - total_invoice + + existing_refunds = self.search([ + ('sale_order_ids', 'in', so_ids), + ('id', '!=', rec.id) + ]) + total_refunded = sum(existing_refunds.mapped('amount_refund')) + + if existing_refunds: + remaining = uang_masuk - total_refunded + else: + remaining = uang_masuk - amount_refund + if amount_refund > can_refund: raise ValidationError( diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index d36c03e5..55bea22c 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -167,8 +167,8 @@ class SaleOrderLine(models.Model): if line.purchase_tax_id.price_include: purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) - if line.amount_cashback > 0: - purchase_price = purchase_price - line.amount_cashback + # if line.amount_cashback > 0: + # purchase_price = purchase_price - line.amount_cashback purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price @@ -221,8 +221,8 @@ class SaleOrderLine(models.Model): if line.purchase_tax_id.price_include: purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) - if line.amount_cashback > 0: - purchase_price = purchase_price - line.amount_cashback + # if line.amount_cashback > 0: + # purchase_price = purchase_price - line.amount_cashback purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price @@ -254,29 +254,29 @@ class SaleOrderLine(models.Model): margin_per_item = sales_price - purchase_price line.item_before_margin = margin_per_item - def _compute_cashback_brand(self): - for line in self: - line.amount_cashback = 0 + # def _compute_cashback_brand(self): + # for line in self: + # line.amount_cashback = 0 - if not line.product_id: - continue + # if not line.product_id: + # continue - cashback_percent = line.product_id.x_manufacture.cashback_percent or 0 - if cashback_percent <= 0: - continue + # cashback_percent = line.product_id.x_manufacture.cashback_percent or 0 + # if cashback_percent <= 0: + # continue - price, taxes, vendor = self._get_purchase_price(line.product_id) + # price, taxes, vendor = self._get_purchase_price(line.product_id) - price_tax_excl = price + # price_tax_excl = price - if taxes: - tax = self.env['account.tax'].browse(taxes) - if tax.price_include: - price_tax_excl = price / (1 + (tax.amount / 100)) - else: - price_tax_excl = price + # if taxes: + # tax = self.env['account.tax'].browse(taxes) + # if tax.price_include: + # price_tax_excl = price / (1 + (tax.amount / 100)) + # else: + # price_tax_excl = price - line.amount_cashback = price_tax_excl * cashback_percent + # line.amount_cashback = price_tax_excl * cashback_percent # @api.onchange('vendor_id') # def onchange_vendor_id(self): -- cgit v1.2.3 From 48e48a61a6fc0addcc1e0c3590ca8582abe66a6a Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Fri, 30 Jan 2026 18:19:30 +0700 Subject: refund kebutuhan BA dan cahsback --- indoteknik_custom/models/refund_sale_order.py | 6 +--- indoteknik_custom/models/sale_order_line.py | 48 +++++++++++++++------------ 2 files changed, 28 insertions(+), 26 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index c3b7a356..7a219130 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -456,11 +456,7 @@ class RefundSaleOrder(models.Model): raise UserError("❌ Refund multi SO hanya bisa 1 kali.") vals['remaining_refundable'] = 0.0 elif so_ids and len(so_ids) == 1 and refund_type != 'salah_transfer': - remaining = 0.0 - if refund_type == 'berita_acara': - vals['remaining_refundable'] = vals['uang_masuk'] - amount_refund - else: - vals['remaining_refundable'] = remaining + remaining = vals['uang_masuk'] - amount_refund if remaining < 0: raise ValidationError("❌ Tidak ada sisa transaksi untuk di-refund di SO ini. Semua dana sudah dikembalikan.") vals['remaining_refundable'] = remaining diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 55bea22c..270fc842 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -167,8 +167,8 @@ class SaleOrderLine(models.Model): if line.purchase_tax_id.price_include: purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) - # if line.amount_cashback > 0: - # purchase_price = purchase_price - line.amount_cashback + if line.amount_cashback > 0: + purchase_price = purchase_price - line.amount_cashback purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price @@ -192,6 +192,9 @@ class SaleOrderLine(models.Model): if line.purchase_tax_id and line.purchase_tax_id.price_include: purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) + if line.amount_cashback > 0: + purchase_price = purchase_price - line.amount_cashback + purchase_price = purchase_price * line.product_uom_qty margin_before = sales_price - purchase_price @@ -221,8 +224,8 @@ class SaleOrderLine(models.Model): if line.purchase_tax_id.price_include: purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) - # if line.amount_cashback > 0: - # purchase_price = purchase_price - line.amount_cashback + if line.amount_cashback > 0: + purchase_price = purchase_price - line.amount_cashback purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price @@ -250,33 +253,36 @@ class SaleOrderLine(models.Model): if line.purchase_tax_id.price_include: purchase_price = line.purchase_price / (1 + (line.purchase_tax_id.amount / 100)) + if line.amount_cashback > 0: + purchase_price = purchase_price - line.amount_cashback + purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price line.item_before_margin = margin_per_item - # def _compute_cashback_brand(self): - # for line in self: - # line.amount_cashback = 0 + def _compute_cashback_brand(self): + for line in self: + line.amount_cashback = 0 - # if not line.product_id: - # continue + if not line.product_id: + continue - # cashback_percent = line.product_id.x_manufacture.cashback_percent or 0 - # if cashback_percent <= 0: - # continue + cashback_percent = line.product_id.x_manufacture.cashback_percent or 0 + if cashback_percent <= 0: + continue - # price, taxes, vendor = self._get_purchase_price(line.product_id) + price, taxes, vendor = self._get_purchase_price(line.product_id) - # price_tax_excl = price + price_tax_excl = price - # if taxes: - # tax = self.env['account.tax'].browse(taxes) - # if tax.price_include: - # price_tax_excl = price / (1 + (tax.amount / 100)) - # else: - # price_tax_excl = price + if taxes: + tax = self.env['account.tax'].browse(taxes) + if tax.price_include: + price_tax_excl = price / (1 + (tax.amount / 100)) + else: + price_tax_excl = price - # line.amount_cashback = price_tax_excl * cashback_percent + line.amount_cashback = price_tax_excl * cashback_percent # @api.onchange('vendor_id') # def onchange_vendor_id(self): -- cgit v1.2.3 From 04093dbd490ef94a19aa2df69793e8eeb48831c5 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 2 Feb 2026 11:24:09 +0700 Subject: fix date order cashback start februari --- indoteknik_custom/models/refund_sale_order.py | 2 +- indoteknik_custom/models/sale_order_line.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 7a219130..7ce347a8 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -540,7 +540,7 @@ class RefundSaleOrder(models.Model): else: invoice_ids = rec.invoice_ids.ids - if invoice_ids and vals.get('refund_type', rec.refund_type) not in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half', 'retur']: + if invoice_ids and vals.get('refund_type', rec.refund_type) not in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half', 'retur', 'berita_acara']: raise UserError("Refund type Hanya Bisa Lebih Bayar, Barang Kosong Sebagian, atau Retur jika ada invoice") if not invoice_ids and vals.get('refund_type', rec.refund_type) in ['uang', 'barang_kosong_sebagian', 'retur_half']: diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 270fc842..dd44f84a 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -261,17 +261,25 @@ class SaleOrderLine(models.Model): line.item_before_margin = margin_per_item def _compute_cashback_brand(self): + start_date = datetime(2026, 2, 1, 0, 0, 0) for line in self: line.amount_cashback = 0 if not line.product_id: continue + if line.order_id.date_order < start_date: + continue + + price, taxes, vendor_id = self._get_purchase_price(line.product_id) + cashback_percent = line.product_id.x_manufacture.cashback_percent or 0 if cashback_percent <= 0: continue - price, taxes, vendor = self._get_purchase_price(line.product_id) + + if line.vendor_id.id != 5571: + continue price_tax_excl = price -- cgit v1.2.3 From d43b0c4621421fcfb1afe4724e13d2604570e1e6 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 2 Feb 2026 13:02:55 +0700 Subject: fix margin po --- indoteknik_custom/models/purchase_order_line.py | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 8c72887d..603a4ca2 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -23,6 +23,9 @@ class PurchaseOrderLine(models.Model): so_item_percent_margin = fields.Float( 'SO Margin%', compute='compute_item_margin', help="Total % Margin in Sales Order Header") + amount_cashback = fields.Float( + 'SO Margin%', compute='_compute_cashback_brand', + help="Total % Margin in Sales Order Header") delivery_amt_line = fields.Float('DeliveryAmtLine', compute='compute_delivery_amt_line') line_no = fields.Integer('No', default=0) qty_available = fields.Float('Qty Available', compute='_compute_qty_stock') @@ -373,6 +376,9 @@ class PurchaseOrderLine(models.Model): purchase_price = line.price_subtotal if order.delivery_amount > 0: purchase_price += line.delivery_amt_line + + if line.amount_cashback > 0: + purchase_price = purchase_price - line.amount_cashback # Hitung margin dan persentase margin real_item_margin = total_sales_price - purchase_price @@ -384,6 +390,46 @@ class PurchaseOrderLine(models.Model): sum_margin += real_item_margin + def _compute_cashback_brand(self): + start_date = datetime(2026, 2, 1, 0, 0, 0) + + for line in self: + line.amount_cashback = 0.0 + + product = line.product_id + order = line.order_id + + if not product or not order: + continue + + if order.partner_id.id != 5571: + continue + + sales_matches = self.env['purchase.order.sales.match'].search([ + ('purchase_order_id', '=', order.id), + ('product_id', '=', product.id) + ]) + + total_cashback = 0.0 + + for match in sales_matches: + so_line = match.sale_line_id + so_order = so_line.order_id + + if not so_order.date_order or so_order.date_order < start_date: + continue + + cashback_percent = brand.cashback_percent or 0.0 + if cashback_percent <= 0: + continue + sales_price = so_line.price_reduce_taxexcl * match.qty_so + + cashback = sales_price * cashback_percent + total_cashback += cashback + + line.amount_cashback = total_cashback + + def compute_delivery_amt_line(self): for line in self: if line.product_id.type == 'product': -- cgit v1.2.3 From fe3fb82fdd879c703d968cf09b09e6411e91100f Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 2 Feb 2026 13:08:50 +0700 Subject: fix margin po --- indoteknik_custom/models/purchase_order_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 603a4ca2..76dcc09e 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -419,7 +419,7 @@ class PurchaseOrderLine(models.Model): if not so_order.date_order or so_order.date_order < start_date: continue - cashback_percent = brand.cashback_percent or 0.0 + cashback_percent = product.x_manufacture.cashback_percent or 0.0 if cashback_percent <= 0: continue sales_price = so_line.price_reduce_taxexcl * match.qty_so -- cgit v1.2.3 From b7cd9ffe12f0dbae9abba2fdac32417bd400e481 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Mon, 2 Feb 2026 13:43:44 +0700 Subject: fix vcm picking wrong receipt --- indoteknik_custom/models/tukar_guling_po.py | 38 ++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index ae58d509..1ee10679 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -582,7 +582,23 @@ class TukarGulingPO(models.Model): ('group_id', '=', group.id), ('state', '=', 'done') ]) - bu_inputs = po_pickings.filtered(lambda p: p.picking_type_id.id == 28) + + product_ids = set(record.line_ids.mapped("product_id").ids) + + _logger.info("TG product_ids: %s", product_ids) + + def _get_moves(picking): + return picking.move_ids_without_package if picking.move_ids_without_package else picking.move_lines + + bu_inputs = po_pickings.filtered( + lambda p: p.picking_type_id.id == 28 and any( + m.product_id.id in product_ids + for m in _get_moves(p) + ) + ) + + _logger.info("BU INPUT dengan product sama: %s", bu_inputs.mapped("name")) + bu_puts = po_pickings.filtered(lambda p: p.picking_type_id.id == 75) else: raise UserError("Group ID tidak ditemukan pada BU Operations.") @@ -711,12 +727,26 @@ class TukarGulingPO(models.Model): # Ambil pasangannya di BU INPUT (asumsi urutan sejajar) sorted_bu_puts = sorted(bu_puts, key=lambda p: p.name) + # sorted_bu_inputs = sorted(bu_inputs, key=lambda p: p.name) + + # if bu_put_index >= len(sorted_bu_inputs): + # raise UserError("Tidak ditemukan pasangan BU INPUT untuk BU PUT yang dipilih.") + + # paired = [(sorted_bu_puts[bu_put_index], sorted_bu_inputs[bu_put_index])] sorted_bu_inputs = sorted(bu_inputs, key=lambda p: p.name) - if bu_put_index >= len(sorted_bu_inputs): - raise UserError("Tidak ditemukan pasangan BU INPUT untuk BU PUT yang dipilih.") + if not sorted_bu_inputs: + raise UserError( + "Tidak ditemukan BU INPUT yang memiliki product TG." + ) - paired = [(sorted_bu_puts[bu_put_index], sorted_bu_inputs[bu_put_index])] + paired = [(record.operations, sorted_bu_inputs[0])] + + _logger.info( + "🔗 Pairing BU PUT %s dengan BU INPUT %s", + record.operations.name, + sorted_bu_inputs[0].name + ) for bu_put, bu_input in paired: vrt = _create_return_from_picking(bu_put, bu_put_qty_map) -- cgit v1.2.3 From 8b28af52afe07363209601a1ad1cb90b7778d1d8 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 2 Feb 2026 14:48:34 +0700 Subject: fix margin po 2 --- indoteknik_custom/models/purchase_order.py | 13 +++++++++++++ indoteknik_custom/models/refund_sale_order.py | 6 +++--- indoteknik_custom/models/sale_order.py | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 35fa79a8..a1e92e10 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -53,6 +53,9 @@ class PurchaseOrder(models.Model): total_so_percent_margin = fields.Float( 'SO Margin%', compute='compute_total_margin', help="Total % Margin in Sales Order Header") + amount_cashback = fields.Float( + 'Cashback', compute='compute_total_margin', + help="Total Cashback brand Altama") amount_total_without_service = fields.Float('AmtTotalWithoutService', compute='compute_amt_total_without_service') summary_qty_po = fields.Float('Total Qty', compute='_compute_summary_qty') summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty') @@ -1418,6 +1421,14 @@ class PurchaseOrder(models.Model): purchase_price += line.delivery_amt_line if line.order_id.delivery_amt > 0: purchase_price += line.order_id.delivery_amt + + cashback_amount = 0.0 + if self.partner_id.id == 5571: + cashback_percent = line.product_id.x_manufacture.cashback_percent or 0.0 + if cashback_percent > 0: + cashback_amount = purchase_price * cashback_percent + purchase_price -= cashback_amount + real_item_margin = sales_price - purchase_price sum_margin += real_item_margin @@ -1426,11 +1437,13 @@ class PurchaseOrder(models.Model): self.total_so_percent_margin = round((sum_so_margin / sum_sales_price), 2) * 100 self.total_margin = sum_margin self.total_percent_margin = round((sum_margin / sum_sales_price), 2) * 100 + self.amount_cashback = cashback_amount else: self.total_margin = 0 self.total_percent_margin = 0 self.total_so_margin = 0 self.total_so_percent_margin = 0 + self.amount_cashback = 0 def compute_total_margin_from_apo(self): sum_so_margin = sum_sales_price = sum_margin = 0 diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 7ce347a8..d6aa1ad2 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -243,7 +243,7 @@ class RefundSaleOrder(models.Model): ) invoices = sale_orders.mapped('invoice_ids').filtered( - lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.payment_state == 'paid' + lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.state == 'posted' ) if invoices: vals['invoice_ids'] = [(6, 0, invoices.ids)] @@ -497,7 +497,7 @@ class RefundSaleOrder(models.Model): valid_invoices = sale_orders.mapped('invoice_ids').filtered( - lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.payment_state == 'paid' + lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.state == 'posted' ) vals['invoice_ids'] = [(6, 0, valid_invoices.ids)] vals['ongkir'] = sum(so.delivery_amt or 0.0 for so in sale_orders) @@ -733,7 +733,7 @@ class RefundSaleOrder(models.Model): for so in self.sale_order_ids: self.ongkir += so.delivery_amt or 0.0 valid_invoices = so.invoice_ids.filtered( - lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.payment_state == 'paid' + lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.state == 'posted' ) all_invoices |= valid_invoices total_invoice += sum(valid_invoices.mapped('amount_total_signed')) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 469509d4..a4bc2309 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -3438,7 +3438,7 @@ class SaleOrder(models.Model): def button_refund(self): self.ensure_one() - invoice_ids = self.invoice_ids.filtered(lambda inv: inv.payment_state == 'paid') + invoice_ids = self.invoice_ids.filtered(lambda inv: inv.state == 'posted') moves = self.env['account.move'].search([ ('sale_id', '=', self.id), -- cgit v1.2.3 From 750cdae1141d0039ab2c8d5796c5fb7bb2726bcc Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Mon, 2 Feb 2026 14:54:14 +0700 Subject: (andri) fix compute when PUM is canceled --- indoteknik_custom/models/advance_payment_request.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/advance_payment_request.py b/indoteknik_custom/models/advance_payment_request.py index ed0b0809..8cadb1b6 100644 --- a/indoteknik_custom/models/advance_payment_request.py +++ b/indoteknik_custom/models/advance_payment_request.py @@ -641,10 +641,16 @@ class AdvancePaymentRequest(models.Model): today = date.today() for rec in self: - current_days = rec.days_remaining or 0 - current_due_date = rec.estimated_return_date or False - if rec.type_request == 'pum': - is_settlement_approved = any(s.status == 'approved' for s in rec.settlement_ids) + # current_days = rec.days_remaining or 0 + # current_due_date = rec.estimated_return_date or False + current_days = 0 + current_due_date = False + + is_settlement_approved = any(s.status == 'approved' for s in rec.settlement_ids) + is_pum_canceled = (rec.status == 'cancel') + + if rec.type_request == 'pum' and not is_pum_canceled and not is_settlement_approved: + if not is_settlement_approved: due_date = False -- cgit v1.2.3 From 5118ff0549de5bea4e83b31da2c2347f227c488a Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 2 Feb 2026 14:55:02 +0700 Subject: pusing margin po --- indoteknik_custom/models/purchase_order.py | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a1e92e10..35fa79a8 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -53,9 +53,6 @@ class PurchaseOrder(models.Model): total_so_percent_margin = fields.Float( 'SO Margin%', compute='compute_total_margin', help="Total % Margin in Sales Order Header") - amount_cashback = fields.Float( - 'Cashback', compute='compute_total_margin', - help="Total Cashback brand Altama") amount_total_without_service = fields.Float('AmtTotalWithoutService', compute='compute_amt_total_without_service') summary_qty_po = fields.Float('Total Qty', compute='_compute_summary_qty') summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty') @@ -1421,14 +1418,6 @@ class PurchaseOrder(models.Model): purchase_price += line.delivery_amt_line if line.order_id.delivery_amt > 0: purchase_price += line.order_id.delivery_amt - - cashback_amount = 0.0 - if self.partner_id.id == 5571: - cashback_percent = line.product_id.x_manufacture.cashback_percent or 0.0 - if cashback_percent > 0: - cashback_amount = purchase_price * cashback_percent - purchase_price -= cashback_amount - real_item_margin = sales_price - purchase_price sum_margin += real_item_margin @@ -1437,13 +1426,11 @@ class PurchaseOrder(models.Model): self.total_so_percent_margin = round((sum_so_margin / sum_sales_price), 2) * 100 self.total_margin = sum_margin self.total_percent_margin = round((sum_margin / sum_sales_price), 2) * 100 - self.amount_cashback = cashback_amount else: self.total_margin = 0 self.total_percent_margin = 0 self.total_so_margin = 0 self.total_so_percent_margin = 0 - self.amount_cashback = 0 def compute_total_margin_from_apo(self): sum_so_margin = sum_sales_price = sum_margin = 0 -- cgit v1.2.3 From 37ccff02eb47b50ca6d23e4cd027155381c53947 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 2 Feb 2026 16:59:12 +0700 Subject: coba margin po last --- indoteknik_custom/models/purchase_order.py | 24 +++++++++++++++++++++++- indoteknik_custom/models/refund_sale_order.py | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 35fa79a8..60802649 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -53,6 +53,9 @@ class PurchaseOrder(models.Model): total_so_percent_margin = fields.Float( 'SO Margin%', compute='compute_total_margin', help="Total % Margin in Sales Order Header") + amount_cashback = fields.Float( + 'Cashback', compute='compute_total_margin', + help="Total Cashback brand Altama") amount_total_without_service = fields.Float('AmtTotalWithoutService', compute='compute_amt_total_without_service') summary_qty_po = fields.Float('Total Qty', compute='_compute_summary_qty') summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty') @@ -1418,19 +1421,29 @@ class PurchaseOrder(models.Model): purchase_price += line.delivery_amt_line if line.order_id.delivery_amt > 0: purchase_price += line.order_id.delivery_amt + + cashback_amount = 0.0 + if self.partner_id.id == 5571: + cashback_percent = line.product_id.x_manufacture.cashback_percent or 0.0 + if cashback_percent > 0: + cashback_amount = purchase_price * cashback_percent + purchase_price -= cashback_amount + real_item_margin = sales_price - purchase_price sum_margin += real_item_margin - if sum_so_margin != 0 and sum_sales_price != 0 and sum_margin != 0: + if sum_so_margin != 0 and sum_sales_price != 0 and sum_margin != 0 and cashback_amount != 0: self.total_so_margin = sum_so_margin self.total_so_percent_margin = round((sum_so_margin / sum_sales_price), 2) * 100 self.total_margin = sum_margin self.total_percent_margin = round((sum_margin / sum_sales_price), 2) * 100 + self.amount_cashback = cashback_amount else: self.total_margin = 0 self.total_percent_margin = 0 self.total_so_margin = 0 self.total_so_percent_margin = 0 + self.amount_cashback = 0 def compute_total_margin_from_apo(self): sum_so_margin = sum_sales_price = sum_margin = 0 @@ -1469,6 +1482,13 @@ class PurchaseOrder(models.Model): purchase_price += (po_line.delivery_amt_line / po_line.product_qty) * qty_po if line.purchase_order_id.delivery_amt > 0: purchase_price += line.purchase_order_id.delivery_amt + + cashback_amount = 0.0 + if self.partner_id.id == 5571: + cashback_percent = line.product_id.x_manufacture.cashback_percent or 0.0 + if cashback_percent > 0: + cashback_amount = purchase_price * cashback_percent + purchase_price -= cashback_amount real_item_margin = sales_price - purchase_price sum_margin += real_item_margin @@ -1479,9 +1499,11 @@ class PurchaseOrder(models.Model): self.total_so_percent_margin = round((sum_so_margin / sum_sales_price), 2) * 100 self.total_margin = sum_margin self.total_percent_margin = round((sum_margin / sum_sales_price), 2) * 100 + self.amount_cashback = cashback_amount else: self.total_margin = self.total_percent_margin = 0 self.total_so_margin = self.total_so_percent_margin = 0 + self.amount_cashback = 0 def compute_amt_total_without_service(self): diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index d6aa1ad2..1ce53113 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -624,7 +624,7 @@ class RefundSaleOrder(models.Model): for rec in self: move_links = [] - invoice_ids = rec.sale_order_ids.mapped('invoice_ids') + invoice_ids = rec.sale_order_ids.mapped('invoice_ids').filtered(lambda m: m.state == 'posted') moves = self.env['account.move'].search([ ('sale_id', 'in', rec.sale_order_ids.ids), -- cgit v1.2.3 From 4fa6b57647f7f53573bd83d9dd4f0292ab955e1a Mon Sep 17 00:00:00 2001 From: Mqdd Date: Tue, 3 Feb 2026 11:41:35 +0700 Subject: fix margin PO --- indoteknik_custom/models/purchase_order.py | 51 +++++++++++++++++++----------- 1 file changed, 33 insertions(+), 18 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 6b6e6aa2..820f8091 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -53,9 +53,7 @@ class PurchaseOrder(models.Model): total_so_percent_margin = fields.Float( 'SO Margin%', compute='compute_total_margin', help="Total % Margin in Sales Order Header") - amount_cashback = fields.Float( - 'Cashback', compute='compute_total_margin', - help="Total Cashback brand Altama") + amount_cashback = fields.Float('Cashback', compute = 'compute_total_margin', help = 'Total Cashback brand Altama') amount_total_without_service = fields.Float('AmtTotalWithoutService', compute='compute_amt_total_without_service') summary_qty_po = fields.Float('Total Qty', compute='_compute_summary_qty') summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty') @@ -1086,9 +1084,19 @@ class PurchaseOrder(models.Model): if '/PJ/' in self.name: price_change_detected = any(line.price_unit_before for line in self.order_line) if price_change_detected: - if self.order_sales_match_line: - if self.total_percent_margin <= 15.0: - raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + if self.total_percent_margin <= 15.0: + raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + else: + low_margin_match_so = self.order_sales_match_line.filtered( + lambda match: match.so_header_margin <= 15.0 + ) + if low_margin_match_so: + raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") + # else: + # is_po_manual = '/A/' not in self.name and '/MO/' not in self.name + # if is_po_manual: + # if not self.order_sales_match_line: + # raise UserError("Tidak ada matches SO, Approval Pimpinan diperlukan.") self._check_assets_note() # self._check_payment_term() # check payment term @@ -1410,18 +1418,25 @@ class PurchaseOrder(models.Model): purchase_price += line.delivery_amt_line if line.order_id.delivery_amt > 0: purchase_price += line.order_id.delivery_amt + real_item_margin = sales_price - purchase_price + sum_margin += real_item_margin - cashback_amount = 0.0 + cashback_amount = 0 if self.partner_id.id == 5571: cashback_percent = line.product_id.x_manufacture.cashback_percent or 0.0 if cashback_percent > 0: cashback_amount = purchase_price * cashback_percent purchase_price -= cashback_amount - real_item_margin = sales_price - purchase_price - sum_margin += real_item_margin + # line.amount_cashback = cashback_amount - if sum_so_margin != 0 and sum_sales_price != 0 and sum_margin != 0 and cashback_amount != 0: + if sum_so_margin != 0 and sum_sales_price != 0 and sum_margin != 0: + self.total_so_margin = sum_so_margin + self.total_so_percent_margin = round((sum_so_margin / sum_sales_price), 2) * 100 + self.total_margin = sum_margin + self.total_percent_margin = round((sum_margin / sum_sales_price), 2) * 100 + self.amount_cashback = 0 + elif self.partner_id.id == 5571 and sum_so_margin != 0 and sum_sales_price != 0 and sum_margin != 0 and cashback_amount != 0: self.total_so_margin = sum_so_margin self.total_so_percent_margin = round((sum_so_margin / sum_sales_price), 2) * 100 self.total_margin = sum_margin @@ -1435,7 +1450,7 @@ class PurchaseOrder(models.Model): self.amount_cashback = 0 def compute_total_margin_from_apo(self): - sum_so_margin = sum_sales_price = sum_margin = 0 + sum_so_margin = sum_sales_price = sum_margin = cashback_amount = 0 for line in self.order_sales_match_line: po_line = self.env['purchase.order.line'].search([ ('product_id', '=', line.product_id.id), @@ -1471,17 +1486,17 @@ class PurchaseOrder(models.Model): purchase_price += (po_line.delivery_amt_line / po_line.product_qty) * qty_po if line.purchase_order_id.delivery_amt > 0: purchase_price += line.purchase_order_id.delivery_amt - - cashback_amount = 0.0 - if self.partner_id.id == 5571: - cashback_percent = line.product_id.x_manufacture.cashback_percent or 0.0 - if cashback_percent > 0: - cashback_amount = purchase_price * cashback_percent - purchase_price -= cashback_amount + + if self.partner_id.id == 5571: + cashback_percent = line.product_id.x_manufacture.cashback_percent or 0.0 + if cashback_percent > 0: + cashback_amount = purchase_price * cashback_percent + purchase_price -= cashback_amount real_item_margin = sales_price - purchase_price sum_margin += real_item_margin + self.amount_cashback = cashback_amount # Akumulasi hasil akhir if sum_sales_price != 0: self.total_so_margin = sum_so_margin -- cgit v1.2.3 From 9da91430c095af5d46e6821de82a93b30ce42a26 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Wed, 4 Feb 2026 13:19:37 +0700 Subject: off confirm --- indoteknik_custom/models/purchase_order.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index e16c8d61..cb6e70b1 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1079,13 +1079,13 @@ class PurchaseOrder(models.Model): ) % order.name) def button_confirm(self): - if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan - if '/PJ/' in self.name: - price_change_detected = any(line.price_unit_before for line in self.order_line) - if price_change_detected: - if self.order_sales_match_line: - if self.total_percent_margin <= 15.0: - raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + # if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan + # if '/PJ/' in self.name: + # price_change_detected = any(line.price_unit_before for line in self.order_line) + # if price_change_detected: + # if self.order_sales_match_line: + # if self.total_percent_margin <= 15.0: + # raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") self._check_assets_note() # self._check_payment_term() # check payment term -- cgit v1.2.3