Skip to content

Commit

Permalink
hotfix: creating sales invoice was not working
Browse files Browse the repository at this point in the history
  • Loading branch information
lasalesi committed Aug 16, 2021
1 parent 77ca726 commit 337ea60
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions woocommerceconnector/sync_orders.py
Expand Up @@ -285,21 +285,21 @@ def create_sales_invoice(woocommerce_order, woocommerce_settings, so):
si.flags.ignore_mandatory = True
set_cost_center(si.items, woocommerce_settings.cost_center)
si.submit()
if woocommerce_settings.import_payment == "1":
make_payament_entry_against_sales_invoice(si, woocommerce_settings)
if cint(woocommerce_settings.import_payment) == 1:
make_payment_entry_against_sales_invoice(si, woocommerce_settings)
frappe.db.commit()

def set_cost_center(items, cost_center):
for item in items:
item.cost_center = cost_center

def make_payament_entry_against_sales_invoice(doc, woocommerce_settings):
def make_payment_entry_against_sales_invoice(doc, woocommerce_settings):
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
payemnt_entry = get_payment_entry(doc.doctype, doc.name, bank_account=woocommerce_settings.cash_bank_account)
payemnt_entry.flags.ignore_mandatory = True
payemnt_entry.reference_no = doc.name
payemnt_entry.reference_date = nowdate()
payemnt_entry.submit()
payment_entry = get_payment_entry(doc.doctype, doc.name, bank_account=woocommerce_settings.cash_bank_account)
payment_entry.flags.ignore_mandatory = True
payment_entry.reference_no = doc.name
payment_entry.reference_date = nowdate()
payment_entry.submit()

def create_delivery_note(woocommerce_order, woocommerce_settings, so):
for fulfillment in woocommerce_order.get("fulfillments"):
Expand Down Expand Up @@ -363,8 +363,8 @@ def get_order_taxes(woocommerce_order, woocommerce_settings):
"included_in_print_rate": 0,
"cost_center": woocommerce_settings.cost_center
})
# old code with conditional brutto/netto prices
# taxes.append({
# old code with conditional brutto/netto prices
# taxes.append({
# "charge_type": "On Net Total" if woocommerce_order.get("prices_include_tax") else "Actual",
# "account_head": get_tax_account_head(woocommerce_tax),
# "description": "{0} - {1}%".format(name, rate),
Expand Down

0 comments on commit 337ea60

Please sign in to comment.