merge, update bean validations

This commit is contained in:
Rushabh Mehta
2013-03-01 19:09:06 +05:30
26 changed files with 156 additions and 143 deletions

View File

@@ -16,12 +16,8 @@
from __future__ import unicode_literals
import webnotes
import webnotes.default
from webnotes.utils import cint, cstr, date_diff, formatdate, getdate, now
from webnotes.model import db_exists
from webnotes.model.bean import copy_doclist
from webnotes import form, msgprint
from webnotes.utils import cint, cstr, formatdate, getdate
from webnotes import msgprint
sql = webnotes.conn.sql
@@ -49,13 +45,8 @@ class DocType:
# get date list inbetween from date and to date
def date_diff_list(self):
import datetime
#get from date
att_fr_date = self.doc.att_fr_date and self.doc.att_fr_date or ''
#get to date
att_to_date = self.doc.att_to_date and self.doc.att_to_date or ''
if att_to_date:
if self.doc.att_to_date:
r = (getdate(self.doc.att_to_date)+datetime.timedelta(days=1)-getdate(self.doc.att_fr_date)).days
else:
r = 1
@@ -65,6 +56,7 @@ class DocType:
return dt
def get_att_data(self):
import webnotes.defaults
fy = webnotes.defaults.get_global_default('fiscal_year')
comp = webnotes.defaults.get_user_default('company')

View File

@@ -33,6 +33,7 @@ def execute(filters=None):
for leave_type in leave_types:
columns.append(leave_type + " Allocated:Float")
columns.append(leave_type + " Taken:Float")
columns.append(leave_type + " Balance:Float")
data = {}
for d in allocations:
@@ -52,5 +53,6 @@ def execute(filters=None):
tmp = data.get((fiscal_year, employee.name, leave_type), webnotes._dict())
row.append(tmp.allocation or 0)
row.append(tmp.leaves or 0)
row.append((tmp.allocation or 0) - (tmp.leaves or 0))
return columns, result