summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/stock_picking.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2022-09-19 11:07:17 +0700
committerIT Fixcomart <it@fixcomart.co.id>2022-09-19 11:07:17 +0700
commitde08a79ca870602ec45f396a8476cfdc3c38aee6 (patch)
treeb92fb1affefe2579a87edd195fe34f2d8c1ca50d /indoteknik_custom/models/stock_picking.py
parent68cb8eaa625b9c96de7aeb9fc45c1db81921661e (diff)
parentb1c1914eafc652711633f6f11b096a2013cad7e2 (diff)
Merge & fix conflicts
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
-rw-r--r--indoteknik_custom/models/stock_picking.py58
1 files changed, 55 insertions, 3 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 3c39e769..a0b7c15e 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -6,10 +6,37 @@ class StockPicking(models.Model):
_inherit = 'stock.picking'
is_internal_use = fields.Boolean('Internal Use', help='flag which is internal use or not')
account_id = fields.Many2one('account.account', string='Account')
+ efaktur_id = fields.Many2one('vit.efaktur', string='Faktur Pajak')
+ is_efaktur_exported = fields.Boolean(string='Is eFaktur Exported')
+ date_efaktur_exported = fields.Datetime(string='eFaktur Exported Date')
- # efaktur_id = fields.Many2one('vit.efaktur', string='Faktur Pajak')
- # is_efaktur_exported = fields.Boolean(string='Is eFaktur Exported')
- # date_efaktur_exported = fields.Datetime(string='eFaktur Exported Date')
+ # Delivery Order
+ driver_departure_date = fields.Datetime(
+ string='Driver Departure Date',
+ readonly=True,
+ copy=False
+ )
+ driver_arrival_date = fields.Datetime(
+ string='Driver Arrival Date',
+ readonly=True,
+ copy=False
+ )
+ delivery_tracking_no = fields.Char(
+ string='Delivery Tracking Number',
+ readonly=True,
+ copy=False
+ )
+ driver_id = fields.Many2one(
+ comodel_name='res.users',
+ string='Driver',
+ readonly=True,
+ copy=False
+ )
+ picking_code = fields.Char(
+ string="Picking Code",
+ readonly=True,
+ copy=False
+ )
@api.onchange('picking_type_id')
def _onchange_operation_type(self):
@@ -21,3 +48,28 @@ class StockPicking(models.Model):
raise UserError(_('Tidak bisa Validate jika tidak dari Document SO / PO'))
res = super(StockPicking, self).button_validate()
return res
+
+ @api.model
+ def create(self, vals):
+ if not self.picking_code:
+ vals['picking_code'] = self.env['ir.sequence'].next_by_code('stock.picking.code') or '0'
+
+ self._use_faktur(vals)
+ return super(StockPicking, self).create(vals)
+
+ def write(self, vals):
+ self._use_faktur(vals)
+ return super(StockPicking, self).write(vals)
+
+ def _use_faktur(self, vals):
+ if vals.get('efaktur_id', False):
+ self.env['vit.efaktur'].search(
+ [
+ ('id', '=', vals['efaktur_id'])
+ ],
+ limit=1
+ ).is_used = True
+
+ if self.efaktur_id.id != vals['efaktur_id']:
+ self.efaktur_id.is_used = False
+ return True