Last active
May 7, 2021 18:18
-
-
Save ofelix03/e925562430a0617af78ca5e020a9ca02 to your computer and use it in GitHub Desktop.
revised-version-of-extract-from-line-19-to-63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cheque_exists_domain_filter = [("reference", "=", vals["reference"]), ("state", "!=", "cancelled")] | |
| if "acc_no" in vals and vals["acc_no"]: | |
| cheque_exists_domain_filter += [("acc_no", "=", vals["acc_no"])] | |
| if "branch_code" in vals: | |
| cheque_exists_domain_filter += [("branch_code", "=", vals["branch_code"])] | |
| cheques = self.search(cheque_exists_domain_filter) | |
| if cheques: | |
| raise ValidationError(_("This cheque/slip has already been recorded")) | |
| partner_cheque_account_exists = self._model_partner_cheque_account().cheque_account_exists( | |
| account_number=vals["acc_no"], branch_id=vals["branch"] | |
| ) | |
| if ( | |
| "branch_code" in vals | |
| and not partner_cheque_account_exists | |
| ): | |
| self._model_partner_cheque_account().create_cheque_account( | |
| partner_id=vals["partner"], | |
| branch_id=vals["branch"], | |
| currency_id=vals["currency_id"], | |
| account_number=vals["acc_no"], | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment