[selling/buying] [fixes] fixes in client side code, server side code, print formats

This commit is contained in:
Anand Doshi
2013-05-28 17:23:36 +05:30
parent a3d8494c77
commit 923d41dfd2
37 changed files with 352 additions and 324 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -18,16 +18,11 @@ cur_frm.cscript.tname = "Purchase Invoice Item";
cur_frm.cscript.fname = "entries";
cur_frm.cscript.other_fname = "purchase_tax_details";
wn.provide("erpnext.accounts");
wn.require('app/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
wn.provide("erpnext.accounts");
erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.extend({
setup: function() {
this._super();
},
onload: function() {
this._super();
@@ -44,13 +39,13 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
// Show / Hide button
if(doc.docstatus==1 && doc.outstanding_amount > 0)
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
this.frm.add_custom_button('Make Payment Entry', this.make_bank_voucher);
if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
this.frm.add_custom_button('View Ledger', this.view_ledger_entry);
}
cur_frm.cscript.is_opening(doc);
this.is_opening(doc);
},
credit_to: function() {
@@ -63,13 +58,13 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
},
allocated_amount: function() {
this.calculate_total_advance();
this.calculate_total_advance("Purchase Invoice", "advance_allocation_details");
this.frm.refresh_fields();
},
}
});
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.PurchaseInvoiceController({frm: cur_frm}));
$.extend(cur_frm.cscript, new erpnext.accounts.PurchaseInvoiceController({frm: cur_frm}));
cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {

View File

@@ -92,7 +92,7 @@ class DocType(BuyingController):
return ret
def set_supplier_defaults(self):
# TODO cleanup these methods
self.doc.fields.update(self.get_cust())
self.doc.fields.update(self.get_credit_to())
super(DocType, self).set_supplier_defaults()

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-05-07 13:50:30",
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-05-13 11:12:56",
"modified": "2013-05-28 12:18:35",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -89,10 +89,11 @@
"read_only": 0
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "supplier_name",
"fieldtype": "Text",
"hidden": 1,
"hidden": 0,
"in_list_view": 1,
"label": "Name",
"oldfieldname": "supplier_name",
@@ -100,34 +101,38 @@
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
"hidden": 0,
"label": "Address",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_display",
"fieldtype": "Small Text",
"hidden": 1,
"hidden": 0,
"label": "Contact",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_mobile",
"fieldtype": "Text",
"hidden": 1,
"hidden": 0,
"label": "Mobile No",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_email",
"fieldtype": "Text",
"hidden": 1,
"hidden": 0,
"label": "Contact Email",
"print_hide": 1,
"read_only": 1
@@ -392,6 +397,7 @@
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_section",
"fieldtype": "Section Break",
@@ -399,7 +405,6 @@
"read_only": 0
},
{
"depends_on": "eval:doc.supplier",
"doctype": "DocField",
"fieldname": "supplier_address",
"fieldtype": "Link",
@@ -415,7 +420,6 @@
"width": "50%"
},
{
"depends_on": "eval:doc.supplier",
"doctype": "DocField",
"fieldname": "contact_person",
"fieldtype": "Link",

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-04-19 11:00:06",
"creation": "2013-05-21 16:16:04",
"docstatus": 0,
"modified": "2013-05-07 11:23:56",
"modified": "2013-05-28 12:02:02",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -101,7 +101,7 @@
"oldfieldname": "tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"read_only": 0,
"read_only": 1,
"reqd": 0
},
{
@@ -159,35 +159,5 @@
"print_hide": 1,
"read_only": 0,
"search_index": 0
},
{
"description": "Cheating Field\nPlease do not delete ",
"doctype": "DocField",
"fieldname": "total_tax_amount",
"fieldtype": "Currency",
"hidden": 1,
"label": "Total +Tax",
"no_copy": 1,
"oldfieldname": "total_tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"read_only": 0,
"report_hide": 1
},
{
"description": "Cheating Field\nPlease do not delete ",
"doctype": "DocField",
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 1,
"label": "Tax Amount",
"no_copy": 1,
"oldfieldname": "total_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"read_only": 0,
"report_hide": 1
}
]

View File

@@ -79,23 +79,19 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
},
allocated_amount: function() {
this.calculate_total_advance();
this.calculate_total_advance("Sales Invoice", "advance_adjustment_details");
this.frm.refresh_fields();
},
write_off_outstanding_amount_automatically: function() {
if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
wn.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
// this will make outstanding amount 0
this.frm.set_value("write_off_amount",
flt(this.frm.doc.grand_total - this.frm.doc.paid_amount), precision("write_off_amount"));
}
this.frm.runclientscript("write_off_amount");
// TODO doubt?
// if write off amount = grand total - paid amount
// then why is outstanding amount = grand total - write off amount - paid amount - advance
// when write off amount already is grand total - paid amount!
},
write_off_amount: function() {
@@ -137,8 +133,6 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], false);
}
cur_frm.toggle_display("contact_section", doc.customer);
// India related fields
var cp = wn.control_panel;
if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-05-21 16:16:41",
"creation": "2013-05-24 19:29:05",
"docstatus": 0,
"modified": "2013-05-21 18:25:07",
"modified": "2013-05-28 12:43:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -120,10 +120,11 @@
"read_only": 0
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 1,
"hidden": 0,
"in_list_view": 1,
"label": "Name",
"oldfieldname": "customer_name",
@@ -131,34 +132,38 @@
"read_only": 1
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
"hidden": 0,
"label": "Address",
"read_only": 1
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "contact_display",
"fieldtype": "Small Text",
"hidden": 1,
"hidden": 0,
"label": "Contact",
"read_only": 1
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "contact_mobile",
"fieldtype": "Text",
"hidden": 1,
"hidden": 0,
"label": "Mobile No",
"read_only": 1
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "contact_email",
"fieldtype": "Text",
"hidden": 1,
"hidden": 0,
"label": "Contact Email",
"print_hide": 1,
"read_only": 1
@@ -748,6 +753,7 @@
"read_only": 0
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "contact_section",
"fieldtype": "Section Break",

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-02-22 01:27:41",
"creation": "2013-04-24 11:39:32",
"docstatus": 0,
"modified": "2013-04-17 14:05:50",
"modified": "2013-05-28 11:59:02",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -85,6 +85,7 @@
"oldfieldname": "tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"read_only": 1,
"reqd": 0
},
{
@@ -128,34 +129,6 @@
"print_hide": 1,
"search_index": 1
},
{
"description": "Cheating Field\nPlease do not delete ",
"doctype": "DocField",
"fieldname": "total_tax_amount",
"fieldtype": "Currency",
"hidden": 1,
"label": "Total Tax Amount",
"no_copy": 1,
"oldfieldname": "total_tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"report_hide": 1
},
{
"description": "Cheating Field\nPlease do not delete ",
"doctype": "DocField",
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 1,
"label": "Total Amount",
"no_copy": 1,
"oldfieldname": "total_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"report_hide": 1
},
{
"allow_on_submit": 0,
"description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount",