summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2026-02-10 15:42:21 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2026-02-10 15:42:21 +0700
commit2def9515d57eb3128cad31c8b97901055e4e0523 (patch)
tree23bb37c978095b04589384daa7706564b8f45e0d
parentb04fb88af7e868a32af5ffbe4b5f5e97a5da4878 (diff)
<MIqdad> fix approval flow stock inventory
-rw-r--r--indoteknik_custom/models/stock_inventory.py13
-rw-r--r--indoteknik_custom/views/stock_inventory.xml1
2 files changed, 6 insertions, 8 deletions
diff --git a/indoteknik_custom/models/stock_inventory.py b/indoteknik_custom/models/stock_inventory.py
index c4ebaeda..cb7d3773 100644
--- a/indoteknik_custom/models/stock_inventory.py
+++ b/indoteknik_custom/models/stock_inventory.py
@@ -17,11 +17,10 @@ class StockInventory(models.Model):
('out', 'Adjusment Out'),
], string='Adjusments Type', required=True)
approval_state = fields.Selection([
- ('draft', 'Draft'),
('logistic', 'Logistic'),
('accounting', 'Accounting'),
('approved', 'Approved'),
- ], default='draft', tracking=True)
+ ], default='logistic', tracking=True)
def _generate_number_stock_inventory(self):
"""Men-generate nomor untuk semua stock inventory yang belum memiliki number."""
@@ -82,16 +81,14 @@ class StockInventory(models.Model):
def action_approve(self):
if self.adjusment_type == 'out':
for rec in self:
- if self.approval_state in [False, '', 'draft']:
- self.approval_state = 'logistic'
- elif self.approval_state == 'logistic':
+ if rec.approval_state == 'logistic':
if not rec.env.user.has_group('indoteknik_custom.group_role_logistic'):
raise UserError("Harus diapprove logistic")
- self.approval_state = 'accounting'
- elif self.approval_state == 'accounting':
+ rec.approval_state = 'accounting'
+ elif rec.approval_state == 'accounting':
if not rec.env.user.has_group('indoteknik_custom.group_role_fat'):
raise UserError("Harus diapprove accounting")
- self.approval_state = 'approved'
+ rec.approval_state = 'approved'
else:
raise UserError("Sudah Approved")
diff --git a/indoteknik_custom/views/stock_inventory.xml b/indoteknik_custom/views/stock_inventory.xml
index df747830..89c058ea 100644
--- a/indoteknik_custom/views/stock_inventory.xml
+++ b/indoteknik_custom/views/stock_inventory.xml
@@ -26,6 +26,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='date']" position="after">
<field name="number"/>
+ <field name="approval_state"/>
</xpath>
</field>
</record>