summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/account_move.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-02-07 10:45:51 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-02-07 10:45:51 +0700
commitf6be42d37a363b86f4a9ec71ccb38c78cbe2d887 (patch)
tree9c297e776f67e35671012e94d3c64007bd5090d7 /indoteknik_custom/models/account_move.py
parentedb3c1c80931078d40a8f56149aeca9efdcdc07d (diff)
parent29a9ec94f1ad131f398cf119a03a7b927a4c6cba (diff)
Merge branch 'production' into purchasing-job
# Conflicts: # indoteknik_custom/__manifest__.py # indoteknik_custom/models/__init__.py # indoteknik_custom/models/automatic_purchase.py # indoteknik_custom/models/purchase_order_line.py # indoteknik_custom/security/ir.model.access.csv # indoteknik_custom/views/automatic_purchase.xml # indoteknik_custom/views/purchase_order.xml
Diffstat (limited to 'indoteknik_custom/models/account_move.py')
-rw-r--r--indoteknik_custom/models/account_move.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 82a86a39..a9db212f 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -35,6 +35,34 @@ class AccountMove(models.Model):
('belum_upload', 'Belum Upload FP'),
('sudah_upload', 'Sudah Upload FP'),
], 'Mark Upload Faktur', compute='_compute_mark_upload_efaktur', default='belum_upload')
+ sale_id = fields.Many2one('sale.order', string='Sale Order')
+ reklas_id = fields.Many2one('account.move', string='Nomor CAB', domain="[('partner_id', '=', partner_id)]")
+ new_invoice_day_to_due = fields.Integer(string="New Day Due", compute="_compute_invoice_day_to_due")
+ date_efaktur_upload = fields.Datetime(string='eFaktur Upload Date', tracking=True)
+
+ @api.constrains('efaktur_document')
+ def _constrains_date_efaktur(self):
+ for move in self:
+ current_time = datetime.utcnow()
+ move.date_efaktur_upload = current_time
+
+ def open_form_multi_create_reklas_penjualan(self):
+ action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_view_invoice_reklas_penjualan')
+ invoice = self.env['invoice.reklas.penjualan'].create([{
+ 'name': '-',
+ }])
+ for move in self:
+ sale_id = move.sale_id.id
+ self.env['invoice.reklas.penjualan.line'].create([{
+ 'invoice_reklas_id': invoice.id,
+ 'name': move.name,
+ 'partner_id': move.partner_id.id,
+ 'sale_id': move.sale_id.id,
+ 'amount_untaxed_signed': move.amount_untaxed_signed,
+ 'amount_total_signed': move.amount_total_signed,
+ }])
+ action['res_id'] = invoice.id
+ return action
def _compute_mark_upload_efaktur(self):
for move in self:
@@ -112,12 +140,16 @@ class AccountMove(models.Model):
def _compute_invoice_day_to_due(self):
for invoice in self:
invoice_day_to_due = 0
+ new_invoice_day_to_due = 0
if invoice.payment_state not in ['paid', 'in_payment', 'reversed'] and invoice.invoice_date_due:
invoice_day_to_due = invoice.invoice_date_due - date.today()
+ new_invoice_day_to_due = invoice.invoice_date_due - date.today()
if invoice.new_due_date:
invoice_day_to_due = invoice.new_due_date - date.today()
invoice_day_to_due = invoice_day_to_due.days
+ 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: