Merge branch 'edge' of github.com:webnotes/erpnext into webshop

Conflicts:
	accounts/doctype/sales_invoice_item/sales_invoice_item.txt
	selling/doctype/quotation/quotation.txt
	selling/doctype/quotation_item/quotation_item.txt
	selling/doctype/sales_order_item/sales_order_item.txt
	stock/doctype/delivery_note_item/delivery_note_item.txt
	stock/doctype/item/item.txt
This commit is contained in:
Anand Doshi
2013-05-23 15:22:47 +05:30
35 changed files with 463 additions and 364 deletions

View File

@@ -122,119 +122,4 @@ test_records = [
"parentfield": "entries",
"cost_center": "_Test Cost Center - _TC"
}],
]
#
#
# import webnotes.model
# from webnotes.utils import nowdate, flt, add_days
# from accounts.utils import get_fiscal_year, get_balance_on
#
# company = webnotes.conn.get_default("company")
# abbr = webnotes.conn.get_value("Company", company, "abbr")
#
# data = {
# "expense_account": {
# "doctype": "Account",
# "account_name": "Test Expense",
# "parent_account": "Direct Expenses - %s" % abbr,
# "company": company,
# "debit_or_credit": "Debit",
# "is_pl_account": "Yes",
# "group_or_ledger": "Ledger"
# },
# "supplier_account": {
# "doctype": "Account",
# "account_name": "Test Supplier",
# "parent_account": "Accounts Payable - %s" % abbr,
# "company": company,
# "debit_or_credit": "Credit",
# "is_pl_account": "No",
# "group_or_ledger": "Ledger"
# },
# "test_cost_center": {
# "doctype": "Cost Center",
# "cost_center_name": "Test Cost Center",
# "parent_cost_center": "Root - %s" % abbr,
# "company_name": company,
# "group_or_ledger": "Ledger",
# "company_abbr": abbr
# },
# "journal_voucher": [
# {
# "doctype": "Journal Voucher",
# "voucher_type": "Journal Entry",
# "naming_series": "JV",
# "posting_date": nowdate(),
# "remark": "Test Journal Voucher",
# "fiscal_year": get_fiscal_year(nowdate())[0],
# "company": company
# },
# {
# "doctype": "Journal Voucher Detail",
# "parentfield": "entries",
# "account": "Test Expense - %s" % abbr,
# "debit": 5000,
# "cost_center": "Test Cost Center - %s" % abbr,
# },
# {
# "doctype": "Journal Voucher Detail",
# "parentfield": "entries",
# "account": "Test Supplier - %s" % abbr,
# "credit": 5000,
# },
# ]
# }
#
# def get_name(s):
# return s + " - " + abbr
#
# class TestJournalVoucher(unittest.TestCase):
# def setUp(self):
# webnotes.conn.begin()
#
# # create a dummy account
# webnotes.model.insert([data["expense_account"]])
# webnotes.model.insert([data["supplier_account"]])
# webnotes.model.insert([data["test_cost_center"]])
#
# def tearDown(self):
# webnotes.conn.rollback()
#
# def test_save_journal_voucher(self):
# expense_ac_balance = get_balance_on(get_name("Test Expense"), nowdate())
# supplier_ac_balance = get_balance_on(get_name("Test Supplier"), nowdate())
#
# dl = webnotes.model.insert(data["journal_voucher"])
# dl.submit()
# dl.load_from_db()
#
# # test submitted jv
# self.assertTrue(webnotes.conn.exists("Journal Voucher", dl.doclist[0].name))
# for d in dl.doclist[1:]:
# self.assertEquals(webnotes.conn.get_value("Journal Voucher Detail",
# d.name, "parent"), dl.doclist[0].name)
#
# # test gl entry
# gle = webnotes.conn.sql("""select account, debit, credit
# from `tabGL Entry` where voucher_no = %s order by account""",
# dl.doclist[0].name)
#
# self.assertEquals((gle[0][0], flt(gle[0][1]), flt(gle[0][2])),
# ('Test Expense - %s' % abbr, 5000.0, 0.0))
# self.assertEquals((gle[1][0], flt(gle[1][1]), flt(gle[1][2])),
# ('Test Supplier - %s' % abbr, 0.0, 5000.0))
#
# # check balance as on today
# self.assertEqual(get_balance_on(get_name("Test Expense"), nowdate()),
# expense_ac_balance + 5000)
# self.assertEqual(get_balance_on(get_name("Test Supplier"), nowdate()),
# supplier_ac_balance + 5000)
#
# # check previous balance
# self.assertEqual(get_balance_on(get_name("Test Expense"), add_days(nowdate(), -1)), 0)
]

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-04-30 12:58:25",
"creation": "2013-05-09 13:16:11",
"docstatus": 0,
"modified": "2013-05-03 14:36:24",
"modified": "2013-05-23 12:52:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -213,6 +213,14 @@
"options": "link:Print Heading"
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "System Manager",
"write": 1
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Accounts Manager",

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-04-10 08:35:38",
"creation": "2013-04-19 11:00:07",
"docstatus": 0,
"modified": "2013-04-17 14:05:20",
"modified": "2013-05-22 12:01:56",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -224,6 +224,7 @@
"fieldtype": "Link",
"in_filter": 1,
"label": "Pur Order",
"no_copy": 1,
"oldfieldname": "purchase_order",
"oldfieldtype": "Link",
"options": "Purchase Order",
@@ -238,6 +239,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Purchase Order Item",
"no_copy": 1,
"oldfieldname": "po_detail",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -250,6 +252,7 @@
"fieldtype": "Link",
"in_filter": 1,
"label": "Pur Receipt",
"no_copy": 1,
"oldfieldname": "purchase_receipt",
"oldfieldtype": "Link",
"options": "Purchase Receipt",
@@ -264,6 +267,7 @@
"hidden": 1,
"in_filter": 1,
"label": "PR Detail",
"no_copy": 1,
"oldfieldname": "pr_detail",
"oldfieldtype": "Data",
"print_hide": 1,

View File

@@ -72,9 +72,11 @@ class DocType(SellingController):
self.set_aging_date()
self.set_against_income_account()
self.validate_c_form()
self.validate_rate_with_refdoc()
self.validate_time_logs_are_submitted()
self.validate_recurring_invoice()
def on_submit(self):
if cint(self.doc.is_pos) == 1:
if cint(self.doc.update_stock) == 1:
@@ -203,8 +205,9 @@ class DocType(SellingController):
if self.doc.customer:
acc_head = webnotes.conn.sql("""select name from `tabAccount`
where (name = %s or (master_name = %s and master_type = 'customer'))
and docstatus != 2""",
(cstr(self.doc.customer) + " - " + self.get_company_abbr(), self.doc.customer))
and docstatus != 2 and company = %s""",
(cstr(self.doc.customer) + " - " + self.get_company_abbr(),
self.doc.customer, self.doc.company))
if acc_head and acc_head[0][0]:
return acc_head[0][0]
@@ -461,6 +464,19 @@ class DocType(SellingController):
webnotes.conn.set(self.doc, 'c_form_no', '')
def validate_rate_with_refdoc(self):
"""Validate values with reference document with previous document"""
for d in self.doclist.get({"parentfield": "entries"}):
if d.so_detail:
self.check_value("Sales Order", d.so_detail, d.export_rate, d.item_code)
if d.dn_detail:
self.check_value("Delivery Note", d.dn_detail, d.export_rate, d.item_code)
def check_value(self, ref_dt, ref_dn, val, item_code):
ref_val = webnotes.conn.get_value(ref_dt + "Item", ref_dn, "export_rate")
if flt(ref_val) != val:
msgprint(_("Rate is not matching with ") + ref_dt + ": " + ref_dn +
_(" for item: ") + item_code, raise_exception=True)
def update_current_stock(self):
for d in getlist(self.doclist, 'entries'):

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-04-19 13:30:26",
"creation": "2013-04-19 11:00:07",
"docstatus": 0,
"modified": "2013-05-21 16:43:21",
"modified": "2013-05-22 12:07:00",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -305,6 +305,7 @@
"fieldtype": "Link",
"in_filter": 1,
"label": "Sales Order",
"no_copy": 1,
"oldfieldname": "sales_order",
"oldfieldtype": "Link",
"options": "Sales Order",
@@ -319,6 +320,7 @@
"hidden": 1,
"in_filter": 1,
"label": "SO Detail ",
"no_copy": 1,
"oldfieldname": "so_detail",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -331,6 +333,7 @@
"fieldtype": "Link",
"in_filter": 1,
"label": "Delivery Note",
"no_copy": 1,
"oldfieldname": "delivery_note",
"oldfieldtype": "Link",
"options": "Delivery Note",
@@ -345,6 +348,7 @@
"hidden": 1,
"in_filter": 1,
"label": "DN Detail",
"no_copy": 1,
"oldfieldname": "dn_detail",
"oldfieldtype": "Data",
"print_hide": 1,