summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-11-15 10:32:25 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-11-15 10:32:25 +0700
commit132d4b80f3d5dad792468bd14961f6a9540122e2 (patch)
tree3fad75ed79dac19785a9a642fb5dae7b255defdf
parenta1d0f8c14308655b5c1f532927e093569c654216 (diff)
add new role for wms and fix bug delete reconcile
-rw-r--r--indoteknik_api/controllers/api_v1/user.py10
-rw-r--r--indoteknik_custom/models/account_move.py5
-rw-r--r--indoteknik_custom/models/users.py2
-rw-r--r--indoteknik_custom/views/users.xml2
4 files changed, 16 insertions, 3 deletions
diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py
index 7a522d0c..2b297e5d 100644
--- a/indoteknik_api/controllers/api_v1/user.py
+++ b/indoteknik_api/controllers/api_v1/user.py
@@ -42,9 +42,17 @@ class User(controller.Controller):
uid = request.session.authenticate(
config.get('db_name'), email, password)
user = request.env['res.users'].browse(uid)
+ role = []
+ if user.is_inbound and user.is_outbound:
+ role.append('admin')
+ elif user.is_outbound:
+ role.append('outbound')
+ elif user.is_inbound:
+ role.append('inbound')
data = {
'is_auth': True,
- 'user': self.response_with_token(user)
+ 'role': role,
+ 'user': self.response_with_token(user),
}
return self.response(data)
except:
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index fe9db583..d55cca38 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -48,8 +48,9 @@ class AccountMove(models.Model):
def unlink(self):
res = super(AccountMove, self).unlink()
- if self.state == 'posted':
- raise UserError('Data Hanya Bisa Di Cancel')
+ for rec in self:
+ if rec.state == 'posted':
+ raise UserError('Data Hanya Bisa Di Cancel')
return res
def button_cancel(self):
diff --git a/indoteknik_custom/models/users.py b/indoteknik_custom/models/users.py
index 2ff9933e..d95b56e7 100644
--- a/indoteknik_custom/models/users.py
+++ b/indoteknik_custom/models/users.py
@@ -12,6 +12,8 @@ class Users(models.Model):
is_logistic_approver = fields.Boolean(string='Logistic Approver', help='Berhak Approval Penerimaan Barang')
is_editor_product = fields.Boolean(string='Editor Product', help='Berhak Mengedit Data Product')
is_admin_reconcile = fields.Boolean(string='Admin Reconcile', help='Berhak Mengedit Journal Reconcile')
+ is_inbound = fields.Boolean(string='Operator Inbound')
+ is_outbound = fields.Boolean(string='Operator Outbound')
def notify_internal_users(self, message, title):
users = self.search([('share', '=', False)])
diff --git a/indoteknik_custom/views/users.xml b/indoteknik_custom/views/users.xml
index 020d8ddc..6519aeaa 100644
--- a/indoteknik_custom/views/users.xml
+++ b/indoteknik_custom/views/users.xml
@@ -14,6 +14,8 @@
<field name="is_logistic_approver"/>
<field name="is_editor_product"/>
<field name="is_admin_reconcile"/>
+ <field name="is_outbound"/>
+ <field name="is_inbound"/>
</field>
</field>
</record>