Skip to content

Commit

Permalink
[8.0.5.1.2][l10n_id_taxform_bukti_potong_pph_common]
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 authored and andhit-r committed Jun 27, 2019
1 parent 7777a03 commit 5700d0f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion l10n_id_taxform_bukti_potong_pph_common/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Indonesia - Common Feature for Bukti Potong",
"version": "8.0.5.1.1",
"version": "8.0.5.1.2",
"category": "localization",
"website": "https://opensynergy-indonesia.com/",
"author": "OpenSynergy Indonesia",
Expand Down
1 change: 1 addition & 0 deletions l10n_id_taxform_bukti_potong_pph_common/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
account_move_line,
bukti_potong_pph_type,
bukti_potong_pph,
bukti_potong_pph_line,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, api, _
from openerp.exceptions import Warning as UserError


class AccountMoveLine(models.Model):
_inherit = 'account.move.line'

@api.multi
def _check_taxform(self):
self.ensure_one()
self._cr.execute(
"""SELECT 1 FROM rel_bukpot_line_2_income_move
WHERE account_move_id=%s
""",
(self.id,))
if self._cr.fetchone():
return True
else:
return False

@api.multi
def unlink(self):
for move_line in self:
taxform = move_line._check_taxform()
if taxform:
raise UserError(
_("Warning!"),
_("You cannot delete journal item linked to taxform!")
)
return super(AccountMoveLine, self).unlink()

0 comments on commit 5700d0f

Please sign in to comment.