Show write-off section if pos or advance payment
This commit is contained in:
parent
4c8d01ba9e
commit
8ea1ed143b
@ -176,6 +176,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
this.frm.set_value("write_off_amount",
|
this.frm.set_value("write_off_amount",
|
||||||
flt(this.frm.doc.base_grand_total - this.frm.doc.paid_amount, precision("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);
|
this.calculate_outstanding_amount(false);
|
||||||
@ -219,10 +223,8 @@ cur_frm.cscript.hide_fields = function(doc) {
|
|||||||
|
|
||||||
if(cint(doc.is_pos) == 1) {
|
if(cint(doc.is_pos) == 1) {
|
||||||
hide_field(par_flds);
|
hide_field(par_flds);
|
||||||
unhide_field('payments_section');
|
|
||||||
cur_frm.fields_dict['items'].grid.set_column_disp(item_flds_normal, false);
|
cur_frm.fields_dict['items'].grid.set_column_disp(item_flds_normal, false);
|
||||||
} else {
|
} else {
|
||||||
hide_field('payments_section');
|
|
||||||
for (i in par_flds) {
|
for (i in par_flds) {
|
||||||
var docfield = frappe.meta.docfield_map[doc.doctype][par_flds[i]];
|
var docfield = frappe.meta.docfield_map[doc.doctype][par_flds[i]];
|
||||||
if(!docfield.hidden) unhide_field(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']);
|
if (frappe.boot.sysdefaults.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
|
||||||
else hide_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();
|
cur_frm.refresh_fields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@
|
|||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "is_pos",
|
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
|
||||||
"fieldname": "payments_section",
|
"fieldname": "payments_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Payments",
|
"label": "Payments",
|
||||||
@ -696,7 +696,7 @@
|
|||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "is_pos",
|
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
|
||||||
"fieldname": "column_break4",
|
"fieldname": "column_break4",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -704,7 +704,7 @@
|
|||||||
"width": "50%"
|
"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",
|
"fieldname": "write_off_outstanding_amount_automatically",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Write Off Outstanding Amount",
|
"label": "Write Off Outstanding Amount",
|
||||||
@ -713,7 +713,7 @@
|
|||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "is_pos",
|
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
|
||||||
"fieldname": "write_off_amount",
|
"fieldname": "write_off_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Write Off Amount",
|
"label": "Write Off Amount",
|
||||||
@ -724,7 +724,7 @@
|
|||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "is_pos",
|
"depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
|
||||||
"fieldname": "write_off_account",
|
"fieldname": "write_off_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Write Off Account",
|
"label": "Write Off Account",
|
||||||
@ -734,7 +734,7 @@
|
|||||||
"read_only": 0
|
"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",
|
"fieldname": "write_off_cost_center",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Write Off Cost Center",
|
"label": "Write Off Cost Center",
|
||||||
@ -1246,7 +1246,7 @@
|
|||||||
"icon": "icon-file-text",
|
"icon": "icon-file-text",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2015-03-23 14:46:49.412013",
|
"modified": "2015-04-01 06:50:49.748285",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice",
|
"name": "Sales Invoice",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user