diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-14 16:12:14 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-14 16:12:14 +0700 |
| commit | d47eb069978ce67bce1a19b6c824a53ca3d68801 (patch) | |
| tree | 2427f680d68c8b136531d392eb36cf4262c7d35b /indoteknik_custom/models/stock_picking.py | |
| parent | 2513b765773fca587dbd298e77732d2d005949c8 (diff) | |
| parent | d4df708e5195e1c0c3b8e0ad90b7518e5d4d48c2 (diff) | |
<iman> Merge branch 'production' of https://bitbucket.org/altafixco/indoteknik-addons into feature/tracking-order
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index c151a543..5029a770 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -26,7 +26,10 @@ class StockPicking(models.Model): # Delivery Order driver_departure_date = fields.Datetime( string='Driver Departure Date', - readonly=True, + copy=False + ) + arrival_time = fields.Datetime( + string='Jam Kedatangan', copy=False ) driver_arrival_date = fields.Datetime( @@ -91,6 +94,21 @@ class StockPicking(models.Model): date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) sale_order = fields.Char(string='Matches SO', copy=False) printed_sj = fields.Boolean('Printed Surat Jalan', help='flag which is internal use or not') + invoice_status = fields.Selection([ + ('upselling', 'Upselling Opportunity'), + ('invoiced', 'Fully Invoiced'), + ('to invoice', 'To Invoice'), + ('no', 'Nothing to Invoice') + ], string='Invoice Status', related="sale_id.invoice_status") + + @api.constrains('driver_departure_date') + def constrains_driver_departure_date(self): + self.date_doc_kirim = self.driver_departure_date + + @api.constrains('arrival_time') + def constrains_arrival_time(self): + if self.arrival_time > datetime.datetime.utcnow(): + raise UserError('Jam kedatangan harus kurang dari Effective Date') def reset_status_printed(self): for rec in self: @@ -341,6 +359,9 @@ class StockPicking(models.Model): if not self.picking_code: self.picking_code = self.env['ir.sequence'].next_by_code('stock.picking.code') or '0' + if not self.arrival_time and 'BU/IN/' in self.name: + raise UserError('Jam Kedatangan harus diisi') + if self.picking_type_id.code == 'incoming' and self.group_id.id == False and self.is_internal_use == False: raise UserError(_('Tidak bisa Validate jika tidak dari Document SO / PO')) @@ -372,6 +393,7 @@ class StockPicking(models.Model): res = super(StockPicking, self).button_validate() self.calculate_line_no() + self.date_done = datetime.datetime.utcnow() return res @api.model |
