[gl entry] [validation] company match validation should be done only for is_cancelled = No

This commit is contained in:
Anand Doshi 2013-04-29 13:01:44 +05:30
parent 4b6f83ef18
commit 457cd7d1f4

View File

@ -109,7 +109,7 @@ class DocType:
msgprint(_("Account") + ": " + self.doc.account + _(" has been freezed. \
Only Accounts Manager can do transaction against this account"), raise_exception=1)
if ret and ret[0]["company"] != self.doc.company:
if self.doc.is_cancelled in ("No", None) and ret and ret[0]["company"] != self.doc.company:
msgprint(_("Account") + ": " + self.doc.account + _(" does not belong to the company") \
+ ": " + self.doc.company, raise_exception=1)
@ -124,7 +124,8 @@ class DocType:
return self.cost_center_company[self.doc.cost_center]
if self.doc.cost_center and _get_cost_center_company() != self.doc.company:
if self.doc.is_cancelled in ("No", None) and \
self.doc.cost_center and _get_cost_center_company() != self.doc.company:
msgprint(_("Cost Center") + ": " + self.doc.cost_center \
+ _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True)