summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-10-09 15:05:17 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-10-09 15:05:17 +0700
commit48e5f880d0587964c15c88827ba21cf932928a44 (patch)
tree47dcd1f6fa4316e4b2dbec65dbee59967f1f21fc
parenta48ae105c865e710227e12b666fa601a326d12a7 (diff)
add field date_completed on account_move and sort default_order by date_order asc
-rw-r--r--indoteknik_custom/models/account_move.py6
-rw-r--r--indoteknik_custom/views/account_move.xml5
-rwxr-xr-xindoteknik_custom/views/sale_monitoring.xml2
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 @@
<field name="invoice_date" position="after">
<field name="payment_schedule" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}"/>
</field>
+ <field name="payment_reference" position="after">
+ <field name="date_completed" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/>
+ </field>
<field name="efaktur_document" position="before">
<field name="no_faktur_pajak" readonly="1"/>
</field>
@@ -28,7 +31,7 @@
<field name="counter"/>
</field>
<notebook position="inside">
- <page string="Due Extension">
+ <page string="Due Extension" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}">
<field name="due_line">
<tree>
<field name="due_id"/>
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 @@
<field name="name">sale.monitoring.tree</field>
<field name="model">sale.monitoring</field>
<field name="arch" type="xml">
- <tree create="false" multi_edit="1">
+ <tree create="false" multi_edit="1" default_order="date_order asc">
<header>
<button name="action_refresh" string="Refresh" class="oe_highlight" type="object" />
</header>