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 ++ indoteknik_custom/views/product_product.xml | 1 + indoteknik_custom/views/product_template.xml | 3 +++ 5 files changed, 13 insertions(+), 4 deletions(-) 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, diff --git a/indoteknik_custom/views/product_product.xml b/indoteknik_custom/views/product_product.xml index 1d04e708..e8a7380b 100644 --- a/indoteknik_custom/views/product_product.xml +++ b/indoteknik_custom/views/product_product.xml @@ -20,6 +20,7 @@ + diff --git a/indoteknik_custom/views/product_template.xml b/indoteknik_custom/views/product_template.xml index 1933a5d1..9fbf007a 100755 --- a/indoteknik_custom/views/product_template.xml +++ b/indoteknik_custom/views/product_template.xml @@ -78,6 +78,7 @@ + @@ -114,6 +115,7 @@ + @@ -127,6 +129,7 @@ + -- 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(-) 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 ++++++++++++++++++++++ indoteknik_custom/security/ir.model.access.csv | 1 + .../views/advance_payment_request.xml | 35 ++++++++++++++++ 3 files changed, 82 insertions(+) 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): diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index bc8dc2a4..d501de1a 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -199,6 +199,7 @@ access_advance_payment_settlement,access.advance.payment.settlement,model_advanc access_advance_payment_usage_line,access.advance.payment.usage.line,model_advance_payment_usage_line,,1,1,1,1 access_advance_payment_create_bill,access.advance.payment.create.bill,model_advance_payment_create_bill,,1,1,1,1 access_create_reimburse_cab_wizard_user,create.reimburse.cab.wizard user,model_create_reimburse_cab_wizard,,1,1,1,1 +access_advance_payment_cancel_wizard,advance.payment.cancel.wizard,model_advance_payment_cancel_wizard,,1,1,1,1 access_purchasing_job_seen,purchasing.job.seen,model_purchasing_job_seen,,1,1,1,1 access_tukar_guling_all_users,tukar.guling.all.users,model_tukar_guling,base.group_user,1,1,1,1 diff --git a/indoteknik_custom/views/advance_payment_request.xml b/indoteknik_custom/views/advance_payment_request.xml index dd6370c7..5abcf996 100644 --- a/indoteknik_custom/views/advance_payment_request.xml +++ b/indoteknik_custom/views/advance_payment_request.xml @@ -44,6 +44,11 @@ ('is_cab_visible', '=', True), ('type_request', '!=', 'reimburse') ]}"/> +