summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2022-11-02 09:43:08 +0700
committerIT Fixcomart <it@fixcomart.co.id>2022-11-02 09:43:08 +0700
commit625f48b6a44e32a4881ed61c53ecf1f8a6b3ca87 (patch)
treec932a29d33d4ee39d6ef40d0f372e7e49a43ed9c
parent6fdaee1c7b6557dc2e61ac7b5c1172d285ea7421 (diff)
Picking code will generate on validate (stock.picking)
-rw-r--r--indoteknik_custom/models/stock_picking.py6
-rw-r--r--indoteknik_custom/views/stock_picking.xml3
2 files changed, 5 insertions, 4 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index c1a3f12d..d70cfc4d 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -97,6 +97,9 @@ class StockPicking(models.Model):
return
def button_validate(self):
+ if not self.picking_code:
+ self.picking_code = self.env['ir.sequence'].next_by_code('stock.picking.code') or '0'
+
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'))
if self.is_internal_use and not self.env.user.is_accounting:
@@ -106,9 +109,6 @@ class StockPicking(models.Model):
@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)
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index 3b150f34..d53bf5b5 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -65,7 +65,8 @@
<field name="driver_arrival_date"/>
<field name="delivery_tracking_no"/>
<field name="driver_id"/>
- <field name="picking_code"/>
+ <field name="picking_code" attrs="{'invisible': [['picking_code', '=', False]]}"/>
+ <field name="picking_code" string="Picking code (akan digenerate ketika sudah di-validate)" attrs="{'invisible': [['picking_code', '!=', False]]}"/>
</group>
</group>
</page>