fix issue in anglo saxon
This commit is contained in:
parent
13c2315f2c
commit
d0b6c36b3c
|
|
@ -68,9 +68,6 @@ class AccountMove(models.Model):
|
|||
else:
|
||||
to_post = self
|
||||
|
||||
# `user_has_group` won't be bypassed by `sudo()` since it doesn't change the user anymore.
|
||||
if not self.env.su and not self.env.user.has_group('account.group_account_invoice'):
|
||||
raise AccessError(_("You don't have the access rights to post an invoice."))
|
||||
|
||||
for move in to_post:
|
||||
if not move.period_id:
|
||||
|
|
@ -83,34 +80,8 @@ class AccountMove(models.Model):
|
|||
move.period_id = period.id
|
||||
else:
|
||||
raise UserError(_("No valid open period found for the date: %s") % move.date)
|
||||
return super(AccountMove, self)._post(soft=soft)
|
||||
|
||||
if move.partner_bank_id and not move.partner_bank_id.active:
|
||||
raise UserError(
|
||||
_("The recipient bank account link to this invoice is archived.\nSo you cannot confirm the invoice."))
|
||||
|
||||
if move.state == 'posted':
|
||||
raise UserError(_('The entry %s (id %s) is already posted.') % (move.name, move.id))
|
||||
|
||||
if not move.line_ids.filtered(lambda line: not line.display_type):
|
||||
raise UserError(_('You need to add a line before posting.'))
|
||||
|
||||
to_post.mapped('line_ids').create_analytic_lines()
|
||||
to_post.write({
|
||||
'state': 'posted',
|
||||
'posted_before': True,
|
||||
})
|
||||
|
||||
for move in to_post:
|
||||
move.message_subscribe([p.id for p in [move.partner_id] if p not in move.sudo().message_partner_ids])
|
||||
|
||||
to_post._check_balanced()
|
||||
return to_post
|
||||
|
||||
# @api.model
|
||||
# def create(self, vals):
|
||||
# vals['auto_post'] = True
|
||||
# return super(AccountMove, self).create(vals)
|
||||
#
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_name = "account.move.line"
|
||||
|
|
|
|||
Loading…
Reference in New Issue