Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14 off balance #226

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion account_offbalance_sponsorship/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,31 @@
#
##############################################################################

from odoo import models
from odoo import _, models
from odoo.exceptions import UserError
from odoo.tools.misc import format_date


class AccountMove(models.Model):
_inherit = "account.move"

def _check_fiscalyear_lock_date(self):
try:
super()._check_fiscalyear_lock_date()
except UserError:
for move in self:
if any(not m.startswith("9") for m in move.line_ids.mapped("account_id.code")):
lock_date = move.company_id._get_user_fiscal_lock_date()
if self.user_has_groups('account.group_account_manager'):
message = _("You cannot add/modify entries prior to and inclusive of the lock date %s.",
format_date(self.env, lock_date))
else:
message = _(
"You cannot add/modify entries prior to and inclusive of the lock date %s. Check the company settings or ask someone with the 'Adviser' role",
format_date(self.env, lock_date))
raise UserError(message)
return True

def js_remove_outstanding_partial(self, partial_id):
"""Called by the 'payment' widget to remove a reconciled entry to the present
invoice.
Expand Down
2 changes: 2 additions & 0 deletions account_offbalance_sponsorship/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_offbalance_sponsorship_account_offbalance_sponsorship,account_offbalance_sponsorship.account_offbalance_sponsorship,model_account_offbalance_sponsorship_account_offbalance_sponsorship,base.group_user,1,1,1,1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this rule? The model model_account_offbalance_sponsorship_account_offbalance_sponsorship does not exist, and therefore the module update will fail with this.

Loading