mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
fixed conflict
This commit is contained in:
@@ -390,7 +390,8 @@ class DocType(SellingController):
|
||||
'fiscal_year' : self.doc.fiscal_year,
|
||||
'is_cancelled' : (update_stock==1) and 'No' or 'Yes',
|
||||
'batch_no' : d['batch_no'],
|
||||
'serial_no' : d['serial_no']
|
||||
'serial_no' : d['serial_no'],
|
||||
"project" : self.doc.project_name
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -196,21 +196,22 @@ class DocType(BuyingController):
|
||||
serial_no = cstr(d.serial_no).strip()
|
||||
|
||||
self.values.append({
|
||||
'item_code' : d.fields.has_key('item_code') and d.item_code or d.rm_item_code,
|
||||
'warehouse' : wh,
|
||||
'posting_date' : self.doc.posting_date,
|
||||
'posting_time' : self.doc.posting_time,
|
||||
'voucher_type' : 'Purchase Receipt',
|
||||
'voucher_no' : self.doc.name,
|
||||
'voucher_detail_no' : d.name,
|
||||
'actual_qty' : qty,
|
||||
'stock_uom' : d.stock_uom,
|
||||
'incoming_rate' : in_value,
|
||||
'company' : self.doc.company,
|
||||
'fiscal_year' : self.doc.fiscal_year,
|
||||
'is_cancelled' : (is_submit==1) and 'No' or 'Yes',
|
||||
'batch_no' : cstr(d.batch_no).strip(),
|
||||
'serial_no' : serial_no
|
||||
'item_code' : d.fields.has_key('item_code') and d.item_code or d.rm_item_code,
|
||||
'warehouse' : wh,
|
||||
'posting_date' : self.doc.posting_date,
|
||||
'posting_time' : self.doc.posting_time,
|
||||
'voucher_type' : 'Purchase Receipt',
|
||||
'voucher_no' : self.doc.name,
|
||||
'voucher_detail_no' : d.name,
|
||||
'actual_qty' : qty,
|
||||
'stock_uom' : d.stock_uom,
|
||||
'incoming_rate' : in_value,
|
||||
'company' : self.doc.company,
|
||||
'fiscal_year' : self.doc.fiscal_year,
|
||||
'is_cancelled' : (is_submit==1) and 'No' or 'Yes',
|
||||
'batch_no' : cstr(d.batch_no).strip(),
|
||||
'serial_no' : serial_no,
|
||||
"project" : d.project_name
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -603,7 +603,8 @@ class DocType(StockController):
|
||||
'company': self.doc.company,
|
||||
'is_cancelled': (is_cancelled ==1) and 'Yes' or 'No',
|
||||
'batch_no': cstr(d.batch_no).strip(),
|
||||
'serial_no': cstr(d.serial_no).strip()
|
||||
'serial_no': cstr(d.serial_no).strip(),
|
||||
"project": self.doc.project_name
|
||||
})
|
||||
|
||||
def get_cust_values(self):
|
||||
|
||||
@@ -25,7 +25,14 @@ class TestStockEntry(unittest.TestCase):
|
||||
where item_code='_Test Item'""")
|
||||
|
||||
self.assertTrue(mr_name)
|
||||
|
||||
|
||||
def test_warehouse_company_validation(self):
|
||||
from stock.doctype.stock_ledger_entry.stock_ledger_entry import InvalidWarehouseCompany
|
||||
st1 = webnotes.bean(copy=test_records[0])
|
||||
st1.doclist[1].t_warehouse="_Test Warehouse 2"
|
||||
st1.insert()
|
||||
self.assertRaises(InvalidWarehouseCompany, st1.submit)
|
||||
|
||||
def test_material_receipt_gl_entry(self):
|
||||
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
|
||||
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
|
||||
|
||||
@@ -24,7 +24,7 @@ sql = webnotes.conn.sql
|
||||
msgprint = webnotes.msgprint
|
||||
from accounts.utils import get_fiscal_year
|
||||
|
||||
|
||||
class InvalidWarehouseCompany(Exception): pass
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
@@ -35,6 +35,7 @@ class DocType:
|
||||
self.validate_mandatory()
|
||||
self.validate_item()
|
||||
self.validate_warehouse_user()
|
||||
self.validate_warehouse_company()
|
||||
self.actual_amt_check()
|
||||
self.check_stock_frozen_date()
|
||||
self.scrub_posting_time()
|
||||
@@ -63,6 +64,13 @@ class DocType:
|
||||
webnotes.msgprint(_("User not allowed entry in the Warehouse") \
|
||||
+ ": " + webnotes.session.user + " / " + self.doc.warehouse, raise_exception = 1)
|
||||
|
||||
def validate_warehouse_company(self):
|
||||
warehouse_company = webnotes.conn.get_value("Warehouse", self.doc.warehouse, "company")
|
||||
if warehouse_company and warehouse_company != self.doc.company:
|
||||
webnotes.msgprint(_("Warehouse does not belong to company.") + " (" + \
|
||||
self.doc.warehouse + ", " + self.doc.company +")",
|
||||
raise_exception=InvalidWarehouseCompany)
|
||||
|
||||
def validate_mandatory(self):
|
||||
mandatory = ['warehouse','posting_date','voucher_type','voucher_no','actual_qty','company']
|
||||
for k in mandatory:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-14 16:33:26",
|
||||
"creation": "2013-01-29 19:25:42",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-29 16:27:57",
|
||||
"modified": "2013-03-25 16:04:59",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -24,13 +24,9 @@
|
||||
"parent": "Stock Ledger Entry",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Stock Ledger Entry",
|
||||
@@ -39,9 +35,7 @@
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Material User",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
@@ -57,6 +51,7 @@
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Item",
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"width": "100px"
|
||||
@@ -68,6 +63,7 @@
|
||||
"in_filter": 0,
|
||||
"label": "Serial No",
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"search_index": 0,
|
||||
"width": "100px"
|
||||
},
|
||||
@@ -77,7 +73,8 @@
|
||||
"fieldtype": "Data",
|
||||
"label": "Batch No",
|
||||
"oldfieldname": "batch_no",
|
||||
"oldfieldtype": "Data"
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@@ -89,6 +86,7 @@
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Warehouse",
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"search_index": 1,
|
||||
"width": "100px"
|
||||
},
|
||||
@@ -101,6 +99,7 @@
|
||||
"oldfieldname": "warehouse_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Warehouse Type",
|
||||
"read_only": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
@@ -113,6 +112,7 @@
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"width": "100px"
|
||||
@@ -126,6 +126,7 @@
|
||||
"oldfieldname": "posting_time",
|
||||
"oldfieldtype": "Time",
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"search_index": 0,
|
||||
"width": "100px"
|
||||
},
|
||||
@@ -138,6 +139,7 @@
|
||||
"oldfieldname": "voucher_type",
|
||||
"oldfieldtype": "Data",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"search_index": 0,
|
||||
"width": "150px"
|
||||
},
|
||||
@@ -150,6 +152,7 @@
|
||||
"oldfieldname": "voucher_no",
|
||||
"oldfieldtype": "Data",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"search_index": 0,
|
||||
"width": "150px"
|
||||
},
|
||||
@@ -161,6 +164,7 @@
|
||||
"oldfieldname": "voucher_detail_no",
|
||||
"oldfieldtype": "Data",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
@@ -172,6 +176,7 @@
|
||||
"oldfieldname": "actual_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
@@ -181,7 +186,8 @@
|
||||
"label": "Incoming Rate",
|
||||
"oldfieldname": "incoming_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@@ -191,6 +197,7 @@
|
||||
"oldfieldname": "stock_uom",
|
||||
"oldfieldtype": "Data",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
@@ -202,6 +209,7 @@
|
||||
"oldfieldname": "bin_aqat",
|
||||
"oldfieldtype": "Currency",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
@@ -213,6 +221,7 @@
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
@@ -222,7 +231,8 @@
|
||||
"label": "Stock Value",
|
||||
"oldfieldname": "stock_value",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@@ -234,9 +244,17 @@
|
||||
"oldfieldname": "fcfs_stack",
|
||||
"oldfieldtype": "Text",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"report_hide": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "project",
|
||||
"fieldtype": "Link",
|
||||
"label": "Project",
|
||||
"options": "Project"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
@@ -247,6 +265,7 @@
|
||||
"oldfieldtype": "Data",
|
||||
"options": "link:Company",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"search_index": 0,
|
||||
"width": "150px"
|
||||
},
|
||||
@@ -259,6 +278,7 @@
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Data",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"search_index": 0,
|
||||
"width": "150px"
|
||||
},
|
||||
@@ -272,10 +292,20 @@
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"search_index": 0,
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Material User",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager"
|
||||
}
|
||||
]
|
||||
@@ -7,6 +7,12 @@ test_records = [
|
||||
[{
|
||||
"doctype": "Warehouse",
|
||||
"warehouse_name": "_Test Warehouse 1",
|
||||
"warehouse_type": "_Test Warehouse Type"
|
||||
"warehouse_type": "_Test Warehouse Type",
|
||||
}],
|
||||
[{
|
||||
"doctype": "Warehouse",
|
||||
"warehouse_name": "_Test Warehouse 2",
|
||||
"warehouse_type": "_Test Warehouse Type",
|
||||
"company": "_Test Company 1"
|
||||
}]
|
||||
]
|
||||
|
||||
@@ -35,7 +35,7 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
|
||||
this._super(wrapper, {
|
||||
title: "Stock Balance",
|
||||
doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand",
|
||||
"Stock Entry"],
|
||||
"Stock Entry", "Project"],
|
||||
});
|
||||
},
|
||||
setup_columns: function() {
|
||||
@@ -76,6 +76,10 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
|
||||
default_value: "Select Warehouse...", filter: function(val, item, opts, me) {
|
||||
return me.apply_zero_filter(val, item, opts, me);
|
||||
}},
|
||||
{fieldtype:"Select", label: "Project", link:"Project",
|
||||
default_value: "Select Project...", filter: function(val, item, opts, me) {
|
||||
return me.apply_zero_filter(val, item, opts, me);
|
||||
}, link_formatter: {filter_input: "project"}},
|
||||
{fieldtype:"Date", label: "From Date"},
|
||||
{fieldtype:"Label", label: "To"},
|
||||
{fieldtype:"Date", label: "To Date"},
|
||||
@@ -105,7 +109,8 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
|
||||
var sl = data[i];
|
||||
var sl_posting_date = dateutil.str_to_obj(sl.posting_date);
|
||||
|
||||
if(me.is_default("warehouse") ? true : me.warehouse == sl.warehouse) {
|
||||
if((me.is_default("warehouse") ? true : me.warehouse == sl.warehouse) &&
|
||||
(me.is_default("project") ? true : me.project == sl.project)) {
|
||||
var item = me.item_by_name[sl.item_code];
|
||||
var wh = me.get_item_warehouse(sl.warehouse, sl.item_code);
|
||||
var valuation_method = item.valuation_method ?
|
||||
|
||||
Reference in New Issue
Block a user