diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-11-06 08:50:31 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-11-06 08:50:31 +0700 |
| commit | b3e90d317b993b23c549fc985231a59df9f8c352 (patch) | |
| tree | 4d272d80e930a735248a35a63594d88092c47952 | |
| parent | efa51f6b1c5254996db90a90468241da303a7e21 (diff) | |
| parent | f8fcf079afbe107ed8bda3e6e832b58786d2a42a (diff) | |
Merge branch 'production' into commision-window
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 1 | ||||
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/account_bank_statement.py | 19 | ||||
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 14 | ||||
| -rw-r--r-- | indoteknik_custom/models/users.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_bank_statement.xml | 31 | ||||
| -rw-r--r-- | indoteknik_custom/views/users.xml | 1 |
7 files changed, 67 insertions, 1 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index a758d636..bab86aab 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -99,6 +99,7 @@ 'views/quotation_so_multi_update.xml', 'views/stock_move_line.xml', 'views/product_monitoring.xml', + 'views/account_bank_statement.xml', 'views/stock_warehouse_orderpoint.xml', 'views/customer_commision.xml', 'report/report.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index e842b511..35f06f03 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -90,5 +90,6 @@ from . import promotion from . import sale_orders_multi_update from . import quotation_so_multi_update from . import product_monitoring +from . import account_bank_statement from . import stock_warehouse_orderpoint from . import commision diff --git a/indoteknik_custom/models/account_bank_statement.py b/indoteknik_custom/models/account_bank_statement.py new file mode 100644 index 00000000..23008f13 --- /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='Unlock', default=False) + + def is_edited(self): + if not self.env.user.is_admin_reconcile: + raise UserError('Yang berhak hanya Mba Tania dan Iqmal Saputra') + + self.is_edit = True + + def not_edited(self): + if not self.env.user.is_admin_reconcile: + raise UserError('Yang berhak hanya Mba Tania dan Iqmal Saputra') + + 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..ee4279b2 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -62,6 +62,11 @@ 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') + + for rec in self: + if rec.write_date != rec.create_date: + if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.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 +150,11 @@ 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) + for rec in self: + if rec.write_date != rec.create_date: + if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.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)]) diff --git a/indoteknik_custom/views/account_bank_statement.xml b/indoteknik_custom/views/account_bank_statement.xml new file mode 100644 index 00000000..db380f37 --- /dev/null +++ b/indoteknik_custom/views/account_bank_statement.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<odoo> + <data> + <record id="account_bank_statement_tree_inherit" model="ir.ui.view"> + <field name="name">account.bank.statement.tree</field> + <field name="model">account.bank.statement</field> + <field name="inherit_id" ref="account.view_bank_statement_tree"/> + <field name="arch" type="xml"> + <field name="state" position="after"> + <field name="is_edit"/> + </field> + </field> + </record> + + <record id="account_bank_statement_form_inherit" model="ir.ui.view"> + <field name="name">account.bank.statement.form</field> + <field name="model">account.bank.statement</field> + <field name="inherit_id" ref="account.view_bank_statement_form"/> + <field name="arch" type="xml"> + <button name="button_reprocess" position="after"> + <button string="Unlock" class="oe_highlight" name="is_edited" type="object" attrs="{'invisible':['|', '|', ('is_edit', '=', True), ('line_ids','=',[]), ('state', '!=', 'confirm')]}"/> + + <button string="Lock" class="oe_highlight" name="not_edited" type="object" attrs="{'invisible':['|', '|', ('is_edit', '=', False), ('line_ids','=',[]), ('state', '!=', 'confirm')]}"/> + </button> + <field name="date" position="after"> + <field name="is_edit" invisible="1"/> + </field> + </field> + </record> + </data> +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/users.xml b/indoteknik_custom/views/users.xml index d67b4474..020d8ddc 100644 --- a/indoteknik_custom/views/users.xml +++ b/indoteknik_custom/views/users.xml @@ -13,6 +13,7 @@ <field name="is_leader"/> <field name="is_logistic_approver"/> <field name="is_editor_product"/> + <field name="is_admin_reconcile"/> </field> </field> </record> |
