def on_sales_invoice_added(doc_sales_invoice):
    try:
        if is_pos_payment_method(doc_sales_invoice.oc_pm_code):
            doc_sales_invoice.submit()
    except Exception as ex:
        frappe.msgprint('Sales Invoice "%s" was not submitted.\n%s' % (doc_sales_invoice.get('name'), str(ex)))
    else:
        dn = erpnext_sales_invoice.make_delivery_note(doc_sales_invoice.get('name'))
        dn.insert()
        on_delivery_note_added(dn.get('name'))
def on_sales_invoice_added(doc_sales_invoice):
    try:
        if is_pos_payment_method(doc_sales_invoice.oc_pm_code):
            doc_sales_invoice.submit()
    except Exception as ex:
        frappe.msgprint('Sales Invoice "%s" was not submitted.\n%s' %
                        (doc_sales_invoice.get('name'), str(ex)))
    else:
        dn = erpnext_sales_invoice.make_delivery_note(
            doc_sales_invoice.get('name'))
        dn.insert()
        on_delivery_note_added(dn.get('name'))
    def set_missing_values(source, target):
        target.cash_bank_account = get_cash_bank_account(source, mode_of_payment=target.mode_of_payment)
        target.is_pos = 0

        if is_oc_sales_order(source):
            target.is_pos = mode_of_payments.is_pos_payment_method(source.oc_pm_code)
            payment_territory = territories.get_by_country(source.oc_pa_country)
            target.mode_of_payment = resolve_mode_of_payment(source.oc_pm_code, payment_territory)

            # payment method
            target.oc_pm_title = source.oc_pm_title
            target.oc_pm_code = source.oc_pm_code

        target.ignore_pricing_rule = 1
        target.run_method("set_missing_values")
        target.run_method("calculate_taxes_and_totals")
Esempio n. 4
0
    def set_missing_values(source, target):
        target.cash_bank_account = get_cash_bank_account(
            source, mode_of_payment=target.mode_of_payment)
        target.is_pos = 0

        if is_oc_sales_order(source):
            target.is_pos = mode_of_payments.is_pos_payment_method(
                source.oc_pm_code)
            payment_territory = territories.get_by_country(
                source.oc_pa_country)
            target.mode_of_payment = resolve_mode_of_payment(
                source.oc_pm_code, payment_territory)

            # payment method
            target.oc_pm_title = source.oc_pm_title
            target.oc_pm_code = source.oc_pm_code

        target.ignore_pricing_rule = 1
        target.run_method("set_missing_values")
        target.run_method("calculate_taxes_and_totals")