[fix] [minor] fixed conflict while merging with master

This commit is contained in:
Nabin Hait
2013-08-19 11:06:06 +05:30
206 changed files with 5830 additions and 1272 deletions

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:25",
"docstatus": 0,
"modified": "2013-07-25 16:36:35",
"modified": "2013-08-07 14:45:48",
"modified_by": "Administrator",
"owner": "Administrator"
},

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:09",
"docstatus": 0,
"modified": "2013-07-26 11:16:57",
"modified": "2013-08-09 14:46:32",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -63,7 +63,7 @@
"doctype": "DocField",
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"label": "Document Numbering Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",
@@ -285,7 +285,7 @@
{
"description": "Select the price list as entered in \"Price List\" master. This will pull the reference rates of items against this price list as specified in \"Item\" master.",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Price List",
"oldfieldname": "price_list_name",

View File

@@ -18,6 +18,8 @@ class TestDeliveryNote(unittest.TestCase):
pr.submit()
def test_over_billing_against_dn(self):
self._insert_purchase_receipt()
from stock.doctype.delivery_note.delivery_note import make_sales_invoice
self._insert_purchase_receipt()
dn = webnotes.bean(copy=test_records[0]).insert()
@@ -33,7 +35,7 @@ class TestDeliveryNote(unittest.TestCase):
# modify export_amount
si[1].export_rate = 200
self.assertRaises(webnotes.ValidationError, webnotes.bean(si).submit)
self.assertRaises(webnotes.ValidationError, webnotes.bean(si).insert)
def test_delivery_note_no_gl_entry(self):
@@ -113,7 +115,7 @@ test_records = [
"posting_date": "2013-02-21",
"posting_time": "9:00:00",
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"status": "Draft",
"territory": "_Test Territory",
"net_total": 500.0,

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-22 13:15:44",
"docstatus": 0,
"modified": "2013-07-25 16:37:09",
"modified": "2013-08-07 14:45:30",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -95,7 +95,6 @@
"label": "Quantity and Rate"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",
@@ -124,7 +123,6 @@
"width": "50px"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "ref_rate",
"fieldtype": "Currency",
@@ -141,7 +139,6 @@
"width": "100px"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "adj_rate",
"fieldtype": "Float",
@@ -199,7 +196,6 @@
"width": "100px"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "basic_rate",
"fieldtype": "Currency",

View File

@@ -5,16 +5,16 @@ wn.provide("erpnext.stock");
erpnext.stock.Item = wn.ui.form.Controller.extend({
onload: function() {
this.frm.add_fetch("price_list_name", "currency", "ref_currency");
this.frm.add_fetch("price_list_name", "buying_or_selling", "buying_or_selling");
this.frm.add_fetch("price_list", "currency", "ref_currency");
this.frm.add_fetch("price_list", "buying_or_selling", "buying_or_selling");
},
ref_rate_details_add: function(doc, cdt, cdn) {
var row = wn.model.get_doc(cdt, cdn);
if(row.price_list_name && !row.ref_currency) {
if(row.price_list && !row.ref_currency) {
// execute fetch
var df = wn.meta.get_docfield(row.doctype, "price_list_name", row.parent);
this.frm.script_manager.validate_link_and_fetch(df, row.name, row.price_list_name);
var df = wn.meta.get_docfield(row.doctype, "price_list", row.parent);
this.frm.script_manager.validate_link_and_fetch(df, row.name, row.price_list);
}
}
});

View File

@@ -130,16 +130,16 @@ class DocType(DocListController):
def validate_price_lists(self):
price_lists=[]
for d in getlist(self.doclist,'ref_rate_details'):
if d.price_list_name in price_lists:
msgprint(_("Cannot have two prices for same Price List") + ": " + d.price_list_name,
if d.price_list in price_lists:
msgprint(_("Cannot have two prices for same Price List") + ": " + d.price_list,
raise_exception= webnotes.DuplicateEntryError)
else:
price_list_currency = webnotes.conn.get_value("Price List", d.price_list_name, "currency")
price_list_currency = webnotes.conn.get_value("Price List", d.price_list, "currency")
if price_list_currency and d.ref_currency != price_list_currency:
msgprint(_("Currency does not match Price List Currency for Price List") \
+ ": " + d.price_list_name, raise_exception=PriceListCurrencyMismatch)
+ ": " + d.price_list, raise_exception=PriceListCurrencyMismatch)
price_lists.append(d.price_list_name)
price_lists.append(d.price_list)
def fill_customer_code(self):

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-03 10:45:46",
"docstatus": 0,
"modified": "2013-08-05 18:23:47",
"modified": "2013-08-08 14:22:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -55,7 +55,7 @@
"doctype": "DocField",
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Naming Series",
"label": "Document Numbering Series",
"options": "\nITEM",
"read_only": 0
},

View File

@@ -61,7 +61,7 @@ test_records = [
}, {
"doctype": "Item Price",
"parentfield": "ref_rate_details",
"price_list_name": "_Test Price List",
"price_list": "_Test Price List",
"ref_rate": 100,
"ref_currency": "INR",
"buying_or_selling": "Selling"

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-02 16:29:48",
"docstatus": 0,
"modified": "2013-07-31 17:30:34",
"modified": "2013-08-09 14:46:58",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -30,7 +30,7 @@
},
{
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "price_list",
"fieldtype": "Link",
"in_filter": 1,
"label": "Price List Name",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 14:48:38",
"docstatus": 0,
"modified": "2013-07-15 17:50:38",
"modified": "2013-08-08 14:22:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -71,7 +71,7 @@
"doctype": "DocField",
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"label": "Document Numbering Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:02",
"docstatus": 0,
"modified": "2013-08-01 12:23:40",
"modified": "2013-08-07 14:45:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -89,7 +89,6 @@
"width": "100px"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-11 15:32:24",
"docstatus": 0,
"modified": "2013-07-05 14:47:57",
"modified": "2013-08-08 14:22:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -78,7 +78,7 @@
"doctype": "DocField",
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"label": "Document Numbering Series",
"no_copy": 0,
"options": "PS",
"print_hide": 1,

View File

@@ -127,7 +127,7 @@ cur_frm.cscript.new_contact = function(){
cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return{
filters:[
['project', 'status', 'not in', 'Completed, Cancelled']
['Project', 'status', 'not in', 'Completed, Cancelled']
]
}
}

View File

@@ -334,9 +334,6 @@ def make_purchase_invoice(source_name, target_doclist=None):
bean.run_method("set_missing_values")
bean.run_method("set_supplier_defaults")
def update_item(obj, target, source_parent):
target.conversion_factor = 1
doclist = get_mapped_doclist("Purchase Receipt", source_name, {
"Purchase Receipt": {
"doctype": "Purchase Invoice",
@@ -353,7 +350,6 @@ def make_purchase_invoice(source_name, target_doclist=None):
"prevdoc_docname": "purchase_order",
"purchase_rate": "rate"
},
"postprocess": update_item
},
"Purchase Taxes and Charges": {
"doctype": "Purchase Taxes and Charges",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-07-23 15:26:50",
"modified": "2013-08-09 14:47:05",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -60,7 +60,7 @@
"doctype": "DocField",
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"label": "Document Numbering Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",
@@ -237,14 +237,14 @@
{
"description": "Consider this Price List for fetching rate. (only which have \"For Buying\" as checked)",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",
"print_hide": 1
},
{
"depends_on": "price_list_name",
"depends_on": "buying_price_list",
"doctype": "DocField",
"fieldname": "price_list_currency",
"fieldtype": "Link",
@@ -255,7 +255,7 @@
"read_only": 1
},
{
"depends_on": "price_list_name",
"depends_on": "buying_price_list",
"doctype": "DocField",
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:10",
"docstatus": 0,
"modified": "2013-07-25 16:30:24",
"modified": "2013-08-07 14:45:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -76,7 +76,6 @@
"label": "Received and Accepted"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "received_qty",
"fieldtype": "Float",
@@ -91,7 +90,6 @@
"width": "100px"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",
@@ -104,7 +102,6 @@
"width": "100px"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "rejected_qty",
"fieldtype": "Float",
@@ -161,7 +158,6 @@
"read_only": 0
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "import_rate",
"fieldtype": "Currency",
@@ -197,7 +193,6 @@
"read_only": 0
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "purchase_rate",
"fieldtype": "Currency",
@@ -213,7 +208,6 @@
"width": "100px"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "amount",
"fieldtype": "Currency",

View File

@@ -4,34 +4,7 @@
wn.require("public/app/js/controllers/stock_controller.js");
wn.provide("erpnext.stock");
erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
onload: function() {
this.set_default_account();
},
set_default_account: function() {
var me = this;
if (cint(wn.defaults.get_default("perpetual_accounting")) && !this.frm.doc.expense_adjustment_account) {
if (this.frm.doc.purpose == "Sales Return")
account_for = "default_expense_account";
else if (this.frm.doc.purpose == "Purchase Return")
account_for = "stock_received_but_not_billed";
else account_for = "stock_adjustment_account";
return this.frm.call({
method: "accounts.utils.get_company_default",
args: {
"fieldname": account_for,
"company": this.frm.doc.company
},
callback: function(r) {
if (!r.exc) me.frm.set_value("expense_adjustment_account", r.message);
}
});
}
},
erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
setup: function() {
var me = this;
@@ -80,11 +53,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
onload_post_render: function() {
if(this.frm.doc.__islocal && (this.frm.doc.production_order || this.frm.doc.bom_no)
&& !getchildren('Stock Entry Detail', this.frm.doc.name, 'mtn_details').length) {
// if production order / bom is mentioned, get items
this.get_items();
}
this.set_default_account();
},
refresh: function() {
@@ -115,6 +84,33 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
after_cancel: function() {
this.clean_up();
},
set_default_account: function() {
var me = this;
if (cint(wn.defaults.get_default("auto_inventory_accounting")) && !this.frm.doc.expense_adjustment_account) {
var account_for = "stock_adjustment_account";
if (this.frm.doc.purpose == "Sales Return")
account_for = "stock_in_hand_account";
else if (this.frm.doc.purpose == "Purchase Return")
account_for = "stock_received_but_not_billed";
return this.frm.call({
method: "accounts.utils.get_company_default",
args: {
"fieldname": account_for,
"company": this.frm.doc.company
},
callback: function(r) {
if (!r.exc) me.frm.set_value("expense_adjustment_account", r.message);
me.get_items();
}
});
} else {
me.get_items();
}
},
clean_up: function() {
// Clear Production Order record from locals, because it is updated via Stock Entry
@@ -126,13 +122,16 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
get_items: function() {
return this.frm.call({
doc: this.frm.doc,
method: "get_items",
callback: function(r) {
if(!r.exc) refresh_field("mtn_details");
}
});
if(this.frm.doc.production_order || this.frm.doc.bom_no) {
// if production order / bom is mentioned, get items
return this.frm.call({
doc: this.frm.doc,
method: "get_items",
callback: function(r) {
if(!r.exc) refresh_field("mtn_details");
}
});
}
},
qty: function(doc, cdt, cdn) {
@@ -212,7 +211,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
});
loaddoc("Journal Voucher", jv_name);
}
}
});
}

View File

@@ -19,6 +19,7 @@ sql = webnotes.conn.sql
class NotUpdateStockError(webnotes.ValidationError): pass
class StockOverReturnError(webnotes.ValidationError): pass
class IncorrectValuationRateError(webnotes.ValidationError): pass
from controllers.stock_controller import StockController
@@ -254,7 +255,7 @@ class DocType(StockController):
def validate_incoming_rate(self):
for d in getlist(self.doclist, 'mtn_details'):
if d.t_warehouse:
self.validate_value("incoming_rate", ">", 0, d)
self.validate_value("incoming_rate", ">", 0, d, raise_exception=IncorrectValuationRateError)
def validate_bom(self):
for d in getlist(self.doclist, 'mtn_details'):
@@ -587,7 +588,6 @@ class DocType(StockController):
for item in item_dict:
pending_to_issue = (max_qty * item_dict[item]["qty"]) - issued_item_qty.get(item, 0)
desire_to_transfer = flt(self.doc.fg_completed_qty) * item_dict[item]["qty"]
if desire_to_transfer <= pending_to_issue:
item_dict[item]["qty"] = desire_to_transfer
else:

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-09 11:43:55",
"docstatus": 0,
"modified": "2013-08-05 17:36:25",
"modified": "2013-08-08 14:22:31",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -72,7 +72,7 @@
"fieldtype": "Select",
"hidden": 0,
"in_filter": 0,
"label": "Series",
"label": "Document Numbering Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",

View File

@@ -118,7 +118,7 @@ class DocType:
elif purpose == 'Sales Return':
webnotes.conn.sql("update `tabSerial No` set status = 'Delivered', purchase_document_type = '', purchase_document_no = '' where name = '%s'" % serial_no)
else:
webnotes.conn.sql("update `tabSerial No` set docstatus = 2, status = 'Not in Use', purchase_document_type = '', purchase_document_no = '', purchase_date = null, purchase_rate = 0, supplier = null, supplier_name = '', supplier_address = '', warehouse = '' where name = '%s'" % serial_no)
webnotes.conn.sql("update `tabSerial No` set docstatus = 2, status = 'Not in Use', purchase_document_type = '', purchase_document_no = '', purchase_date = null, purchase_rate = 0, supplier = null, supplier_name = '', address_display = '', warehouse = '' where name = '%s'" % serial_no)
def check_serial_no_exists(self, serial_no, item_code):

View File

@@ -112,5 +112,4 @@ def on_doctype_update():
where Key_name="posting_sort_index" """):
webnotes.conn.commit()
webnotes.conn.sql("""alter table `tabStock Ledger Entry`
add index posting_sort_index(posting_date, posting_time, name)""")
webnotes.conn.begin()
add index posting_sort_index(posting_date, posting_time, name)""")

View File

@@ -286,12 +286,15 @@ class DocType(StockController):
item_list = [d.item_code for d in self.entries]
warehouse_list = [d.warehouse for d in self.entries]
if not (item_list and warehouse_list):
webnotes.throw(_("Invalid Item or Warehouse Data"))
stock_ledger_entries = self.get_stock_ledger_entries(item_list, warehouse_list)
stock_value_difference = {}
for d in self.entries:
diff = get_buying_amount(d.item_code, d.warehouse, d.actual_qty, self.doc.doctype,
self.doc.name, d.voucher_detail_no, stock_ledger_entries)
diff = get_buying_amount(d.item_code, self.doc.doctype, self.doc.name,
d.voucher_detail_no, stock_ledger_entries.get((d.item_code, d.warehouse), []))
stock_value_difference.setdefault(d.warehouse, 0.0)
stock_value_difference[d.warehouse] -= diff