From 48e5f880d0587964c15c88827ba21cf932928a44 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 9 Oct 2023 15:05:17 +0700 Subject: add field date_completed on account_move and sort default_order by date_order asc --- indoteknik_custom/models/account_move.py | 6 +++++- indoteknik_custom/views/account_move.xml | 5 ++++- indoteknik_custom/views/sale_monitoring.xml | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index c3cd7ef9..207ccee1 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -1,6 +1,7 @@ from odoo import models, api, fields from odoo.exceptions import AccessError, UserError, ValidationError -from datetime import timedelta, date +from datetime import timedelta, date, datetime +from pytz import timezone, utc import logging import base64 import PyPDF2 @@ -28,6 +29,7 @@ class AccountMove(models.Model): analytic_account_ids = fields.Many2many('account.analytic.account', string='Analytic Account') due_line = fields.One2many('due.extension.line', 'invoice_id', compute='_compute_due_line', string='Due Extension Lines') no_faktur_pajak = fields.Char(string='No Faktur Pajak') + date_completed = fields.Datetime(string='Date Completed') @api.onchange('efaktur_id') def change_efaktur_id(self): @@ -90,8 +92,10 @@ 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() for line in entry.line_ids: line.date_maturity = entry.date + return res def _compute_invoice_day_to_due(self): diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index c45dab25..2aeffc83 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -13,6 +13,9 @@ + + + @@ -28,7 +31,7 @@ - + diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml index 641eb8fb..5824af6a 100755 --- a/indoteknik_custom/views/sale_monitoring.xml +++ b/indoteknik_custom/views/sale_monitoring.xml @@ -4,7 +4,7 @@ sale.monitoring.tree sale.monitoring - +
-- cgit v1.2.3