summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/__init__.py3
-rw-r--r--indoteknik_custom/models/account_bank_statement.py19
-rw-r--r--indoteknik_custom/models/account_move.py12
-rw-r--r--indoteknik_custom/models/users.py1
4 files changed, 33 insertions, 2 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 1133c3e7..23a7331c 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -89,4 +89,5 @@ from . import stock_scheduler_compute
from . import promotion
from . import sale_orders_multi_update
from . import quotation_so_multi_update
-from . import product_monitoring \ No newline at end of file
+from . import product_monitoring
+from . import account_bank_statement \ No newline at end of file
diff --git a/indoteknik_custom/models/account_bank_statement.py b/indoteknik_custom/models/account_bank_statement.py
new file mode 100644
index 00000000..495367e8
--- /dev/null
+++ b/indoteknik_custom/models/account_bank_statement.py
@@ -0,0 +1,19 @@
+from odoo import fields, models, api, _
+from odoo.exceptions import AccessError, UserError, ValidationError
+
+class AccountBankStatement(models.Model):
+ _inherit = "account.bank.statement"
+
+ is_edit = fields.Boolean(string='Edit', default=False)
+
+ def is_edited(self):
+ if not self.env.user.is_admin_reconcile:
+ raise UserError('Yang berhak hanya Mba Tania')
+
+ self.is_edit = True
+
+ def not_edited(self):
+ if not self.env.user.is_admin_reconcile:
+ raise UserError('Yang berhak hanya Mba Tania')
+
+ self.is_edit = False \ No newline at end of file
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index a85e8caa..c55e2e1b 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -62,6 +62,10 @@ class AccountMove(models.Model):
res = super(AccountMove, self).button_draft()
if not self.env.user.is_accounting:
raise UserError('Hanya Accounting yang bisa Reset to Draft')
+
+ if self.write_date != self.create_date:
+ if self.statement_line_id and not self.statement_line_id.statement_id.is_edit and self.statement_line_id.statement_id.state == 'confirm':
+ raise UserError('Bank Statement di Lock, Minta admin reconcile untuk unlock')
return res
def action_post(self):
@@ -145,4 +149,10 @@ class AccountMove(models.Model):
'move_ids': [x.id for x in self]
}
return action
- \ No newline at end of file
+
+ def write(self, vals):
+ res = super(AccountMove, self).write(vals)
+ if self.write_date != self.create_date:
+ if self.statement_line_id and not self.statement_line_id.statement_id.is_edit and self.statement_line_id.statement_id.state == 'confirm':
+ raise UserError('Bank Statement di Lock, Minta admin reconcile untuk unlock')
+ return res
diff --git a/indoteknik_custom/models/users.py b/indoteknik_custom/models/users.py
index b90c0097..2ff9933e 100644
--- a/indoteknik_custom/models/users.py
+++ b/indoteknik_custom/models/users.py
@@ -11,6 +11,7 @@ class Users(models.Model):
is_accounting = fields.Boolean(string='Accounting', help='Berhak Approval Internal Use')
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')
def notify_internal_users(self, message, title):
users = self.search([('share', '=', False)])