This commit is contained in:
Rushabh Mehta 2012-04-13 19:06:05 +05:30
commit f465b4fa76
13 changed files with 265 additions and 179 deletions

View File

@ -334,7 +334,7 @@ div.notice {
div.form-title {
/*background-color: #e0eeff;*/
padding: 5px 19px 15px 19px;
padding: 5px 11px 15px 11px;
margin: -15px -15px 0px -15px;
border-bottom: 1px solid #eee;
}
@ -342,7 +342,7 @@ div.form-title {
div.form-section-head {
margin: 11px -15px 3px -15px;
border-top: 1px solid #ccc;
padding: 11px 23px 0px 23px;
padding: 11px 15px 0px 15px;
}
div.form-layout-row:first-child .form-section-head {

View File

@ -3,25 +3,26 @@
# These values are common in all dictionaries
{
'creation': '2011-03-28 15:17:25',
'creation': '2012-04-11 13:16:56',
'docstatus': 0,
'modified': '2011-03-28 12:33:24',
'modified_by': 'umair@iwebnotes.com',
'owner': 'Administrator'
'modified': '2012-04-13 12:24:20',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Print Format
{
'doc_type': u'Journal Voucher',
'doctype': 'Print Format',
'html': '<!-- p.big {line-height: 200%} .noborder td { border: 0px solid #fff; } -->\n<div style="position: relative;">\n<h3><script>doc.company</script><br /> <br /> \n<hr />\nPAYMENT ADVICE</h3>\n<table class="noborder" style="width: 100%;">\n<tbody>\n<tr>\n<td style="vertical-align: top;" width="50%">To :<br />\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</td>\n<td width="50%">\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="30%">Voucher No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndoc.name\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Voucher Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.voucher_date)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_no)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n<br /> <strong>We are pleased to enclose our cheque in full/part Settlement of your under noted bills</strong> <br /> \n<hr />\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="70%">&nbsp;</td>\n<td width="15%">Total :</td>\n<td class="pos_left" width="15%">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td colspan="3">Narration :\n<script type="text/javascript">// <![CDATA[\nreplace_newlines(doc.remark)\n// ]]></script>\n<br /><br /><br /></td>\n</tr>\n</tbody>\n</table>\n<div style="position: absolute; top: 14cm; left: 0cm;">Prepared By</div>\n<div style="position: absolute; top: 14cm; left: 5.5cm;">Authorised Signatory</div>\n<div style="position: absolute; top: 14cm; left: 11cm;">Received Payment as Above</div>\n<div style="position: absolute; top: 16.4cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 6cm;"><strong>A/c Payee</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.9cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</div>\n<div style="position: absolute; top: 17.9cm; left: 1cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</div>\n<div style="position: absolute; top: 18.6cm; left: 1cm; width: 7cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount_in_words\n// ]]></script>\n</div>\n<div style="position: absolute; top: 19.7cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</div>\n</div>',
'module': 'Accounts',
'html': u'<!-- p.big {line-height: 200%} .noborder td { border: 0px solid #fff; } -->\n<div style="position: relative;">\n<h3><script>doc.company</script><br /> <br /> \n<hr />\nPAYMENT ADVICE</h3>\n<table class="noborder" style="width: 100%;">\n<tbody>\n<tr>\n<td style="vertical-align: top;" width="50%">To :<br />\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</td>\n<td width="50%">\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="30%">Voucher No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndoc.name\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Voucher Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.voucher_date)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_no)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n<br /> <strong>We are pleased to enclose our cheque in full/part Settlement of your under noted bills</strong> <br /> \n<hr />\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="70%">&nbsp;</td>\n<td width="15%">Total :</td>\n<td class="pos_left" width="15%">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td colspan="3">Narration :\n<script type="text/javascript">// <![CDATA[\nreplace_newlines(doc.remark)\n// ]]></script>\n<br /><br /><br /></td>\n</tr>\n</tbody>\n</table>\n<div style="position: absolute; top: 14cm; left: 0cm;">Prepared By</div>\n<div style="position: absolute; top: 14cm; left: 5.5cm;">Authorised Signatory</div>\n<div style="position: absolute; top: 14cm; left: 11cm;">Received Payment as Above</div>\n<div style="position: absolute; top: 16.4cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 6cm;"><strong>A/c Payee</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.9cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</div>\n<div style="position: absolute; top: 17.9cm; left: 1cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</div>\n<div style="position: absolute; top: 18.6cm; left: 1cm; width: 7cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount_in_words\n// ]]></script>\n</div>\n<div style="position: absolute; top: 19.7cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</div>\n</div>',
'module': u'Accounts',
'name': '__common__',
'standard': 'Yes'
'standard': u'Yes'
},
# Print Format, Cheque Printing Format
{
'doctype': 'Print Format',
'name': 'Cheque Printing Format'
'name': u'Cheque Printing Format'
}
]

View File

@ -3,25 +3,26 @@
# These values are common in all dictionaries
{
'creation': '2011-03-28 15:17:25',
'creation': '2012-04-11 13:16:56',
'docstatus': 0,
'modified': '2011-03-28 12:31:40',
'modified_by': 'umair@iwebnotes.com',
'owner': 'Administrator'
'modified': '2012-04-13 12:24:59',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Print Format
{
'doc_type': u'Journal Voucher',
'doctype': 'Print Format',
'html': '<div style="position: relative;">\n<h3 align="center"><script>doc.company</script>\n</div>\n\n<font size="4">\n<table class=\'simpletable\'>\n<tr>\n<td><b> Receipt No.: </b></td>\n<td><script>doc.name</script></td>\n</tr>\n<tr>\n<td><b> Date : </b></td>\n<td><script>date.str_to_user(doc.voucher_date)</script></td>\n</tr> \n<tr>\n<td><b> Remark: </b></td>\n<td><script> doc.remark </script></td>\n</tr>\n<tr>\n<td><b> Received From: </b></td>\n<td><b><script> doc.pay_to_rec_from </script></b></td>\n</tr>\n</table>\n<br>\n\n<div><b><script>doc.total_amount</script></b> </td></div><br>\n<div style="text-align:left"><b><script>doc.total_amount_in_words</script></b></div><br>\n<div>This receipt is issued subject to realization of the Cheque</div>\n</font>\n<br>\n<table class="noborder">\n<tr>\n<td style = "text-align = right;"><h3>For <script>doc.company</script>,</h3><br><div>(Authorised Signatory)</div></td>\n</tr>\n</table>',
'module': 'Accounts',
'html': u'<div style="position: relative;">\n<h3 align="center"><script>doc.company</script>\n</div>\n\n<font size="4">\n<table class=\'simpletable\'>\n<tr>\n<td><b> Receipt No.: </b></td>\n<td><script>doc.name</script></td>\n</tr>\n<tr>\n<td><b> Date : </b></td>\n<td><script>date.str_to_user(doc.voucher_date)</script></td>\n</tr> \n<tr>\n<td><b> Remark: </b></td>\n<td><script> doc.remark </script></td>\n</tr>\n<tr>\n<td><b> Received From: </b></td>\n<td><b><script> doc.pay_to_rec_from </script></b></td>\n</tr>\n</table>\n<br>\n\n<div><b><script>doc.total_amount</script></b> </td></div><br>\n<div style="text-align:left"><b><script>doc.total_amount_in_words</script></b></div><br>\n<div>This receipt is issued subject to realization of the Cheque</div>\n</font>\n<br>\n<table class="noborder">\n<tr>\n<td style = "text-align = right;"><h3>For <script>doc.company</script>,</h3><br><div>(Authorised Signatory)</div></td>\n</tr>\n</table>',
'module': u'Accounts',
'name': '__common__',
'standard': 'Yes'
'standard': u'Yes'
},
# Print Format, Payment Receipt Voucher
{
'doctype': 'Print Format',
'name': 'Payment Receipt Voucher'
'name': u'Payment Receipt Voucher'
}
]

View File

@ -33,9 +33,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
// hide India specific fields
var cp = wn.control_panel;
if(cp.country == 'India')
unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']);
else
hide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
hide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']);
}
// Refresh
@ -50,7 +50,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// Hide/unhide group or ledger
// -----------------------------------------
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
hide_field(['Convert to Group', 'Convert to Ledger']);
hide_field(['convert_to_group', 'convert_to_ledger']);
if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger');
else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_ledger');
}

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:43',
'creation': '2012-04-13 11:55:50',
'docstatus': 0,
'modified': '2012-03-27 14:45:48',
'modified': '2012-04-13 12:28:24',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -25,7 +25,7 @@
'show_in_menu': 0,
'subject': u' ',
'tag_fields': u'voucher_type',
'version': 311
'version': 312
},
# These values are common for all DocField
@ -53,30 +53,6 @@
'name': u'Journal Voucher'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Accounts User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
@ -101,6 +77,30 @@
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Accounts User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts User',
'submit': 0,
'write': 0
},
# DocField
{
'doctype': u'DocField',
@ -526,7 +526,7 @@
'doctype': u'DocField',
'fieldname': u'pay_to_recd_from',
'fieldtype': u'Data',
'hidden': 0,
'hidden': 1,
'label': u'Pay To / Recd From',
'no_copy': 1,
'permlevel': 0,
@ -539,7 +539,7 @@
'doctype': u'DocField',
'fieldname': u'total_amount',
'fieldtype': u'Data',
'hidden': 0,
'hidden': 1,
'label': u'Total Amount',
'no_copy': 1,
'permlevel': 1,
@ -552,7 +552,7 @@
'doctype': u'DocField',
'fieldname': u'total_amount_in_words',
'fieldtype': u'Data',
'hidden': 0,
'hidden': 1,
'label': u'Total Amount in Words',
'no_copy': 1,
'permlevel': 1,

View File

@ -35,45 +35,111 @@ class DocType:
yr = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",dt)
return yr and yr[0][0] or ''
# Get gl entries for the period and account
def get_gl_entries(self, lft, rgt):
gle = sql("select t1.posting_date, t1.voucher_type, t1.voucher_no, t1.debit, t1.credit, t1.remarks from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s and ifnull(t1.is_opening, 'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(t1.is_cancelled, 'No') = 'No'", (self.doc.from_date, self.doc.to_date, lft, rgt), as_dict=1)
def validate_date(self):
"""check for from date and to date within same year"""
if not sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day) and %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",(self.doc.from_date, self.doc.to_date)):
msgprint("From Date and To Date must be within same year")
raise Exception
if not self.doc.from_date or not self.doc.to_date:
msgprint("From Date and To Date is mandatory")
raise Exception
def add_header(self):
title = 'Ledger Balances Between ' + getdate(self.doc.from_date).strftime('%d-%m-%Y') + ' and ' + getdate(self.doc.to_date).strftime('%d-%m-%Y')
return [[title], ['Account', 'Opening(Dr)', 'Opening (Cr)', 'Debit', 'Credit', 'Closing(Dr)', 'Closing(Cr)'], ['', '', '', '', '', '', '', 'Posting Date', 'Voucher Type', 'Voucher No', 'Debit', 'Credit', 'Remarks']]
def get_account_subtree(self, acc):
return sql("""
SELECT
CONCAT(REPEAT(' ', COUNT(parent.name) - (sub_tree.depth + 1)), node.name) as account,
node.lft AS lft, node.rgt AS rgt,
node.debit_or_credit as dr_or_cr, node.group_or_ledger as group_or_ledger, node.is_pl_account as is_pl_account
FROM tabAccount AS node,
tabAccount AS parent,
tabAccount AS sub_parent,
(
SELECT node.name, (COUNT(parent.name) - 1) AS depth
FROM tabAccount AS node, tabAccount AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND node.name = %s
GROUP BY node.name
ORDER BY node.lft
)AS sub_tree
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt
AND sub_parent.name = sub_tree.name
GROUP BY node.name
ORDER BY node.lft""", acc, as_dict = 1)
def show_acc_summary(self, glc, acc_det):
from_date_year = self.get_year(add_days(self.doc.from_date, -1))
to_date_year = self.get_year(self.doc.to_date)
acc = acc_det['account'].strip()
if from_date_year == to_date_year:
debit_on_fromdate, credit_on_fromdate, opening = glc.get_as_on_balance(acc, from_date_year, add_days(self.doc.from_date, -1), acc_det['dr_or_cr'], acc_det['lft'], acc_det['rgt']) # opening = closing of prev_date
elif acc_det['is_pl_account'] == 'No': # if there is no previous year in system and not pl account
opening = sql("select opening from `tabAccount Balance` where account = %s and period = %s", (acc, to_date_year))
debit_on_fromdate, credit_on_fromdate, opening = 0, 0, flt(opening[0][0])
else: # if pl account and there is no previous year in system
debit_on_fromdate, credit_on_fromdate, opening = 0,0,0
# closing balance
#--------------------------------
debit_on_todate, credit_on_todate, closing = glc.get_as_on_balance(acc, to_date_year, self.doc.to_date, acc_det['dr_or_cr'], acc_det['lft'], acc_det['rgt'])
# transaction betn the period
#----------------------------------------
debit = flt(debit_on_todate) - flt(debit_on_fromdate)
credit = flt(credit_on_todate) - flt(credit_on_fromdate)
# Debit / Credit
if acc_det['dr_or_cr'] == 'Credit':
opening, closing = -1*opening, -1*closing
return [acc_det['account'], flt(opening>0 and opening or 0), flt(opening<0 and -opening or 0),
debit, credit, flt(closing>0.01 and closing or 0), flt(closing<-0.01 and -closing or 0)]
def show_gl_entries(self, acc):
"""Get gl entries for the period and account"""
gle = sql("select posting_date, voucher_type, voucher_no, debit, credit, remarks from `tabGL Entry` WHERE account = %s and posting_date >= %s AND posting_date <= %s and ifnull(is_opening, 'No') = 'No' and ifnull(is_cancelled, 'No') = 'No'", (acc, self.doc.from_date, self.doc.to_date), as_dict=1)
entries, dr, cr = [], 0, 0
for d in gle:
dr, cr = dr + flt(d['debit']), cr + flt(d['credit'])
entries.append(['', d['posting_date'], d['voucher_type'], d['voucher_no'], d['debit'], d['credit'], d['remarks']])
return entries, dr, cr
entries.append(['', '', '', '', '', '', '', d['posting_date'], d['voucher_type'], d['voucher_no'], d['debit'], d['credit'], d['remarks']])
return entries
# Get Report Data
def get_report_data(self):
from_date_year = self.get_year(add_days(self.doc.from_date, -1))
to_date_year = self.get_year(self.doc.to_date)
self.validate_date()
res = []
res += self.add_header()
# result initiatlization
header = 'Ledger Balances Between ' + getdate(self.doc.from_date).strftime('%d-%m-%Y') + ' and ' + getdate(self.doc.to_date).strftime('%d-%m-%Y')
res = [[header], ['Account', 'Posting Date', 'Voucher Type', 'Voucher No', 'Debit', 'Credit', 'Remarks']]
glc = get_obj('GL Control')
for d in getlist(self.doclist, 'ledger_details'):
# Fetch acc details
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt from tabAccount where name = '%s'" % d.account, as_dict=1)[0]
sub_tree = self.get_account_subtree(d.account)
# Opening
opening = glc.get_as_on_balance(d.account, from_date_year, add_days(self.doc.from_date, -1), acc_det['debit_or_credit'], acc_det['lft'], acc_det['rgt'])[2]
if acc_det['debit_or_credit'] == 'Credit':
opening = -1*opening
for acc_det in sub_tree:
acc_summary = self.show_acc_summary(glc, acc_det)
res.append(acc_summary)
# Show gl entries if account is ledger
if acc_det['group_or_ledger'] == 'Ledger' and (acc_summary[3] or acc_summary[4]):
gle = self.show_gl_entries(acc_det['account'].strip())
res += gle
# GL Entries
gle, debit, credit = self.get_gl_entries(acc_det['lft'], acc_det['rgt'])
# Closing
closing = opening + debit - credit
# Append to result
res.append([d.account])
res += gle
res.append(['', '', '', 'Total Debit/Credit', debit, credit])
res.append(['', '', '', 'Opening Balance', opening])
res.append(['', '', '', 'Closing Balance', closing])
return res

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:52',
'creation': '2012-04-11 13:16:55',
'docstatus': 0,
'modified': '2012-04-03 12:49:52',
'modified': '2012-04-13 12:06:15',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -15,13 +15,13 @@
'add_col': u"`tabPurchase Receipt`.`posting_date` AS 'PR Posting Date'",
'add_cond': u"`tabPurchase Invoice Item`.`purchase_receipt` = `tabPurchase Receipt`.`name`\n`tabPurchase Receipt`.`posting_date` >= '%(pr_posting_date)s'\n`tabPurchase Receipt`.`posting_date` <= '%(pr_posting_date1)s'\n`tabPurchase Receipt`.`posting_date` > `tabPurchase Invoice`.`posting_date`",
'add_tab': u'`tabPurchase Receipt`',
'columns': u'Purchase Invoice\x01ID,Purchase Invoice\x01Voucher Date,Purchase Invoice\x01Posting Date,Purchase Invoice\x01Credit To,Purchase Invoice Item\x01Rate,Purchase Invoice Item\x01Qty,Purchase Invoice Item\x01Amount,Purchase Invoice Item\x01Pur Order,Purchase Invoice Item\x01Pur Receipt',
'columns': u'Purchase Invoice\x01ID,Purchase Invoice\x01Posting Date,Purchase Invoice\x01Credit To,Purchase Invoice Item\x01Qty,Purchase Invoice Item\x01Amount,Purchase Invoice Item\x01Pur Order,Purchase Invoice Item\x01Pur Receipt',
'criteria_name': u'Purchase in Transit',
'description': u'List of PR whose posting date is after PV posting date',
'dis_filters': u'`tabPurchase Receipt`.`pr_posting_date`',
'doc_type': u'Purchase Invoice Item',
'doctype': 'Search Criteria',
'filters': u"{'Purchase Invoice\x01Submitted':1,'Purchase Invoice\x01From Posting Date\x01lower':'2009-04-01','Purchase Invoice\x01To Posting Date\x01upper':'2010-01-11','Purchase Invoice\x01Is Opening':'','Purchase Invoice\x01Fiscal Year':'','Purchase Invoice\x01Company':'','Purchase Receipt\x01From PR Posting Date\x01lower':'2009-04-01','Purchase Receipt\x01To PR Posting Date\x01upper':'2010-01-11'}",
'filters': u'{"Purchase Invoice\\u0001Submitted":1,"Purchase Invoice\\u0001Is Opening":[""],"Purchase Invoice\\u0001Fiscal Year":[""]}',
'module': u'Buying',
'name': '__common__',
'page_len': 50,

View File

@ -56,7 +56,7 @@ class DocType:
# update year start date and year end date from fiscal_year
ysd = webnotes.conn.sql("""select year_start_date from `tabFiscal Year`
where name=%s""", self.doc.fiscal_year)
where name=%s""", self.doc.current_fiscal_year)
ysd = ysd and ysd[0][0] or ''
from webnotes.utils import get_first_day, get_last_day
@ -66,4 +66,4 @@ class DocType:
get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
def get_defaults(self):
return webnotes.conn.get_defaults()
return webnotes.conn.get_defaults()

View File

@ -41,13 +41,13 @@ cur_frm.fields_dict['default_bom'].get_query = function(doc) {
// Expense Account
// ---------------------------------
cur_frm.fields_dict['purchase_account'].get_query = function(doc){
return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Debit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'
return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Debit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'
}
// Income Account
// --------------------------------
cur_frm.fields_dict['default_income_account'].get_query = function(doc) {
return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Credit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.`account_type` ="Income Account" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'
return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Credit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.`account_type` ="Income Account" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'
}

View File

@ -17,13 +17,17 @@
cur_frm.cscript.onload = function(doc, cdt, cdn) {
if (!doc.posting_date) doc.posting_date = dateutil.obj_to_str(new Date());
if (!doc.transfer_date) doc.transfer_date = dateutil.obj_to_str(new Date());
if(!doc.purpose) set_multiple(cdt, cdn, {purpose:'Material Issue'});
cfn_set_fields(doc, cdt, cdn);
}
var cfn_set_fields = function(doc, cdt, cdn) {
lst = ['supplier','supplier_name','supplier_address','customer','customer_name','customer_address'];
hide_field(lst);
if (in_list(['Material Issue', 'Material Transfer', 'Material Receipt', 'Production Order', 'Subcontracting', 'Other'], doc.purpose)) {
hide_field(lst);
} else unhide_field(lst);
if (doc.purpose == 'Production Order' || doc.purpose == 'Other'){
unhide_field('get_items');
@ -52,6 +56,7 @@ var cfn_set_fields = function(doc, cdt, cdn) {
if(doc.purpose == 'Purchase Return'){
doc.customer=doc.customer_name = doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no='';
unhide_field(['supplier','supplier_name','supplier_address','purchase_receipt_no']);
}
else if(doc.purpose == 'Sales Return'){
doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';

View File

@ -31,8 +31,9 @@ in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
from utilities.transaction_base import TransactionBase
class DocType:
class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
@ -510,10 +511,11 @@ class DocType:
def get_cust_addr(self):
res = sql("select customer_name,address from `tabCustomer` where name = '%s'"%self.doc.customer)
res = sql("select customer_name from `tabCustomer` where name = '%s'"%self.doc.customer)
addr = self.get_address_text(customer = self.doc.customer)
ret = {
'customer_name' : res and res[0][0] or '',
'customer_address' : res and res[0][1] or ''}
'customer_address' : addr and addr[0] or ''}
return ret
@ -530,7 +532,8 @@ class DocType:
def get_supp_addr(self):
res = sql("select supplier_name,address from `tabSupplier` where name = '%s'"%self.doc.supplier)
addr = self.get_address_text(supplier = self.doc.supplier)
ret = {
'supplier_name' : res and res[0][0] or '',
'supplier_address' : res and res[0][1] or ''}
'supplier_address' : addr and addr[0] or ''}
return ret

View File

@ -3,16 +3,16 @@
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:37',
'creation': '2009-05-12 16:46:45',
'docstatus': 0,
'modified': '2012-03-27 14:45:52',
'modified': '2012-04-13 14:12:02',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1332233897',
'_last_update': u'1334303911',
'allow_attach': 0,
'allow_copy': 0,
'allow_email': 0,
@ -26,7 +26,6 @@
'hide_toolbar': 0,
'in_create': 0,
'in_dialog': 0,
'is_submittable': 1,
'is_transaction_doc': 0,
'issingle': 0,
'max_attachments': 0,
@ -42,7 +41,7 @@
'subject': u'%(remarks)s',
'tag_fields': u'purpose',
'use_template': 0,
'version': 259
'version': 263
},
# These values are common for all DocField
@ -82,6 +81,42 @@
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Production User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Production Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
@ -89,7 +124,7 @@
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material User',
'role': u'All',
'submit': 0,
'write': 0
},
@ -111,72 +146,9 @@
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Production User',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Production User'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Production Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Production Manager'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Manager',
'submit': 1,
'write': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'warehouse',
'fieldtype': u'Section Break',
'label': u'Warehouse',
'oldfieldtype': u'Section Break',
@ -186,7 +158,6 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
@ -201,12 +172,13 @@
'doctype': u'DocField',
'fieldname': u'naming_series',
'fieldtype': u'Select',
'hidden': 0,
'in_filter': 0,
'label': u'Series',
'no_copy': 1,
'oldfieldname': u'naming_series',
'oldfieldtype': u'Select',
'options': u'STE',
'options': u'\nSTE',
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
@ -221,6 +193,7 @@
'doctype': u'DocField',
'fieldname': u'amendment_date',
'fieldtype': u'Date',
'hidden': 0,
'in_filter': 0,
'label': u'Amendment Date',
'no_copy': 1,
@ -229,6 +202,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -239,6 +213,7 @@
'doctype': u'DocField',
'fieldname': u'purpose',
'fieldtype': u'Select',
'hidden': 0,
'in_filter': 1,
'label': u'Purpose',
'no_copy': 0,
@ -246,6 +221,7 @@
'oldfieldtype': u'Select',
'options': u'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order\nOther',
'permlevel': 0,
'print_hide': 0,
'report_hide': 0,
'reqd': 1,
'search_index': 0,
@ -269,6 +245,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 1,
'trigger': u'Client'
},
@ -290,6 +267,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 1,
'trigger': u'Client'
},
@ -301,7 +279,7 @@
'fieldtype': u'Link',
'hidden': 1,
'label': u'Sales Invoice No',
'options': u'Sales Invoice',
'options': u'Receivable Voucher',
'permlevel': 0,
'print_hide': 1
},
@ -313,7 +291,7 @@
'doctype': u'DocField',
'fieldname': u'supplier',
'fieldtype': u'Link',
'hidden': 1,
'hidden': 0,
'in_filter': 0,
'label': u'Supplier',
'no_copy': 0,
@ -323,6 +301,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
@ -333,13 +312,16 @@
'doctype': u'DocField',
'fieldname': u'supplier_name',
'fieldtype': u'Data',
'hidden': 0,
'in_filter': 0,
'label': u'Supplier Name',
'no_copy': 0,
'oldfieldname': u'supplier_name',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -350,14 +332,16 @@
'doctype': u'DocField',
'fieldname': u'supplier_address',
'fieldtype': u'Small Text',
'hidden': 1,
'hidden': 0,
'in_filter': 0,
'label': u'Supplier Address',
'no_copy': 0,
'oldfieldname': u'supplier_address',
'oldfieldtype': u'Small Text',
'permlevel': 0,
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
@ -369,7 +353,7 @@
'doctype': u'DocField',
'fieldname': u'customer',
'fieldtype': u'Link',
'hidden': 1,
'hidden': 0,
'in_filter': 0,
'label': u'Customer',
'no_copy': 0,
@ -379,6 +363,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
@ -389,14 +374,16 @@
'doctype': u'DocField',
'fieldname': u'customer_name',
'fieldtype': u'Data',
'hidden': 1,
'hidden': 0,
'in_filter': 0,
'label': u'Customer Name',
'no_copy': 0,
'oldfieldname': u'customer_name',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -406,14 +393,16 @@
'doctype': u'DocField',
'fieldname': u'customer_address',
'fieldtype': u'Small Text',
'hidden': 1,
'hidden': 0,
'in_filter': 0,
'label': u'Customer Address',
'no_copy': 0,
'oldfieldname': u'customer_address',
'oldfieldtype': u'Small Text',
'permlevel': 0,
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -434,6 +423,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
@ -455,6 +445,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 1,
'trigger': u'Client'
},
@ -466,7 +457,7 @@
'fieldname': u'bom_no',
'fieldtype': u'Link',
'label': u'BOM No',
'options': u'BOM',
'options': u'Bill Of Materials',
'permlevel': 0
},
@ -489,6 +480,7 @@
'doctype': u'DocField',
'fieldname': u'fg_completed_qty',
'fieldtype': u'Currency',
'hidden': 0,
'in_filter': 0,
'label': u'FG Completed Qty',
'no_copy': 0,
@ -497,6 +489,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
@ -505,7 +498,6 @@
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'warehouse_html',
'fieldtype': u'HTML',
'label': u'Warehouse HTML',
'no_copy': 0,
@ -522,6 +514,7 @@
'doctype': u'DocField',
'fieldname': u'from_warehouse',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 0,
'label': u'Source Warehouse',
'no_copy': 0,
@ -544,6 +537,7 @@
'doctype': u'DocField',
'fieldname': u'to_warehouse',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 0,
'label': u'Target Warehouse',
'no_copy': 0,
@ -574,7 +568,6 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break1',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
@ -588,6 +581,7 @@
'doctype': u'DocField',
'fieldname': u'transfer_date',
'fieldtype': u'Date',
'hidden': 0,
'in_filter': 1,
'label': u'Transfer Date',
'no_copy': 1,
@ -607,6 +601,7 @@
'doctype': u'DocField',
'fieldname': u'posting_date',
'fieldtype': u'Date',
'hidden': 0,
'in_filter': 1,
'label': u'Posting Date',
'no_copy': 1,
@ -625,6 +620,7 @@
'doctype': u'DocField',
'fieldname': u'posting_time',
'fieldtype': u'Time',
'hidden': 0,
'in_filter': 0,
'label': u'Posting Time',
'no_copy': 1,
@ -643,6 +639,7 @@
'doctype': u'DocField',
'fieldname': u'amended_from',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 0,
'label': u'Amended From',
'no_copy': 1,
@ -652,6 +649,7 @@
'permlevel': 1,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -661,6 +659,7 @@
'doctype': u'DocField',
'fieldname': u'transporter',
'fieldtype': u'Data',
'hidden': 0,
'in_filter': 0,
'label': u'Transporter',
'no_copy': 0,
@ -669,6 +668,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -678,6 +678,7 @@
'doctype': u'DocField',
'fieldname': u'is_excisable_goods',
'fieldtype': u'Select',
'hidden': 0,
'in_filter': 0,
'label': u'Is Excisable Goods',
'no_copy': 0,
@ -687,6 +688,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -696,6 +698,7 @@
'doctype': u'DocField',
'fieldname': u'excisable_goods',
'fieldtype': u'Select',
'hidden': 0,
'in_filter': 0,
'label': u'Excisable Goods',
'no_copy': 0,
@ -705,6 +708,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -724,6 +728,7 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -733,6 +738,7 @@
'doctype': u'DocField',
'fieldname': u'remarks',
'fieldtype': u'Text',
'hidden': 0,
'in_filter': 0,
'label': u'Remarks',
'no_copy': 1,
@ -767,7 +773,6 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'items',
'fieldtype': u'Section Break',
'label': u'Items',
'oldfieldtype': u'Section Break',
@ -777,7 +782,6 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'get_stock_and_rate',
'fieldtype': u'Button',
'label': u'Get Stock and Rate',
'oldfieldtype': u'Button',
@ -789,7 +793,6 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break2',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0
@ -800,7 +803,6 @@
'allow_on_submit': 0,
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'get_items',
'fieldtype': u'Button',
'hidden': 0,
'in_filter': 0,
@ -811,13 +813,13 @@
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'oldfieldtype': u'Section Break',
'options': u'Simple',
@ -831,6 +833,7 @@
'doctype': u'DocField',
'fieldname': u'mtn_details',
'fieldtype': u'Table',
'hidden': 0,
'in_filter': 0,
'label': u'MTN Details',
'no_copy': 0,
@ -840,6 +843,7 @@
'permlevel': 0,
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
@ -849,6 +853,7 @@
'doctype': u'DocField',
'fieldname': u'total_amount',
'fieldtype': u'Currency',
'hidden': 0,
'in_filter': 0,
'label': u'Total Amount',
'no_copy': 0,
@ -857,13 +862,13 @@
'permlevel': 1,
'print_hide': 1,
'report_hide': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'other_details',
'fieldtype': u'Section Break',
'label': u'Other Details',
'oldfieldtype': u'Section Break',
@ -876,6 +881,7 @@
'doctype': u'DocField',
'fieldname': u'company',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 1,
'label': u'Company',
'no_copy': 0,
@ -895,6 +901,7 @@
'doctype': u'DocField',
'fieldname': u'fiscal_year',
'fieldtype': u'Select',
'hidden': 0,
'in_filter': 0,
'label': u'Fiscal Year',
'no_copy': 0,
@ -914,6 +921,7 @@
'doctype': u'DocField',
'fieldname': u'select_print_heading',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 0,
'label': u'Select Print Heading',
'no_copy': 0,
@ -921,7 +929,9 @@
'oldfieldtype': u'Link',
'options': u'Print Heading',
'permlevel': 0,
'print_hide': 0,
'report_hide': 0,
'reqd': 0,
'search_index': 0
}
]

View File

@ -1 +1 @@
1687
1687