diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-24 15:28:52 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-24 15:28:52 +0700 |
| commit | 099dc9e41b2f9098eebb00ea895232e4c943d83c (patch) | |
| tree | ac43474b4009b6c0d5c64523a0d8343e5492697a /fixco_custom/models | |
| parent | 6274e53f46c38682c29334a9101561a8dbd53aff (diff) | |
<Miqdad> lock date
Diffstat (limited to 'fixco_custom/models')
| -rwxr-xr-x | fixco_custom/models/__init__.py | 4 | ||||
| -rw-r--r-- | fixco_custom/models/account_lock_date.py | 12 | ||||
| -rw-r--r-- | fixco_custom/models/account_move.py | 15 | ||||
| -rw-r--r-- | fixco_custom/models/res_company.py | 17 |
4 files changed, 47 insertions, 1 deletions
diff --git a/fixco_custom/models/__init__.py b/fixco_custom/models/__init__.py index 36d2553..1207010 100755 --- a/fixco_custom/models/__init__.py +++ b/fixco_custom/models/__init__.py @@ -43,4 +43,6 @@ from . import account_payment from . import stock_location from . import account_asset from . import stock_inventory -from . import kartu_stock
\ No newline at end of file +from . import kartu_stock +from . import account_lock_date +from . import res_company
\ No newline at end of file diff --git a/fixco_custom/models/account_lock_date.py b/fixco_custom/models/account_lock_date.py new file mode 100644 index 0000000..1a4234a --- /dev/null +++ b/fixco_custom/models/account_lock_date.py @@ -0,0 +1,12 @@ +from odoo import api, fields, models, SUPERUSER_ID, _ +from odoo.exceptions import UserError + + +class AccountUpdateLockDate(models.TransientModel): + _inherit = 'account.lock.date' + + excluded_user_ids = fields.Many2many( + related='company_id.excluded_user_ids', + readonly=False, + string="Excluded Users" + )
\ No newline at end of file diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py index d727380..376c368 100644 --- a/fixco_custom/models/account_move.py +++ b/fixco_custom/models/account_move.py @@ -62,6 +62,21 @@ class AccountMove(models.Model): ) soo_number = fields.Char('SOO Number') + # def _check_lock_date(self): + # _logger.warning("CHECK LOCK DATE TRIGGERED BY %s", self.env.user.name) + + # moves_to_check = self.filtered( + # lambda m: self.env.user not in m.company_id.excluded_user_ids + # ) + + # _logger.warning("MOVES TO CHECK: %s", moves_to_check) + + # if moves_to_check: + # return super(AccountMove, moves_to_check)._check_lock_date() + + # _logger.warning("LOCK BYPASSED") + # return True + @api.depends('line_ids.partner_id') def _compute_partner_compute(self): for move in self: diff --git a/fixco_custom/models/res_company.py b/fixco_custom/models/res_company.py new file mode 100644 index 0000000..ed36141 --- /dev/null +++ b/fixco_custom/models/res_company.py @@ -0,0 +1,17 @@ +from odoo import models, fields +from datetime import date + +class ResCompany(models.Model): + _inherit = 'res.company' + + excluded_user_ids = fields.Many2many( + 'res.users', + string="Excluded Users" + ) + def _get_user_fiscal_lock_date(self): + self.ensure_one() + + if self.env.user in self.excluded_user_ids: + return date.min + + return super()._get_user_fiscal_lock_date()
\ No newline at end of file |
