Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions propms/lease_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,21 @@ def makeInvoice(
)
)
if doc.doctype == "Sales Order":
doc.posting_date = doc.from_date
sales_order_date = doc.from_date
doc.transaction_date = sales_order_date
doc.posting_date = sales_order_date
doc.delivery_date = doc.to_date
doc.insert()
if not doc.due_date or getdate(doc.due_date) < getdate(sales_order_date):
doc.due_date = sales_order_date

if doc.doctype != "Sales Order":
doc.insert()
if doc.taxes_and_charges:
getTax(doc)
doc.calculate_taxes_and_totals()
if doc.doctype == "Sales Order":
doc.insert()
return doc
doc.save()

# Check if auto submit is enabled in Property Management Settings
Expand Down Expand Up @@ -271,4 +280,4 @@ def enqueue_lease_invoice_auto_create():
queue="long",
now=False
)
return "Lease invoice auto creation has been queued. You will be notified once done."
return "Lease invoice auto creation has been queued. You will be notified once done."