summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/account_move.py
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-05-07 13:53:25 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-05-07 13:53:25 +0700
commitb4ffa966359dc841e491d126d4a5744e2c195063 (patch)
tree163255ea8e851b555ff51617372a97e7b18d0f0e /indoteknik_custom/models/account_move.py
parent2b6733ba60c60fe750fdc6e8d2918937fb677e5b (diff)
parent71a780abc391d11c2fe2ea16a953eefd2ff74219 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into feat_voucher_category
Diffstat (limited to 'indoteknik_custom/models/account_move.py')
-rw-r--r--indoteknik_custom/models/account_move.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 906985de..30de67be 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -66,6 +66,19 @@ class AccountMove(models.Model):
other_taxes = fields.Float(string="Other Taxes", compute='compute_other_taxes')
is_hr = fields.Boolean(string="Is HR?", default=False)
purchase_order_id = fields.Many2one('purchase.order', string='Purchase Order')
+ length_of_payment = fields.Integer(string="Length of Payment", compute='compute_length_of_payment')
+
+ def compute_length_of_payment(self):
+ for rec in self:
+ 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
+ else:
+ rec.length_of_payment = 0
def _update_line_name_from_ref(self):
"""Update all account.move.line name fields with ref from account.move"""