Show write-off section if pos or advance payment

This commit is contained in:
Anand Doshi 2015-04-01 16:25:21 +05:30
parent 4c8d01ba9e
commit 8ea1ed143b
2 changed files with 13 additions and 9 deletions

View File

@ -176,6 +176,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
this.frm.set_value("write_off_amount",
flt(this.frm.doc.base_grand_total - this.frm.doc.paid_amount, precision("write_off_amount"))
);
this.frm.toggle_enable("write_off_amount", false);
} else {
this.frm.toggle_enable("write_off_amount", true);
}
this.calculate_outstanding_amount(false);
@ -219,10 +223,8 @@ cur_frm.cscript.hide_fields = function(doc) {
if(cint(doc.is_pos) == 1) {
hide_field(par_flds);
unhide_field('payments_section');
cur_frm.fields_dict['items'].grid.set_column_disp(item_flds_normal, false);
} else {
hide_field('payments_section');
for (i in par_flds) {
var docfield = frappe.meta.docfield_map[doc.doctype][par_flds[i]];
if(!docfield.hidden) unhide_field(par_flds[i]);
@ -238,6 +240,8 @@ cur_frm.cscript.hide_fields = function(doc) {
if (frappe.boot.sysdefaults.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
else hide_field(['c_form_applicable', 'c_form_no']);
this.frm.toggle_enable("write_off_amount", !!!cint(doc.write_off_outstanding_amount_automatically));
cur_frm.refresh_fields();
}

View File

@ -654,7 +654,7 @@
"read_only": 0
},
{
"depends_on": "is_pos",
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
"fieldname": "payments_section",
"fieldtype": "Section Break",
"label": "Payments",
@ -696,7 +696,7 @@
"read_only": 0
},
{
"depends_on": "is_pos",
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
"fieldname": "column_break4",
"fieldtype": "Column Break",
"permlevel": 0,
@ -704,7 +704,7 @@
"width": "50%"
},
{
"depends_on": "is_pos",
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
"fieldname": "write_off_outstanding_amount_automatically",
"fieldtype": "Check",
"label": "Write Off Outstanding Amount",
@ -713,7 +713,7 @@
"read_only": 0
},
{
"depends_on": "is_pos",
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
"fieldname": "write_off_amount",
"fieldtype": "Currency",
"label": "Write Off Amount",
@ -724,7 +724,7 @@
"read_only": 0
},
{
"depends_on": "is_pos",
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
"fieldname": "write_off_account",
"fieldtype": "Link",
"label": "Write Off Account",
@ -734,7 +734,7 @@
"read_only": 0
},
{
"depends_on": "is_pos",
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
"fieldname": "write_off_cost_center",
"fieldtype": "Link",
"label": "Write Off Cost Center",
@ -1246,7 +1246,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2015-03-23 14:46:49.412013",
"modified": "2015-04-01 06:50:49.748285",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",