Introduced C-form for Indian customer
This commit is contained in:
parent
cde8bec0a6
commit
fd20340576
@ -5,7 +5,7 @@
|
|||||||
{
|
{
|
||||||
'creation': '2010-09-25 10:50:37',
|
'creation': '2010-09-25 10:50:37',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2011-09-27 12:44:04',
|
'modified': '2011-12-07 16:18:28',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'Administrator'
|
'owner': 'Administrator'
|
||||||
},
|
},
|
||||||
@ -179,6 +179,15 @@
|
|||||||
'doctype': 'Module Def Item'
|
'doctype': 'Module Def Item'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# Module Def Item
|
||||||
|
{
|
||||||
|
'description': 'Track C-Form received from customers',
|
||||||
|
'display_name': 'C-Form',
|
||||||
|
'doc_name': 'C-Form',
|
||||||
|
'doc_type': 'Setup Forms',
|
||||||
|
'doctype': 'Module Def Item'
|
||||||
|
},
|
||||||
|
|
||||||
# Module Def Item
|
# Module Def Item
|
||||||
{
|
{
|
||||||
'display_name': 'General Ledger',
|
'display_name': 'General Ledger',
|
||||||
|
|||||||
0
erpnext/accounts/doctype/c_form/__init__.py
Normal file
0
erpnext/accounts/doctype/c_form/__init__.py
Normal file
10
erpnext/accounts/doctype/c_form/c_form.js
Normal file
10
erpnext/accounts/doctype/c_form/c_form.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
//c-form js file
|
||||||
|
// -----------------------------
|
||||||
|
cur_frm.fields_dict.invoice_details.grid.get_field("invoice_no").get_query = function(doc) {
|
||||||
|
return 'SELECT `tabReceivable Voucher`.`name` FROM `tabReceivable Voucher` WHERE `tabReceivable Voucher`.`company` = "' +doc.company+'" AND `tabReceivable Voucher`.%(key)s LIKE "%s" AND `tabReceivable Voucher`.`customer` = "' + doc.customer + '" AND `tabReceivable Voucher`.`docstatus` = 1 and `tabReceivable Voucher`.`c_form_applicable` = "Yes" ORDER BY `tabReceivable Voucher`.`name` ASC LIMIT 50';
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
|
||||||
|
var d = locals[cdt][cdn];
|
||||||
|
get_server_fields('get_invoice_details', d.invoice_no, 'invoice_details', doc, cdt, cdn, 1);
|
||||||
|
}
|
||||||
34
erpnext/accounts/doctype/c_form/c_form.py
Normal file
34
erpnext/accounts/doctype/c_form/c_form.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Please edit this list and import only required elements
|
||||||
|
import webnotes
|
||||||
|
from webnotes.utils import add_days, cint, cstr, date_diff, default_fields, flt, getdate, now, nowdate
|
||||||
|
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||||
|
from webnotes.model.doclist import getlist, copy_doclist
|
||||||
|
from webnotes.model.code import get_obj
|
||||||
|
from webnotes import msgprint, errprint
|
||||||
|
|
||||||
|
sql = webnotes.conn.sql
|
||||||
|
# -----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
class DocType:
|
||||||
|
def __init__(self,d,dl):
|
||||||
|
self.doc, self.doclist = d,dl
|
||||||
|
|
||||||
|
def autoname(self):
|
||||||
|
self.doc.name = make_autoname(self.doc.naming_series + '.#####')
|
||||||
|
|
||||||
|
def on_update(self):
|
||||||
|
inv = "'" + "', '".join([d.invoice_no for d in getlist(self.doclist, 'invoice_details')]) + "'"
|
||||||
|
sql("""update `tabReceivable Voucher` set c_form_no = '%s', modified ='%s'
|
||||||
|
where name in (%s)"""%(self.doc.name, self.doc.modified, inv))
|
||||||
|
|
||||||
|
def get_invoice_details(self, invoice_no):
|
||||||
|
inv = sql("""select posting_date, territory, net_total, grand_total from
|
||||||
|
`tabReceivable Voucher` where name = %s""", invoice_no)
|
||||||
|
ret = {
|
||||||
|
'invoice_date' : inv and getdate(inv[0][0]).strftime('%Y-%m-%d') or '',
|
||||||
|
'territory' : inv and inv[0][1] or '',
|
||||||
|
'net_total' : inv and flt(inv[0][2]) or '',
|
||||||
|
'grand_total' : inv and flt(inv[0][3]) or ''
|
||||||
|
}
|
||||||
|
return ret
|
||||||
190
erpnext/accounts/doctype/c_form/c_form.txt
Normal file
190
erpnext/accounts/doctype/c_form/c_form.txt
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
# DocType, C-Form
|
||||||
|
[
|
||||||
|
|
||||||
|
# These values are common in all dictionaries
|
||||||
|
{
|
||||||
|
'creation': '2011-12-07 16:16:16',
|
||||||
|
'docstatus': 0,
|
||||||
|
'modified': '2011-12-07 17:50:17',
|
||||||
|
'modified_by': 'Administrator',
|
||||||
|
'owner': 'Administrator'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocType
|
||||||
|
{
|
||||||
|
'_last_update': '1323255350',
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'module': 'Accounts',
|
||||||
|
'name': '__common__',
|
||||||
|
'section_style': 'Simple',
|
||||||
|
'show_in_menu': 0,
|
||||||
|
'version': 11
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'name': '__common__',
|
||||||
|
'parent': 'C-Form',
|
||||||
|
'parentfield': 'fields',
|
||||||
|
'parenttype': 'DocType',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocPerm
|
||||||
|
{
|
||||||
|
'doctype': 'DocPerm',
|
||||||
|
'name': '__common__',
|
||||||
|
'parent': 'C-Form',
|
||||||
|
'parentfield': 'permissions',
|
||||||
|
'parenttype': 'DocType',
|
||||||
|
'read': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocType, C-Form
|
||||||
|
{
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'name': 'C-Form'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'create': 1,
|
||||||
|
'doctype': 'DocPerm',
|
||||||
|
'permlevel': 0,
|
||||||
|
'role': 'Accounts User',
|
||||||
|
'write': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'create': 1,
|
||||||
|
'doctype': 'DocPerm',
|
||||||
|
'permlevel': 0,
|
||||||
|
'role': 'Accounts Manager',
|
||||||
|
'submit': 0,
|
||||||
|
'write': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'doctype': 'DocPerm',
|
||||||
|
'permlevel': 1,
|
||||||
|
'role': 'All'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldtype': 'Column Break',
|
||||||
|
'width': '50%'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'naming_series',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Series',
|
||||||
|
'options': '\nC-FORM/',
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'c_form_no',
|
||||||
|
'fieldtype': 'Data',
|
||||||
|
'label': 'C-Form No',
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'received_date',
|
||||||
|
'fieldtype': 'Date',
|
||||||
|
'label': 'Received Date',
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'customer',
|
||||||
|
'fieldtype': 'Link',
|
||||||
|
'label': 'Customer',
|
||||||
|
'options': 'Customer',
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldtype': 'Column Break',
|
||||||
|
'width': '50%'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'company',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Company',
|
||||||
|
'options': 'link:Company'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'fiscal_year',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Fiscal Year',
|
||||||
|
'options': 'link:Fiscal Year',
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'quarter',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Quarter',
|
||||||
|
'options': '\nI\nII\nIII\nIV'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'total_amount',
|
||||||
|
'fieldtype': 'Currency',
|
||||||
|
'label': 'Total Amount',
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'state',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'State',
|
||||||
|
'options': "link:State\ncountry='India'",
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldtype': 'Section Break'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'invoice_details',
|
||||||
|
'fieldtype': 'Table',
|
||||||
|
'label': 'Invoice Details',
|
||||||
|
'options': 'C-Form Invoice Detail'
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
# DocType, C-Form Invoice Detail
|
||||||
|
[
|
||||||
|
|
||||||
|
# These values are common in all dictionaries
|
||||||
|
{
|
||||||
|
'creation': '2011-12-07 16:15:39',
|
||||||
|
'docstatus': 0,
|
||||||
|
'modified': '2011-12-07 16:21:55',
|
||||||
|
'modified_by': 'Administrator',
|
||||||
|
'owner': 'Administrator'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocType
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'istable': 1,
|
||||||
|
'module': 'Accounts',
|
||||||
|
'name': '__common__',
|
||||||
|
'section_style': 'Simple',
|
||||||
|
'show_in_menu': 0,
|
||||||
|
'version': 5
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'name': '__common__',
|
||||||
|
'parent': 'C-Form Invoice Detail',
|
||||||
|
'parentfield': 'fields',
|
||||||
|
'parenttype': 'DocType'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocType, C-Form Invoice Detail
|
||||||
|
{
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'name': 'C-Form Invoice Detail'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'invoice_no',
|
||||||
|
'fieldtype': 'Link',
|
||||||
|
'label': 'Invoice No',
|
||||||
|
'options': 'Receivable Voucher',
|
||||||
|
'permlevel': 0,
|
||||||
|
'width': '160px'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'invoice_date',
|
||||||
|
'fieldtype': 'Date',
|
||||||
|
'label': 'Invoice Date',
|
||||||
|
'permlevel': 1,
|
||||||
|
'width': '120px'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'territory',
|
||||||
|
'fieldtype': 'Link',
|
||||||
|
'label': 'Territory',
|
||||||
|
'options': 'Territory',
|
||||||
|
'permlevel': 1,
|
||||||
|
'width': '120px'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'net_total',
|
||||||
|
'fieldtype': 'Currency',
|
||||||
|
'label': 'Net Total',
|
||||||
|
'permlevel': 1,
|
||||||
|
'width': '120px'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'grand_total',
|
||||||
|
'fieldtype': 'Currency',
|
||||||
|
'label': 'Grand Total',
|
||||||
|
'permlevel': 1,
|
||||||
|
'width': '120px'
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -397,6 +397,14 @@ class DocType(TransactionBase):
|
|||||||
if flt(self.doc.write_off_amount) and not self.doc.write_off_account:
|
if flt(self.doc.write_off_amount) and not self.doc.write_off_account:
|
||||||
msgprint("Please enter Write Off Account", raise_exception=1)
|
msgprint("Please enter Write Off Account", raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_c_form(self):
|
||||||
|
""" Blank C-form no if C-form applicable marked as 'No'"""
|
||||||
|
if self.doc.amended_from and self.doc.c_form_applicable == 'No' and self.doc.c_form_no:
|
||||||
|
sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
|
||||||
|
and parent = %s""", (self.doc.amended_from, self.doc.c_form_no))
|
||||||
|
|
||||||
|
set(self.doc, 'c_form_no', '')
|
||||||
|
|
||||||
# VALIDATE
|
# VALIDATE
|
||||||
# ====================================================================================
|
# ====================================================================================
|
||||||
@ -432,6 +440,7 @@ class DocType(TransactionBase):
|
|||||||
self.clear_advances()
|
self.clear_advances()
|
||||||
# Set against account
|
# Set against account
|
||||||
self.set_against_income_account()
|
self.set_against_income_account()
|
||||||
|
self.validate_c_form()
|
||||||
|
|
||||||
|
|
||||||
# *************************************************** ON SUBMIT **********************************************
|
# *************************************************** ON SUBMIT **********************************************
|
||||||
@ -554,10 +563,21 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
if not cint(self.doc.is_pos) == 1:
|
if not cint(self.doc.is_pos) == 1:
|
||||||
self.update_against_document_in_jv()
|
self.update_against_document_in_jv()
|
||||||
|
|
||||||
|
self.update_c_form()
|
||||||
|
|
||||||
# on submit notification
|
# on submit notification
|
||||||
# get_obj('Notification Control').notify_contact('Sales Invoice', self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
|
# get_obj('Notification Control').notify_contact('Sales Invoice', self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
|
||||||
|
|
||||||
|
|
||||||
|
def update_c_form(self):
|
||||||
|
"""Update amended id in C-form"""
|
||||||
|
if self.doc.c_form_no and self.doc.amended_from:
|
||||||
|
sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
|
||||||
|
invoice_date = %s, territory = %s, net_total = %s,
|
||||||
|
grand_total = %s where invoice_no = %s and parent = %s""", (self.doc.name, self.doc.amended_from, self.doc.c_form_no))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# *************************************************** ON CANCEL **********************************************
|
# *************************************************** ON CANCEL **********************************************
|
||||||
# Check Next Document's docstatus
|
# Check Next Document's docstatus
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
{
|
{
|
||||||
'creation': '2010-08-08 17:09:18',
|
'creation': '2010-08-08 17:09:18',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2011-12-06 13:17:26',
|
'modified': '2011-12-08 16:28:22',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'Administrator'
|
'owner': 'Administrator'
|
||||||
},
|
},
|
||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
# These values are common for all DocType
|
# These values are common for all DocType
|
||||||
{
|
{
|
||||||
'_last_update': '1323156733',
|
'_last_update': '1323341785',
|
||||||
'change_log': '1. Change in pull_details method dt.-26-06-2009',
|
'change_log': '1. Change in pull_details method dt.-26-06-2009',
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
'default_print_format': 'Standard',
|
'default_print_format': 'Standard',
|
||||||
@ -34,7 +34,7 @@
|
|||||||
'server_code_error': ' ',
|
'server_code_error': ' ',
|
||||||
'show_in_menu': 0,
|
'show_in_menu': 0,
|
||||||
'subject': 'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
|
'subject': 'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
|
||||||
'version': 383
|
'version': 388
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocFormat
|
# These values are common for all DocFormat
|
||||||
@ -971,6 +971,31 @@
|
|||||||
'permlevel': 0
|
'permlevel': 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'c_form_applicable',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'C-Form Applicable',
|
||||||
|
'no_copy': 1,
|
||||||
|
'options': 'No\nYes',
|
||||||
|
'permlevel': 0,
|
||||||
|
'print_hide': 1,
|
||||||
|
'report_hide': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'c_form_no',
|
||||||
|
'fieldtype': 'Link',
|
||||||
|
'label': 'C-Form No',
|
||||||
|
'no_copy': 1,
|
||||||
|
'options': 'C-Form',
|
||||||
|
'permlevel': 1,
|
||||||
|
'print_hide': 1
|
||||||
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user