[merge conflict]

This commit is contained in:
Nabin Hait
2013-06-05 12:37:10 +05:30
220 changed files with 4854 additions and 5516 deletions

View File

@@ -20,84 +20,36 @@ cur_frm.cscript.fname = "delivery_note_details";
cur_frm.cscript.other_fname = "other_charges";
cur_frm.cscript.sales_team_fname = "sales_team";
wn.require('app/selling/doctype/sales_common/sales_common.js');
wn.require('app/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
wn.require('app/utilities/doctype/sms_control/sms_control.js');
wn.require('app/selling/doctype/sales_common/sales_common.js');
// ONLOAD
// ================================================================================================
cur_frm.cscript.onload = function(doc, dt, dn) {
cur_frm.cscript.manage_rounded_total();
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()});
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
if(doc.__islocal && doc.customer) cur_frm.cscript.customer(doc,dt,dn,onload=true);
if(!doc.price_list_currency) {
set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate:1});
}
wn.provide("erpnext.stock");
erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
refresh: function(doc, dt, dn) {
this._super();
if(doc.__islocal){
hide_field(['customer_address', 'contact_person', 'customer_name',
'address_display', 'contact_display', 'contact_mobile',
'contact_email', 'territory', 'customer_group']);
}
}
if(flt(doc.per_billed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']);
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
// defined in sales_common.js
var callback = function(doc, dt, dn) {
if(doc.__islocal) cur_frm.cscript.update_item_details(doc, dt, dn);
if (doc.docstatus==1) cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
if(doc.docstatus==0 && !doc.__islocal) {
cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']);
}
set_print_hide(doc, dt, dn);
// unhide expense_account and cost_center is auto_inventory_accounting enabled
var aii_enabled = cint(sys_defaults.auto_inventory_accounting)
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("expense_account", aii_enabled);
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("cost_center", aii_enabled);
}
});
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
}
// REFRESH
// ================================================================================================
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.clear_custom_buttons();
erpnext.hide_naming_series();
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
if(flt(doc.per_billed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']);
if (doc.docstatus==1) cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
if(doc.docstatus==0 && !doc.__islocal) {
cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']);
}
cur_frm.toggle_display("contact_info", doc.customer);
set_print_hide(doc, cdt, cdn);
// unhide expense_account and cost_center is auto_inventory_accounting enabled
var aii_enabled = cint(sys_defaults.auto_inventory_accounting)
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("expense_account", aii_enabled);
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("cost_center", aii_enabled);
}
//customer
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
cur_frm.toggle_display("contact_info", doc.customer);
var pl = doc.price_list_name;
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
if(doc.customer)
unhide_field(['customer_address','contact_person','territory','customer_group']);
cur_frm.refresh();
if(!onload && (pl != doc.price_list_name)) cur_frm.cscript.price_list_name(doc, dt, dn);
}
var args = onload ? 'onload':''
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name),
'get_default_customer_shipping_address', args, callback);
}
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.stock.DeliveryNoteController({frm: cur_frm}));
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
@@ -157,11 +109,6 @@ cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
return repl('SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "%(company)s" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_delivered,0) < 99.99 and %(cond)s `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50', {company:doc.company,cond:cond})
}
cur_frm.cscript.delivery_type = function(doc, cdt, cdn) {
if (doc.delivery_type = 'Sample') cfn_set_fields(doc, cdt, cdn);
}
cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if (d.serial_no) {
@@ -169,17 +116,6 @@ cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
}
}
cur_frm.cscript.warehouse = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if (! d.item_code) {alert("please enter item code first"); return};
if (d.warehouse) {
arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.warehouse +"'}";
get_server_fields('get_actual_qty',arg,'delivery_note_details',doc,cdt,cdn,1);
}
}
cur_frm.fields_dict['transporter_name'].get_query = function(doc) {
return 'SELECT DISTINCT `tabSupplier`.`name` FROM `tabSupplier` WHERE `tabSupplier`.supplier_type = "transporter" AND `tabSupplier`.docstatus != 2 AND `tabSupplier`.%(key)s LIKE "%s" ORDER BY `tabSupplier`.`name` LIMIT 50';
}

View File

@@ -34,6 +34,9 @@ class DocType(SellingController):
self.doclist = doclist
self.tname = 'Delivery Note Item'
self.fname = 'delivery_note_details'
def set_customer_defaults(self):
self.get_default_customer_shipping_address()
def validate_fiscal_year(self):
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
@@ -78,25 +81,6 @@ class DocType(SellingController):
def get_tc_details(self):
return get_obj('Sales Common').get_tc_details(self)
def get_item_details(self, args=None):
import json
args = args and json.loads(args) or {}
if args.get('item_code'):
return get_obj('Sales Common').get_item_details(args, self)
else:
obj = get_obj('Sales Common')
for doc in self.doclist:
if doc.fields.get('item_code'):
arg = {
'item_code':doc.fields.get('item_code'),
'expense_account':doc.fields.get('expense_account'),
'cost_center': doc.fields.get('cost_center'),
'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_defaults(arg)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
def get_barcode_details(self, barcode):
return get_obj('Sales Common').get_barcode_details(barcode)
@@ -105,25 +89,9 @@ class DocType(SellingController):
"""Re-calculates Basic Rate & amount based on Price List Selected"""
get_obj('Sales Common').get_adj_percent(self)
def get_actual_qty(self,args):
"""Get Actual Qty of item in warehouse selected"""
return get_obj('Sales Common').get_available_qty(eval(args))
def get_rate(self,arg):
return get_obj('Sales Common').get_rate(arg)
def load_default_taxes(self):
self.doclist = get_obj('Sales Common').load_default_taxes(self)
def get_other_charges(self):
"""Pull details from Sales Taxes and Charges Master"""
self.doclist = get_obj('Sales Common').get_other_charges(self)
def so_required(self):
"""check in manage account if sales order required or not"""
if webnotes.conn.get_value('Global Defaults', 'Global Defaults', 'so_required') == 'Yes':
@@ -152,7 +120,6 @@ class DocType(SellingController):
self.validate_warehouse()
sales_com_obj.validate_max_discount(self, 'delivery_note_details')
sales_com_obj.get_allocated_sum(self)
sales_com_obj.check_conversion_rate(self)
# Set actual qty for each item in selected warehouse
@@ -419,4 +386,4 @@ class DocType(SellingController):
if gl_entries:
from accounts.general_ledger import make_gl_entries
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-04-02 10:50:50",
"creation": "2013-05-24 19:29:09",
"docstatus": 0,
"modified": "2013-02-02 19:18:38",
"modified": "2013-05-28 12:26:04",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -76,10 +76,11 @@
"search_index": 1
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 1,
"hidden": 0,
"in_list_view": 1,
"label": "Customer Name",
"read_only": 1
@@ -96,34 +97,38 @@
"read_only": 1
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
"hidden": 0,
"label": "Shipping 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
@@ -223,7 +228,8 @@
"oldfieldtype": "Table",
"options": "Delivery Note Item",
"print_hide": 0,
"read_only": 0
"read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
@@ -255,12 +261,20 @@
"oldfieldname": "net_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 0,
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"reqd": 0,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "net_total_export",
"fieldtype": "Currency",
"label": "Net Total (Export)",
"options": "currency",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "recalculate_values",
@@ -435,6 +449,15 @@
"read_only": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "other_charges_total_export",
"fieldtype": "Currency",
"label": "Taxes and Charges Total (Export)",
"options": "company",
"print_hide": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "calculate_charges",
@@ -672,6 +695,7 @@
"width": "100px"
},
{
"depends_on": "customer",
"doctype": "DocField",
"fieldname": "contact_info",
"fieldtype": "Section Break",
@@ -1136,7 +1160,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Material User",
@@ -1159,7 +1182,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Material Manager",
@@ -1171,7 +1193,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"match": "",
"permlevel": 0,
"report": 1,
"role": "Sales User",
@@ -1183,7 +1204,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Sales User",
@@ -1205,7 +1225,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Accounts User",
"submit": 0

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-22 13:15:44",
"docstatus": 0,
"modified": "2013-05-22 12:05:32",
"modified": "2013-05-22 12:15:32",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -120,7 +120,7 @@
"options": "currency",
"print_hide": 1,
"print_width": "100px",
"read_only": 0,
"read_only": 1,
"reqd": 0,
"width": "100px"
},
@@ -189,7 +189,7 @@
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "150px",
"read_only": 0,
"read_only": 1,
"reqd": 0,
"width": "150px"
},

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-03 10:45:46",
"docstatus": 0,
"modified": "2013-05-22 15:48:27",
"modified": "2013-05-22 15:49:27",
"modified_by": "Administrator",
"owner": "Administrator"
},

View File

@@ -17,8 +17,8 @@
cur_frm.cscript.tname = "Material Request Item";
cur_frm.cscript.fname = "indent_details";
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
wn.require('app/utilities/doctype/sms_control/sms_control.js');
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.extend({
refresh: function(doc) {
@@ -48,43 +48,20 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
cur_frm.toggle_display("sales_order_no", false);
cur_frm.fields_dict.indent_details.grid.set_column_disp("sales_order_no", false);
}
},
validate_company_and_party: function(party_field) {
return true;
},
calculate_taxes_and_totals: function() {
return;
}
});
var new_cscript = new erpnext.buying.MaterialRequestController({frm: cur_frm});
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new_cscript);
$.extend(cur_frm.cscript, new erpnext.buying.MaterialRequestController({frm: cur_frm}));
cur_frm.cscript.onload = function(doc, cdt, cdn) {
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
if (!doc.status) doc.status = 'Draft';
// defined in purchase_common.js
//cur_frm.cscript.update_item_details(doc, cdt, cdn);
};
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
// second call
if(doc.__islocal){
cur_frm.cscript.get_item_defaults(doc);
}
};
cur_frm.cscript.get_item_defaults = function(doc) {
var ch = getchildren( 'Material Request Item', doc.name, 'indent_details');
if (flt(ch.length) > 0){
$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_defaults', '', function(r, rt) {refresh_field('indent_details'); });
}
};
cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
if(doc.__islocal){
cur_frm.cscript.get_default_schedule_date(doc);
}
};
cur_frm.cscript.qty = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if (flt(d.qty) < flt(d.min_order_qty))

View File

@@ -17,9 +17,6 @@ class DocType(BuyingController):
self.tname = 'Material Request Item'
self.fname = 'indent_details'
def get_default_schedule_date(self):
get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
# get available qty at warehouse
def get_bin_details(self, arg = ''):
return get_obj(dt='Purchase Common').get_bin_details(arg)
@@ -30,22 +27,12 @@ class DocType(BuyingController):
self.check_if_already_pulled()
if self.doc.sales_order_no:
get_obj('DocType Mapper', 'Sales Order-Material Request', with_children=1).dt_map('Sales Order', 'Material Request', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Material Request'],['Sales Order Item', 'Material Request Item']]")
self.get_item_defaults()
else:
msgprint("Please select Sales Order whose details need to pull")
def check_if_already_pulled(self):
pass#if self.[d.sales_order_no for d in getlist(self.doclist, 'indent_details')]
# Get item's other details
#- ------------------------
def get_item_defaults(self):
self.get_default_schedule_date()
for d in getlist(self.doclist, 'indent_details'):
det = webnotes.conn.sql("select min_order_qty from tabItem where name = '%s'" % d.item_code)
d.min_order_qty = det and flt(det[0][0]) or 0
# Validate so items
# ----------------------------
def validate_qty_against_so(self):

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 14:48:38",
"docstatus": 0,
"modified": "2013-02-25 15:38:02",
"modified": "2013-04-24 10:47:50",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -72,7 +72,7 @@
"oldfieldtype": "Section Break"
},
{
"allow_on_submit": 1,
"allow_on_submit": 0,
"doctype": "DocField",
"fieldname": "indent_details",
"fieldtype": "Table",

View File

@@ -19,10 +19,11 @@ cur_frm.cscript.fname = "purchase_receipt_details";
cur_frm.cscript.other_fname = "purchase_tax_details";
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.require('app/utilities/doctype/sms_control/sms_control.js');
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
erpnext.buying.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
wn.provide("erpnext.stock");
erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
refresh: function() {
this._super();
@@ -37,43 +38,49 @@ erpnext.buying.PurchaseReceiptController = erpnext.buying.BuyingController.exten
if(wn.boot.control_panel.country == 'India') {
unhide_field(['challan_no', 'challan_date']);
}
},
onload_post_render: function(doc, dt, dn) {
var me = this;
var callback = function(doc, dt, dn) {
me.update_item_details(doc, dt, dn, function(r,rt) { });
},
received_qty: function(doc, cdt, cdn) {
var item = wn.model.get_doc(cdt, cdn);
wn.model.round_floats_in(item, ["qty", "received_qty"]);
item.qty = (item.qty < item.received_qty) ? item.qty : item.received_qty;
this.qty(doc, cdt, cdn);
},
qty: function(doc, cdt, cdn) {
var item = wn.model.get_doc(cdt, cdn);
wn.model.round_floats_in(item, ["qty", "received_qty"]);
if(item.qty > item.received_qty) {
msgprint(wn._("Error") + ": " + wn._(wn.meta.get_label(item.doctype, "qty", item.name))
+ " > " + wn._(wn.meta.get_label(item.doctype, "received_qty", item.name)));
item.qty = item.rejected_qty = 0.0;
} else {
item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item));
}
// TODO: improve this
if(this.frm.doc.__islocal) {
if (this.frm.fields_dict.price_list_name && this.frm.doc.price_list_name)
this.price_list_name(callback);
else
callback(doc, dt, dn);
this._super();
},
rejected_qty: function(doc, cdt, cdn) {
var item = wn.model.get_doc(cdt, cdn);
wn.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
if(item.rejected_qty > item.received_qty) {
msgprint(wn._("Error") + ": " + wn._(wn.meta.get_label(item.doctype, "rejected_qty", item.name))
+ " > " + wn._(wn.meta.get_label(item.doctype, "received_qty", item.name)));
item.qty = item.rejected_qty = 0.0;
} else {
item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item));
}
}
this.qty(doc, cdt, cdn);
},
});
var new_cscript = new erpnext.buying.PurchaseReceiptController({frm: cur_frm});
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new_cscript);
cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(!doc.fiscal_year && doc.__islocal){ wn.model.set_default_values(doc);}
if (!doc.posting_date) doc.posting_date = dateutil.obj_to_str(new Date());
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
if (!doc.status) doc.status = 'Draft';
}
cur_frm.cscript.supplier = function(doc,dt,dn) {
if (doc.supplier) {
get_server_fields('get_default_supplier_address',
JSON.stringify({ supplier: doc.supplier }),'', doc, dt, dn, 1, function() {
cur_frm.refresh();
});
}
}
$.extend(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm}));
cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
@@ -151,81 +158,6 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
}
//========================= Received Qty =============================================================
cur_frm.cscript.received_qty = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
ret = {
'qty' : (flt(d.qty) && flt(d.qty) < flt(d.received_qty))
? flt(d.qty) : flt(d.received_qty),
'stock_qty': 0,
'rejected_qty' : 0,
}
set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
cur_frm.cscript.calc_amount(doc, 2);
}
//======================== Qty (Accepted Qty) =========================================================
cur_frm.cscript.qty = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
// Step 1 :=> Check If Qty > Received Qty
if (flt(d.qty) > flt(d.received_qty)) {
alert("Accepted Qty cannot be greater than Received Qty")
ret = {
'qty' : 0,
'stock_qty': 0,
'rejected_qty' : 0
}
// => Set Qty = 0 and rejected_qty = 0
set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
cur_frm.cscript.calc_amount(doc, 2);
// => Return
return
}
// Step 2 :=> Check IF Qty <= REceived Qty
else {
ret = {
'rejected_qty':flt(d.received_qty) - flt(d.qty)
}
// => Set Rejected Qty = Received Qty - Qty
set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
// => Calculate Amount
cur_frm.cscript.calc_amount(doc, 2);
cur_frm.cscript.update_stock_qty(doc,cdt,cdn);
}
}
//======================== Rejected Qty =========================================================
cur_frm.cscript.rejected_qty = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
// Step 1 :=> Check If Rejected Qty > Received Qty
if (flt(d.rejected_qty) > flt(d.received_qty)) {
alert("Rejected Qty cannot be greater than Received Qty")
ret = {
'qty' : 0,
'stock_qty': 0,
'rejected_qty' : 0
}
// => Set Qty = 0 and rejected_qty = 0
set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
cur_frm.cscript.calc_amount(doc, 2);
// => Return
return
}
// Step 2 :=> Check IF Rejected Qty <= REceived Qty
else {
ret = {
'qty':flt(d.received_qty) - flt(d.rejected_qty)
}
// => Set Qty = Received Qty - Rejected Qty
set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
// Calculate Amount
cur_frm.cscript.calc_amount(doc, 2);
cur_frm.cscript.update_stock_qty(doc,cdt,cdn);
}
}
//================================= Purchase Order No Get Query ====================================
cur_frm.fields_dict['purchase_order_no'].get_query = function(doc) {
if (doc.supplier)

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-03-25 16:01:29",
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-02-02 19:09:37",
"modified": "2013-05-28 12:21:17",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -75,43 +75,48 @@
"width": "150px"
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "supplier_name",
"fieldtype": "Data",
"hidden": 1,
"hidden": 0,
"in_list_view": 1,
"label": "Supplier Name",
"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
@@ -569,6 +574,7 @@
"oldfieldtype": "Text Editor"
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_section",
"fieldtype": "Section Break",
@@ -888,7 +894,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Material Manager",
@@ -911,7 +916,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Material User",
@@ -934,7 +938,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"match": "",
"permlevel": 0,
"report": 1,
"role": "Purchase User",
@@ -946,7 +949,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Purchase User",
"submit": 0

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-03-07 11:42:59",
"creation": "2013-05-24 19:29:10",
"docstatus": 0,
"modified": "2013-05-22 12:01:08",
"modified": "2013-05-28 12:13:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -357,7 +357,7 @@
"oldfieldtype": "Currency",
"print_hide": 1,
"print_width": "100px",
"read_only": 0,
"read_only": 1,
"width": "100px"
},
{
@@ -370,7 +370,7 @@
"oldfieldname": "prevdoc_doctype",
"oldfieldtype": "Data",
"print_hide": 1,
"read_only": 0
"read_only": 1
},
{
"doctype": "DocField",

View File

@@ -81,8 +81,8 @@ class TestSerialNo(unittest.TestCase):
self.assertFalse(gl_entries)
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
test_dependencies = ["Item"]
test_records = [
[
{

View File

@@ -285,11 +285,10 @@ class DocType(StockController):
+ _("Status should be Submitted"), raise_exception=webnotes.InvalidStatusError)
# update stock check
if ref.doclist[0].doctype == "Sales Invoice" and (cint(ref.doclist[0].is_pos) != 1 \
or cint(ref.doclist[0].update_stock) != 1):
webnotes.msgprint(_(ref.doclist[0].doctype) + ' "' + ref.doclist[0].name + '": '
+ _("Is POS and Update Stock should be checked."),
raise_exception=NotUpdateStockError)
if ref.doclist[0].doctype == "Sales Invoice" and cint(ref.doclist[0].update_stock) != 1:
webnotes.msgprint(_(ref.doclist[0].doctype) + ' "' + ref.doclist[0].name + '": '
+ _("Update Stock should be checked."),
raise_exception=NotUpdateStockError)
# posting date check
ref_posting_datetime = "%s %s" % (cstr(ref.doclist[0].posting_date),
@@ -680,7 +679,7 @@ def get_production_order_details(production_order):
def query_sales_return_doc(doctype, txt, searchfield, start, page_len, filters):
conditions = ""
if doctype == "Sales Invoice":
conditions = "and is_pos=1 and update_stock=1"
conditions = "and update_stock=1"
return webnotes.conn.sql("""select name, customer, customer_name
from `tab%s` where docstatus = 1

View File

@@ -450,6 +450,7 @@ class TestStockEntry(unittest.TestCase):
for d in pi.doclist.get({"parentfield": "entries"}):
d.expense_head = "_Test Account Cost for Goods Sold - _TC"
d.cost_center = "_Test Cost Center - _TC"
for d in pi.doclist.get({"parentfield": "purchase_tax_details"}):
d.cost_center = "_Test Cost Center - _TC"