From fcefddc96acc561ec13d52e734eaf04b041d4a0b Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 13 Jan 2025 11:24:08 +0700 Subject: update export xml by selected invoice --- indoteknik_custom/models/account_move.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 725b3c2d..42678847 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -325,3 +325,35 @@ 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 + inv.move_type == 'out_invoice') + + invalid_invoices = self - invoices + if invalid_invoices: + invalid_ids = ", ".join(str(inv.id) for inv in invalid_invoices) + raise UserError(_( + "Faktur dengan ID berikut tidak valid untuk diekspor: {}.\n" + "Pastikan faktur dalam status 'posted', belum diekspor, dan merupakan 'out_invoice'.".format(invalid_ids) + )) + + return invoices + + def export_faktur_to_xml(self): + + valid_invoices = self.validate_faktur_for_export() + + # Panggil model coretax.faktur untuk menghasilkan XML + coretax_faktur = self.env['coretax.faktur'].create({}) + response = coretax_faktur.export_to_download(invoices=valid_invoices) + + current_time = datetime.utcnow() + # Tandai faktur sebagai sudah diekspor + valid_invoices.write({ + 'is_efaktur_exported': True, + 'date_efaktur_exported': current_time, # Set tanggal ekspor + }) + + return response -- cgit v1.2.3 From 41da8b32edee0dc394bb69ac179833388e977053 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 13 Jan 2025 15:34:13 +0700 Subject: if unlock PO harus approv finance & if not FAT cannot edit jurnal entris --- indoteknik_custom/models/account_move.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 725b3c2d..022a7f5f 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -318,6 +318,11 @@ 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') + def write(self, vals): + if not self.env.user.is_accounting: + raise UserError("Hanya IT FAT yang bisa ubah data") + return super(AccountMove, self).write(vals) + # def write(self, vals): # res = super(AccountMove, self).write(vals) # for rec in self.line_ids: -- cgit v1.2.3 From ecc4356b7ac5ae14d4e86039589716fa76161230 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 13 Jan 2025 15:59:21 +0700 Subject: ubah code --- indoteknik_custom/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 58f142dc..e681d96e 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -320,7 +320,7 @@ class AccountMove(models.Model): def write(self, vals): if not self.env.user.is_accounting: - raise UserError("Hanya IT FAT yang bisa ubah data") + raise UserError("Hanya Finence yang bisa ubah data") return super(AccountMove, self).write(vals) # def write(self, vals): -- cgit v1.2.3 From a5522dfd19488f2b76ad40d3ba9750852f92da73 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 15 Jan 2025 09:25:26 +0700 Subject: fix bug --- indoteknik_custom/models/account_move.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index e681d96e..2810c594 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -253,6 +253,11 @@ class AccountMove(models.Model): line.date_maturity = entry.date return res + def button_draft(self): + res = super(AccountMove, self).button_draft() + 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: @@ -318,11 +323,6 @@ 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') - def write(self, vals): - if not self.env.user.is_accounting: - raise UserError("Hanya Finence yang bisa ubah data") - return super(AccountMove, self).write(vals) - # def write(self, vals): # res = super(AccountMove, self).write(vals) # for rec in self.line_ids: -- cgit v1.2.3 From e4ec9406cd0903db59cfed34781da55a2dba4ca3 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 15 Jan 2025 15:03:42 +0700 Subject: update code --- indoteknik_custom/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 2810c594..66726c8d 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -339,7 +339,7 @@ class AccountMove(models.Model): invalid_invoices = self - invoices if invalid_invoices: invalid_ids = ", ".join(str(inv.id) for inv in invalid_invoices) - raise UserError(_( + raise UserError(( "Faktur dengan ID berikut tidak valid untuk diekspor: {}.\n" "Pastikan faktur dalam status 'posted', belum diekspor, dan merupakan 'out_invoice'.".format(invalid_ids) )) -- cgit v1.2.3 From 27f333cc14b8673b3c46e1969736d2fb60d9924f Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 16 Jan 2025 10:26:39 +0700 Subject: add other subtotal and cr apo --- indoteknik_custom/models/account_move.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 66726c8d..4553e446 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -62,6 +62,11 @@ class AccountMove(models.Model): so_delivery_amt = fields.Char(string="SO Delivery Amount", compute='compute_so_shipping_paid_by') flag_delivery_amt = fields.Boolean(string="Flag Delivery Amount", compute='compute_flag_delivery_amt') nomor_kwitansi = fields.Char(string="Nomor Kwitansi") + other_subtotal = fields.Float(string="Other Subtotal", compute='compute_other_subtotal') + + def compute_other_subtotal(self): + for rec in self: + rec.other_subtotal = rec.amount_untaxed * (11 / 12) @api.model def generate_attachment(self, record): -- cgit v1.2.3 From d1036cd456a53435be10f96714d9c93625cfe793 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Thu, 16 Jan 2025 16:05:28 +0700 Subject: delete validate export xml --- indoteknik_custom/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 4553e446..d62f19ae 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -353,7 +353,7 @@ class AccountMove(models.Model): def export_faktur_to_xml(self): - valid_invoices = self.validate_faktur_for_export() + valid_invoices = self # Panggil model coretax.faktur untuk menghasilkan XML coretax_faktur = self.env['coretax.faktur'].create({}) -- cgit v1.2.3 From d406e0cc949f8f35631d872993850f3ccec0821d Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 20 Jan 2025 16:03:00 +0700 Subject: add other taxes in account move --- indoteknik_custom/models/account_move.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index d62f19ae..85ed1d54 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -63,6 +63,11 @@ class AccountMove(models.Model): flag_delivery_amt = fields.Boolean(string="Flag Delivery Amount", compute='compute_flag_delivery_amt') nomor_kwitansi = fields.Char(string="Nomor Kwitansi") other_subtotal = fields.Float(string="Other Subtotal", compute='compute_other_subtotal') + other_taxes = fields.Float(string="Other Taxes", compute='compute_other_taxes') + + def compute_other_taxes(self): + for rec in self: + rec.other_taxes = rec.other_subtotal * 0.12 def compute_other_subtotal(self): for rec in self: -- cgit v1.2.3