diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-23 09:13:53 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-23 09:13:53 +0700 |
| commit | 25645d93db289ea4855486630dba8d578efb2851 (patch) | |
| tree | adb8e0ee283c0f8f6960e7bbc030cdf58d39ae08 | |
| parent | bd02dbfcfef14c016eec14811f9f257790e6e321 (diff) | |
cr due extension
| -rw-r--r-- | indoteknik_custom/models/account_move_due_extension.py | 7 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move_views.xml | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/indoteknik_custom/models/account_move_due_extension.py b/indoteknik_custom/models/account_move_due_extension.py index 23f8888c..6fc58cdd 100644 --- a/indoteknik_custom/models/account_move_due_extension.py +++ b/indoteknik_custom/models/account_move_due_extension.py @@ -1,6 +1,6 @@ from odoo import models, api, fields from odoo.exceptions import AccessError, UserError, ValidationError -from datetime import timedelta, date +from datetime import timedelta, date, datetime import logging _logger = logging.getLogger(__name__) @@ -31,7 +31,8 @@ class DueExtension(models.Model): ('21', '21 Hari'), ], string='Day Extension', help='Menambah Due Date yang sudah limit dari hari ini', tracking=True) counter = fields.Integer(string="Counter", compute='_compute_counter') - + approve_by = fields.Many2one('res.users', string="Approve By", readonly=True) + date_approve = fields.Datetime(string="Date Approve", readonly=True) def _compute_counter(self): for due in self: due.counter = due.partner_id.counter @@ -96,6 +97,8 @@ class DueExtension(models.Model): sales.action_confirm() self.order_id.due_id = self.id + self.approve_by = self.env.user.id + self.date_approve = datetime.utcnow() template = self.env.ref('indoteknik_custom.mail_template_due_extension_approve') template.send_mail(self.id, force_send=True) diff --git a/indoteknik_custom/views/account_move_views.xml b/indoteknik_custom/views/account_move_views.xml index f7b753bd..da25636e 100644 --- a/indoteknik_custom/views/account_move_views.xml +++ b/indoteknik_custom/views/account_move_views.xml @@ -12,6 +12,8 @@ <field name="description"/> <field name="approval_status"/> <field name="is_approve"/> + <field name="approve_by" optional="hide"/> + <field name="date_approve" optional="hide"/> <field name="create_uid" optional="hide"/> <field name="create_date" optional="hide"/> </tree> @@ -60,12 +62,14 @@ <group> <field name="partner_id" readonly="1"/> <field name="day_extension" attrs="{'readonly': [('is_approve', '=', True)]}"/> + <field name="order_id" readonly="1"/> </group> <group> <field name="is_approve" readonly="1"/> - <field name="order_id" readonly="1"/> <field name="counter" readonly="1"/> <field name="approval_status" readonly="1"/> + <field name="approve_by" readonly="1"/> + <field name="date_approve" readonly="1"/> </group> </group> <group> |
