commit
c58b330673
@ -654,7 +654,8 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
def _test_recurring_invoice(self, base_si, first_and_last_day):
|
def _test_recurring_invoice(self, base_si, first_and_last_day):
|
||||||
from webnotes.utils import add_months, get_last_day
|
from webnotes.utils import add_months, get_last_day
|
||||||
from accounts.doctype.sales_invoice.sales_invoice import manage_recurring_invoices
|
from accounts.doctype.sales_invoice.sales_invoice \
|
||||||
|
import manage_recurring_invoices, get_next_date
|
||||||
|
|
||||||
no_of_months = ({"Monthly": 1, "Quarterly": 3, "Yearly": 12})[base_si.doc.recurring_type]
|
no_of_months = ({"Monthly": 1, "Quarterly": 3, "Yearly": 12})[base_si.doc.recurring_type]
|
||||||
|
|
||||||
@ -662,7 +663,8 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
self.assertEquals(i+1, webnotes.conn.sql("""select count(*) from `tabSales Invoice`
|
self.assertEquals(i+1, webnotes.conn.sql("""select count(*) from `tabSales Invoice`
|
||||||
where recurring_id=%s and docstatus=1""", base_si.doc.recurring_id)[0][0])
|
where recurring_id=%s and docstatus=1""", base_si.doc.recurring_id)[0][0])
|
||||||
|
|
||||||
next_date = add_months(base_si.doc.posting_date, no_of_months)
|
next_date = get_next_date(base_si.doc.posting_date, no_of_months,
|
||||||
|
base_si.doc.repeat_on_day_of_month)
|
||||||
|
|
||||||
manage_recurring_invoices(next_date=next_date, commit=False)
|
manage_recurring_invoices(next_date=next_date, commit=False)
|
||||||
|
|
||||||
|
@ -4,14 +4,16 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
serial_nos = webnotes.conn.sql("""select name from `tabSerial No` where docstatus=0
|
serial_nos = webnotes.conn.sql("""select name from `tabSerial No` where docstatus=0
|
||||||
and status in ('Available', 'Sales Returned') and ifnull(warehouse, '') = ''""")
|
and status in ('Available', 'Sales Returned') and ifnull(warehouse, '') = ''""")
|
||||||
for sr in serial_nos:
|
for sr in serial_nos:
|
||||||
try:
|
try:
|
||||||
sr_bean = webnotes.bean("Serial No", sr[0])
|
last_sle = webnotes.bean("Serial No", sr[0]).make_controller().get_last_sle()
|
||||||
sr_bean.make_controller().via_stock_ledger = True
|
if last_sle.actual_qty > 0:
|
||||||
sr_bean.save()
|
webnotes.conn.set_value("Serial No", sr[0], "warehouse", last_sle.warehouse)
|
||||||
|
|
||||||
webnotes.conn.commit()
|
webnotes.conn.commit()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
@ -87,8 +87,6 @@ class DocType(StockController):
|
|||||||
self.doc.status = "Sales Returned"
|
self.doc.status = "Sales Returned"
|
||||||
else:
|
else:
|
||||||
self.doc.status = "Available"
|
self.doc.status = "Available"
|
||||||
if not self.doc.warehouse:
|
|
||||||
self.doc.warehouse = last_sle.warehouse
|
|
||||||
else:
|
else:
|
||||||
if document_type == "Purchase Return":
|
if document_type == "Purchase Return":
|
||||||
self.doc.status = "Purchase Returned"
|
self.doc.status = "Purchase Returned"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user