umserp
|_overrides
|_doctypes
|_sales_invoice.py
from __future__ import unicode_literals
import frappe
import erpnext
from umserp.core.foundations.reporting import render_report
from erpnext.accounts.doctype.sales_invoice.sales_invoice import SalesInvoice
from frappe import _
from frappe.utils import add_days, cint, cstr, flt, formatdate, get_link_to_form, getdate, nowdate, now
from umserp.core.utils.accounting import money_to_words_malay
from umserp.umserp.doctype.module_mapper.module_mapper import validate_financial_period
from umserp.umserp.doctype.company_tree.company_tree import validate_approving_tree_authority
from frappe.model.naming import make_autoname
from erpnext.accounts.utils import get_account_currency, get_fiscal_year
import json
from frappe.model.workflow import get_workflow,get_transitions
from frappe.query_builder import DocType
from frappe.workflow.doctype.workflow_action.workflow_action import get_doc_workflow_state
from frappe.model.workflow import get_workflow_name
# sales_invoice.py
class UMSSalesInvoice(SalesInvoice):
def _validate(self):
super(UMSSalesInvoice,self).validate()
self.convert_amount_into_words()
if self._action == "submit":
self._validate_financial_period() # this is another custom validation for financial period
self._validate_approving_tree_authority() # this is the validation
if self._validate_posting_date():
self.clear_payment_schedule()
self.update_posting_date()
self.set_payment_schedule()
super(UMSSalesInvoice,self).set_missing_values()