diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-05-16 08:55:53 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-05-16 08:55:53 +0700 |
| commit | 24c52892c3143dc2474e5a2ba3c99d08ee1f7d29 (patch) | |
| tree | c4d3444465e78718bf249223dd407bdd2da5af64 | |
| parent | caa3b18640a1cffb80677701da5598f42a795a7d (diff) | |
(andri) add field date hold/unhold SO
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 11 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 0d4fc6c3..0ae61914 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -4,6 +4,7 @@ from odoo import fields, models, api, _ from odoo.exceptions import UserError, ValidationError from datetime import datetime, timedelta import logging, random, string, requests, math, json, re, qrcode, base64 +import pytz from io import BytesIO from collections import defaultdict @@ -302,6 +303,12 @@ class SaleOrder(models.Model): ('hold', 'Hold'), ('approve', 'Approve') ], tracking=True, string='State Cancel', copy=False) + hold_outgoing_datetime = fields.Datetime( + string='Date Hold/Unhold', + tracking=True, + readonly=True, + help='Waktu terakhir ketika status Hold Outgoing SO berubah' + ) def _compute_total_margin_excl_third_party(self): for order in self: @@ -340,11 +347,13 @@ class SaleOrder(models.Model): } } - def hold_unhold_qty_outgoing_so(self): + def hold_unhold_qty_outgoing_so(self): if self.hold_outgoing == True: self.hold_outgoing = False else: self.hold_outgoing = True + + self.hold_outgoing_datetime = fields.Datetime.now() def _validate_uniform_taxes(self): for order in self: diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index e0085eeb..e57aeabb 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -94,6 +94,7 @@ </field> <field name="user_id" position="after"> <field name="hold_outgoing" readonly="1" /> + <field name="hold_outgoing_datetime" readonly="1" widget="datetime" /> <field name="helper_by_id" readonly="1" /> <field name="compute_fullfillment" invisible="1" /> </field> @@ -402,6 +403,7 @@ <field name="pareto_status" optional="hide" /> <field name="shipping_method_picking" optional="hide" /> <field name="hold_outgoing" optional="hide" /> + <field name="hold_outgoing_datetime" optional="show" /> </field> </field> </record> |
