renaming: entries

This commit is contained in:
Nabin Hait 2014-12-25 18:19:39 +05:30
parent 23d2a53017
commit 4b8185db19
31 changed files with 514 additions and 511 deletions

View File

@ -1,108 +1,108 @@
{
"allow_copy": 1,
"allow_email": 1,
"allow_print": 1,
"creation": "2013-01-10 16:34:05",
"docstatus": 0,
"doctype": "DocType",
"allow_copy": 1,
"allow_email": 1,
"allow_print": 1,
"creation": "2013-01-10 16:34:05",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"description": "Select account head of the bank where cheque was deposited.",
"fieldname": "bank_account",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Bank Account",
"options": "Account",
"permlevel": 0,
"description": "Select account head of the bank where cheque was deposited.",
"fieldname": "bank_account",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Bank Account",
"options": "Account",
"permlevel": 0,
"reqd": 1
},
},
{
"fieldname": "company",
"fieldtype": "Link",
"hidden": 1,
"in_list_view": 1,
"label": "Company",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 1,
"in_list_view": 1,
"label": "Company",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"reqd": 0
},
},
{
"fieldname": "from_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "From Date",
"permlevel": 0,
"fieldname": "from_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "From Date",
"permlevel": 0,
"reqd": 1
},
},
{
"fieldname": "to_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "To Date",
"permlevel": 0,
"fieldname": "to_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "To Date",
"permlevel": 0,
"reqd": 1
},
},
{
"fieldname": "include_reconciled_entries",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Include Reconciled Entries",
"fieldname": "include_reconciled_entries",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Include Reconciled Entries",
"permlevel": 0
},
},
{
"fieldname": "get_relevant_entries",
"fieldtype": "Button",
"label": "Get Relevant Entries",
"options": "get_details",
"fieldname": "get_relevant_entries",
"fieldtype": "Button",
"label": "Get Relevant Entries",
"options": "get_details",
"permlevel": 0
},
},
{
"fieldname": "journal_entries",
"fieldtype": "Table",
"label": "Journal Entries",
"options": "Bank Reconciliation Detail",
"fieldname": "journal_entries",
"fieldtype": "Table",
"label": "Journal Entries",
"options": "Bank Reconciliation Detail",
"permlevel": 0
},
},
{
"fieldname": "update_clearance_date",
"fieldtype": "Button",
"label": "Update Clearance Date",
"options": "update_details",
"fieldname": "update_clearance_date",
"fieldtype": "Button",
"label": "Update Clearance Date",
"options": "update_details",
"permlevel": 0
},
},
{
"fieldname": "total_amount",
"fieldtype": "Currency",
"label": "Total Amount",
"options": "Company:company:default_currency",
"permlevel": 0,
"fieldname": "total_amount",
"fieldtype": "Currency",
"label": "Total Amount",
"options": "Company:company:default_currency",
"permlevel": 0,
"read_only": 1
}
],
"hide_heading": 1,
"hide_toolbar": 1,
"icon": "icon-check",
"idx": 1,
"issingle": 1,
"modified": "2014-12-25 13:16:16.711609",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Reconciliation",
"owner": "Administrator",
],
"hide_heading": 1,
"hide_toolbar": 1,
"icon": "icon-check",
"idx": 1,
"issingle": 1,
"modified": "2014-12-25 13:16:16.711609",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Reconciliation",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"permlevel": 0,
"read": 1,
"report": 0,
"role": "Accounts User",
"submit": 0,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"permlevel": 0,
"read": 1,
"report": 0,
"role": "Accounts User",
"submit": 0,
"write": 1
}
],
],
"read_only": 1
}
}

View File

@ -28,11 +28,11 @@ class BankReconciliation(Document):
and ifnull(t1.is_opening, 'No') = 'No' %s""" %
('%s', '%s', '%s', condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
self.set('entries', [])
self.set('journal_entries', [])
self.total_amount = 0.0
for d in dl:
nl = self.append('entries', {})
nl = self.append('journal_entries', {})
nl.posting_date = d.posting_date
nl.voucher_id = d.name
nl.cheque_number = d.cheque_no
@ -45,7 +45,7 @@ class BankReconciliation(Document):
def update_details(self):
vouchers = []
for d in self.get('entries'):
for d in self.get('journal_entries'):
if d.clearance_date:
if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date):
frappe.throw(_("Clearance date cannot be before check date in row {0}").format(d.idx))

View File

@ -12,13 +12,13 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
},
onload_post_render: function() {
cur_frm.get_field("entries").grid.set_multiple_add("account");
cur_frm.get_field("accounts").grid.set_multiple_add("account");
},
load_defaults: function() {
if(this.frm.doc.__islocal && this.frm.doc.company) {
frappe.model.set_default_values(this.frm.doc);
$.each(this.frm.doc.entries || [], function(i, jvd) {
$.each(this.frm.doc.accounts || [], function(i, jvd) {
frappe.model.set_default_values(jvd);
}
);
@ -31,7 +31,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
var me = this;
$.each(["account", "cost_center"], function(i, fieldname) {
me.frm.set_query(fieldname, "entries", function() {
me.frm.set_query(fieldname, "accounts", function() {
frappe.model.validate_missing(me.frm.doc, "company");
return {
filters: {
@ -42,7 +42,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
});
});
me.frm.set_query("party_type", "entries", function(doc, cdt, cdn) {
me.frm.set_query("party_type", "accounts", function(doc, cdt, cdn) {
return {
filters: {"name": ["in", ["Customer", "Supplier"]]}
}
@ -50,7 +50,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
$.each([["against_voucher", "Purchase Invoice", "supplier"],
["against_invoice", "Sales Invoice", "customer"]], function(i, opts) {
me.frm.set_query(opts[0], "entries", function(doc, cdt, cdn) {
me.frm.set_query(opts[0], "accounts", function(doc, cdt, cdn) {
var jvd = frappe.get_doc(cdt, cdn);
frappe.model.validate_missing(jvd, ["party_type", "party"]);
return {
@ -63,7 +63,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
});
});
this.frm.set_query("against_jv", "entries", function(doc, cdt, cdn) {
this.frm.set_query("against_jv", "accounts", function(doc, cdt, cdn) {
var jvd = frappe.get_doc(cdt, cdn);
frappe.model.validate_missing(jvd, "account");
@ -168,7 +168,7 @@ cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
cur_frm.cscript.update_totals = function(doc) {
var td=0.0; var tc =0.0;
var el = doc.entries || [];
var el = doc.accounts || [];
for(var i in el) {
td += flt(el[i].debit, precision("debit", el[i]));
tc += flt(el[i].credit, precision("credit", el[i]));
@ -200,7 +200,7 @@ cur_frm.cscript.account = function(doc,dt,dn) {
args: {account: d.account, date: doc.posting_date},
callback: function(r) {
d.balance = r.message;
refresh_field('balance', d.name, 'entries');
refresh_field('balance', d.name, 'accounts');
}
});
}
@ -223,17 +223,17 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Entry");
cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Entry");
if((doc.entries || []).length!==0 || !doc.company) // too early
if((doc.accounts || []).length!==0 || !doc.company) // too early
return;
var update_jv_details = function(doc, r) {
var jvdetail = frappe.model.add_child(doc, "Journal Entry Account", "entries");
var jvdetail = frappe.model.add_child(doc, "Journal Entry Account", "accounts");
$.each(r, function(i, d) {
var row = frappe.model.add_child(doc, "Journal Entry Account", "entries");
var row = frappe.model.add_child(doc, "Journal Entry Account", "accounts");
row.account = d.account;
row.balance = d.balance;
});
refresh_field("entries");
refresh_field("accounts");
}
if(in_list(["Bank Entry", "Cash Entry"], doc.voucher_type)) {
@ -258,7 +258,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
"company": doc.company
},
callback: function(r) {
frappe.model.clear_table(doc, "entries");
frappe.model.clear_table(doc, "accounts");
if(r.message) {
update_jv_details(doc, r.message);
}

View File

@ -82,9 +82,9 @@
},
{
"allow_on_submit": 1,
"fieldname": "entries",
"fieldname": "accounts",
"fieldtype": "Table",
"label": "Entries",
"label": "Accounting Entries",
"oldfieldname": "entries",
"oldfieldtype": "Table",
"options": "Journal Entry Account",
@ -448,7 +448,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2014-12-25 15:29:26.441984",
"modified": "2014-12-25 17:21:56.824371",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry",

View File

@ -47,7 +47,7 @@ class JournalEntry(AccountsController):
def update_advance_paid(self):
advance_paid = frappe._dict()
for d in self.get("entries"):
for d in self.get("accounts"):
if d.is_advance:
if d.against_sales_order:
advance_paid.setdefault("Sales Order", []).append(d.against_sales_order)
@ -67,7 +67,7 @@ class JournalEntry(AccountsController):
self.update_expense_claim()
def validate_party(self):
for d in self.get("entries"):
for d in self.get("accounts"):
account_type = frappe.db.get_value("Account", d.account, "account_type")
if account_type in ["Receivable", "Payable"]:
if not (d.party_type and d.party):
@ -76,7 +76,7 @@ class JournalEntry(AccountsController):
frappe.throw(_("Row{0}: Party Type and Party is only applicable against Receivable / Payable account").format(d.idx))
def check_credit_limit(self):
customers = list(set([d.party for d in self.get("entries") if d.party_type=="Customer" and flt(d.debit) > 0]))
customers = list(set([d.party for d in self.get("accounts") if d.party_type=="Customer" and flt(d.debit) > 0]))
if customers:
from erpnext.selling.doctype.customer.customer import check_credit_limit
for customer in customers:
@ -86,7 +86,7 @@ class JournalEntry(AccountsController):
from erpnext.accounts.party import get_credit_days
posting_date = None
if self.cheque_date:
for d in self.get("entries"):
for d in self.get("accounts"):
if d.party_type and d.party and d.get("credit" if d.party_type=="Customer" else "debit") > 0:
if d.against_invoice:
posting_date = frappe.db.get_value("Sales Invoice", d.against_invoice, "posting_date")
@ -110,7 +110,7 @@ class JournalEntry(AccountsController):
msgprint(_("Reference No is mandatory if you entered Reference Date"), raise_exception=1)
def validate_entries_for_advance(self):
for d in self.get('entries'):
for d in self.get('accounts'):
if not (d.against_voucher and d.against_invoice and d.against_jv):
if (d.party_type == 'Customer' and flt(d.credit) > 0) or \
(d.party_type == 'Supplier' and flt(d.debit) > 0):
@ -120,14 +120,14 @@ class JournalEntry(AccountsController):
frappe.throw(_("Row {0}: Payment against Sales/Purchase Order should always be marked as advance").format(d.idx))
def validate_against_jv(self):
for d in self.get('entries'):
for d in self.get('accounts'):
if d.against_jv:
account_root_type = frappe.db.get_value("Account", d.account, "root_type")
if account_root_type == "Asset" and flt(d.debit) > 0:
frappe.throw(_("For {0}, only credit entries can be linked against another debit entry")
frappe.throw(_("For {0}, only credit accounts can be linked against another debit entry")
.format(d.account))
elif account_root_type == "Liability" and flt(d.credit) > 0:
frappe.throw(_("For {0}, only debit entries can be linked against another credit entry")
frappe.throw(_("For {0}, only debit accounts can be linked against another credit entry")
.format(d.account))
if d.against_jv == self.name:
@ -175,7 +175,7 @@ class JournalEntry(AccountsController):
'Purchase Order': ["Supplier"]
}
for d in self.get("entries"):
for d in self.get("accounts"):
if d.get(against_field):
dr_or_cr = "credit" if against_field in ["against_invoice", "against_sales_order"] \
else "debit"
@ -236,23 +236,23 @@ class JournalEntry(AccountsController):
def set_against_account(self):
accounts_debited, accounts_credited = [], []
for d in self.get("entries"):
for d in self.get("accounts"):
if flt(d.debit > 0): accounts_debited.append(d.account)
if flt(d.credit) > 0: accounts_credited.append(d.account)
for d in self.get("entries"):
for d in self.get("accounts"):
if flt(d.debit > 0): d.against_account = ", ".join(list(set(accounts_credited)))
if flt(d.credit > 0): d.against_account = ", ".join(list(set(accounts_debited)))
def validate_debit_and_credit(self):
self.total_debit, self.total_credit, self.difference = 0, 0, 0
for d in self.get("entries"):
for d in self.get("accounts"):
if d.debit and d.credit:
frappe.throw(_("You cannot credit and debit same account at the same time"))
self.total_debit = flt(self.total_debit) + flt(d.debit, self.precision("debit", "entries"))
self.total_credit = flt(self.total_credit) + flt(d.credit, self.precision("credit", "entries"))
self.total_debit = flt(self.total_debit) + flt(d.debit, self.precision("debit", "accounts"))
self.total_credit = flt(self.total_credit) + flt(d.credit, self.precision("credit", "accounts"))
self.difference = flt(self.total_debit, self.precision("total_debit")) - \
flt(self.total_credit, self.precision("total_credit"))
@ -269,7 +269,7 @@ class JournalEntry(AccountsController):
else:
msgprint(_("Please enter Reference date"), raise_exception=frappe.MandatoryError)
for d in self.get('entries'):
for d in self.get('accounts'):
if d.against_invoice and d.credit:
currency = frappe.db.get_value("Sales Invoice", d.against_invoice, "currency")
@ -305,7 +305,7 @@ class JournalEntry(AccountsController):
if self.is_opening != 'Yes':
self.aging_date = self.posting_date
else:
party_list = [d.party for d in self.get("entries") if d.party_type and d.party]
party_list = [d.party for d in self.get("accounts") if d.party_type and d.party]
if len(party_list) and not self.aging_date:
frappe.throw(_("Aging Date is mandatory for opening entry"))
@ -313,7 +313,7 @@ class JournalEntry(AccountsController):
self.aging_date = self.posting_date
def set_print_format_fields(self):
for d in self.get('entries'):
for d in self.get('accounts'):
if d.party_type and d.party:
if not self.pay_to_recd_from:
self.pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
@ -333,7 +333,7 @@ class JournalEntry(AccountsController):
from erpnext.accounts.general_ledger import make_gl_entries
gl_map = []
for d in self.get("entries"):
for d in self.get("accounts"):
if d.debit or d.credit:
gl_map.append(
self.get_gl_dict({
@ -341,8 +341,8 @@ class JournalEntry(AccountsController):
"party_type": d.party_type,
"party": d.party,
"against": d.against_account,
"debit": flt(d.debit, self.precision("debit", "entries")),
"credit": flt(d.credit, self.precision("credit", "entries")),
"debit": flt(d.debit, self.precision("debit", "accounts")),
"credit": flt(d.credit, self.precision("credit", "accounts")),
"against_voucher_type": (("Purchase Invoice" if d.against_voucher else None)
or ("Sales Invoice" if d.against_invoice else None)
or ("Journal Entry" if d.against_jv else None)
@ -359,14 +359,14 @@ class JournalEntry(AccountsController):
make_gl_entries(gl_map, cancel=cancel, adv_adj=adv_adj)
def get_balance(self):
if not self.get('entries'):
if not self.get('accounts'):
msgprint(_("'Entries' cannot be empty"), raise_exception=True)
else:
flag, self.total_debit, self.total_credit = 0, 0, 0
diff = flt(self.difference, self.precision("difference"))
# If any row without amount, set the diff on that row
for d in self.get('entries'):
for d in self.get('accounts'):
if not d.credit and not d.debit and diff != 0:
if diff>0:
d.credit = diff
@ -376,7 +376,7 @@ class JournalEntry(AccountsController):
# Set the diff in a new row
if flag == 0 and diff != 0:
jd = self.append('entries', {})
jd = self.append('accounts', {})
if diff>0:
jd.credit = abs(diff)
elif diff<0:
@ -385,24 +385,24 @@ class JournalEntry(AccountsController):
self.validate_debit_and_credit()
def get_outstanding_invoices(self):
self.set('entries', [])
self.set('accounts', [])
total = 0
for d in self.get_values():
total += flt(d.outstanding_amount, self.precision("credit", "entries"))
jd1 = self.append('entries', {})
total += flt(d.outstanding_amount, self.precision("credit", "accounts"))
jd1 = self.append('accounts', {})
jd1.account = d.account
jd1.party = d.party
if self.write_off_based_on == 'Accounts Receivable':
jd1.party_type = "Customer"
jd1.credit = flt(d.outstanding_amount, self.precision("credit", "entries"))
jd1.credit = flt(d.outstanding_amount, self.precision("credit", "accounts"))
jd1.against_invoice = cstr(d.name)
elif self.write_off_based_on == 'Accounts Payable':
jd1.party_type = "Supplier"
jd1.debit = flt(d.outstanding_amount, self.precision("debit", "entries"))
jd1.debit = flt(d.outstanding_amount, self.precision("debit", "accounts"))
jd1.against_voucher = cstr(d.name)
jd2 = self.append('entries', {})
jd2 = self.append('accounts', {})
if self.write_off_based_on == 'Accounts Receivable':
jd2.debit = total
elif self.write_off_based_on == 'Accounts Payable':
@ -425,14 +425,14 @@ class JournalEntry(AccountsController):
and outstanding_amount > 0 %s""" % ('%s', cond), self.company, as_dict=True)
def update_expense_claim(self):
for d in self.entries:
for d in self.accounts:
if d.against_expense_claim:
amt = frappe.db.sql("""select sum(debit) as amt from `tabJournal Entry Account`
where against_expense_claim = %s and docstatus = 1""", d.against_expense_claim ,as_dict=1)[0].amt
frappe.db.set_value("Expense Claim", d.against_expense_claim , "total_amount_reimbursed", amt)
def validate_expense_claim(self):
for d in self.entries:
for d in self.accounts:
if d.against_expense_claim:
sanctioned_amount, reimbursed_amount = frappe.db.get_value("Expense Claim", d.against_expense_claim,
("total_sanctioned_amount", "total_amount_reimbursed"))
@ -459,16 +459,16 @@ def get_payment_entry_from_sales_invoice(sales_invoice):
jv.remark = 'Payment received against Sales Invoice {0}. {1}'.format(si.name, si.remarks)
# credit customer
jv.get("entries")[0].account = si.debit_to
jv.get("entries")[0].party_type = "Customer"
jv.get("entries")[0].party = si.customer
jv.get("entries")[0].balance = get_balance_on(si.debit_to)
jv.get("entries")[0].party_balance = get_balance_on(party=si.customer, party_type="Customer")
jv.get("entries")[0].credit = si.outstanding_amount
jv.get("entries")[0].against_invoice = si.name
jv.get("accounts")[0].account = si.debit_to
jv.get("accounts")[0].party_type = "Customer"
jv.get("accounts")[0].party = si.customer
jv.get("accounts")[0].balance = get_balance_on(si.debit_to)
jv.get("accounts")[0].party_balance = get_balance_on(party=si.customer, party_type="Customer")
jv.get("accounts")[0].credit = si.outstanding_amount
jv.get("accounts")[0].against_invoice = si.name
# debit bank
jv.get("entries")[1].debit = si.outstanding_amount
jv.get("accounts")[1].debit = si.outstanding_amount
return jv.as_dict()
@ -479,16 +479,16 @@ def get_payment_entry_from_purchase_invoice(purchase_invoice):
jv.remark = 'Payment against Purchase Invoice {0}. {1}'.format(pi.name, pi.remarks)
# credit supplier
jv.get("entries")[0].account = pi.credit_to
jv.get("entries")[0].party_type = "Supplier"
jv.get("entries")[0].party = pi.supplier
jv.get("entries")[0].balance = get_balance_on(pi.credit_to)
jv.get("entries")[0].party_balance = get_balance_on(party=pi.supplier, party_type="Supplier")
jv.get("entries")[0].debit = pi.outstanding_amount
jv.get("entries")[0].against_voucher = pi.name
jv.get("accounts")[0].account = pi.credit_to
jv.get("accounts")[0].party_type = "Supplier"
jv.get("accounts")[0].party = pi.supplier
jv.get("accounts")[0].balance = get_balance_on(pi.credit_to)
jv.get("accounts")[0].party_balance = get_balance_on(party=pi.supplier, party_type="Supplier")
jv.get("accounts")[0].debit = pi.outstanding_amount
jv.get("accounts")[0].against_voucher = pi.name
# credit bank
jv.get("entries")[1].credit = pi.outstanding_amount
jv.get("accounts")[1].credit = pi.outstanding_amount
return jv.as_dict()
@ -500,8 +500,8 @@ def get_payment_entry(doc):
jv.company = doc.company
jv.fiscal_year = doc.fiscal_year
jv.append("entries")
d2 = jv.append("entries")
jv.append("accounts")
d2 = jv.append("accounts")
if bank_account:
d2.account = bank_account["account"]

View File

@ -47,8 +47,8 @@ class TestJournalEntry(unittest.TestCase):
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Entry Account`
where %s=%s""" % (field_dict.get(test_voucher.doctype), '%s'), (test_voucher.name)))
base_jv.get("entries")[0].is_advance = "Yes" if (test_voucher.doctype in ["Sales Order", "Purchase Order"]) else "No"
base_jv.get("entries")[0].set(field_dict.get(test_voucher.doctype), test_voucher.name)
base_jv.get("accounts")[0].is_advance = "Yes" if (test_voucher.doctype in ["Sales Order", "Purchase Order"]) else "No"
base_jv.get("accounts")[0].set(field_dict.get(test_voucher.doctype), test_voucher.name)
base_jv.insert()
base_jv.submit()
@ -60,7 +60,7 @@ class TestJournalEntry(unittest.TestCase):
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where %s=%s and %s=400""" % (field_dict.get(submitted_voucher.doctype), '%s', dr_or_cr), (submitted_voucher.name)))
if base_jv.get("entries")[0].is_advance == "Yes":
if base_jv.get("accounts")[0].is_advance == "Yes":
self.advance_paid_testcase(base_jv, submitted_voucher, dr_or_cr)
self.cancel_against_voucher_testcase(submitted_voucher)
@ -68,7 +68,7 @@ class TestJournalEntry(unittest.TestCase):
#Test advance paid field
advance_paid = frappe.db.sql("""select advance_paid from `tab%s`
where name=%s""" % (test_voucher.doctype, '%s'), (test_voucher.name))
payment_against_order = base_jv.get("entries")[0].get(dr_or_cr)
payment_against_order = base_jv.get("accounts")[0].get(dr_or_cr)
self.assertTrue(flt(advance_paid[0][0]) == flt(payment_against_order))
@ -89,7 +89,7 @@ class TestJournalEntry(unittest.TestCase):
set_perpetual_inventory()
jv = frappe.copy_doc(test_records[0])
jv.get("entries")[0].update({
jv.get("accounts")[0].update({
"account": "_Test Warehouse - _TC",
"party_type": None,
"party": None
@ -107,10 +107,10 @@ class TestJournalEntry(unittest.TestCase):
self.clear_account_balance()
jv = frappe.copy_doc(test_records[0])
jv.get("entries")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv.get("entries")[1].cost_center = "_Test Cost Center - _TC"
jv.get("entries")[1].debit = 20000.0
jv.get("entries")[0].credit = 20000.0
jv.get("accounts")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv.get("accounts")[1].cost_center = "_Test Cost Center - _TC"
jv.get("accounts")[1].debit = 20000.0
jv.get("accounts")[0].credit = 20000.0
jv.insert()
jv.submit()
self.assertTrue(frappe.db.get_value("GL Entry",
@ -122,10 +122,10 @@ class TestJournalEntry(unittest.TestCase):
self.clear_account_balance()
jv = frappe.copy_doc(test_records[0])
jv.get("entries")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv.get("entries")[1].cost_center = "_Test Cost Center - _TC"
jv.get("entries")[1].debit = 20000.0
jv.get("entries")[0].credit = 20000.0
jv.get("accounts")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv.get("accounts")[1].cost_center = "_Test Cost Center - _TC"
jv.get("accounts")[1].debit = 20000.0
jv.get("accounts")[0].credit = 20000.0
jv.insert()
self.assertRaises(BudgetError, jv.submit)
@ -141,10 +141,10 @@ class TestJournalEntry(unittest.TestCase):
jv = frappe.copy_doc(test_records[0])
jv.posting_date = "2013-08-12"
jv.get("entries")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv.get("entries")[1].cost_center = "_Test Cost Center - _TC"
jv.get("entries")[1].debit = 150000.0
jv.get("entries")[0].credit = 150000.0
jv.get("accounts")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv.get("accounts")[1].cost_center = "_Test Cost Center - _TC"
jv.get("accounts")[1].debit = 150000.0
jv.get("accounts")[0].credit = 150000.0
jv.insert()
self.assertRaises(BudgetError, jv.submit)
@ -157,24 +157,24 @@ class TestJournalEntry(unittest.TestCase):
self.clear_account_balance()
jv = frappe.copy_doc(test_records[0])
jv.get("entries")[0].update({
jv.get("accounts")[0].update({
"account": "_Test Account Cost for Goods Sold - _TC",
"cost_center": "_Test Cost Center - _TC",
"party_type": None,
"party": None,
"credit": 30000.0
})
jv.get("entries")[1].debit = 30000.0
jv.get("accounts")[1].debit = 30000.0
jv.submit()
self.assertTrue(frappe.db.get_value("GL Entry",
{"voucher_type": "Journal Entry", "voucher_no": jv.name}))
jv1 = frappe.copy_doc(test_records[0])
jv1.get("entries")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv1.get("entries")[1].cost_center = "_Test Cost Center - _TC"
jv1.get("entries")[1].debit = 40000.0
jv1.get("entries")[0].credit = 40000.0
jv1.get("accounts")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv1.get("accounts")[1].cost_center = "_Test Cost Center - _TC"
jv1.get("accounts")[1].debit = 40000.0
jv1.get("accounts")[0].credit = 40000.0
jv1.submit()
self.assertTrue(frappe.db.get_value("GL Entry",

View File

@ -4,7 +4,7 @@
"cheque_no": "33",
"company": "_Test Company",
"doctype": "Journal Entry",
"entries": [
"accounts": [
{
"account": "_Test Receivable - _TC",
"party_type": "Customer",
@ -12,14 +12,14 @@
"credit": 400.0,
"debit": 0.0,
"doctype": "Journal Entry Account",
"parentfield": "entries"
"parentfield": "accounts"
},
{
"account": "_Test Account Bank Account - _TC",
"credit": 0.0,
"debit": 400.0,
"doctype": "Journal Entry Account",
"parentfield": "entries"
"parentfield": "accounts"
}
],
"fiscal_year": "_Test Fiscal Year 2013",
@ -33,7 +33,7 @@
"cheque_no": "33",
"company": "_Test Company",
"doctype": "Journal Entry",
"entries": [
"accounts": [
{
"account": "_Test Payable - _TC",
"party_type": "Supplier",
@ -41,14 +41,14 @@
"credit": 0.0,
"debit": 400.0,
"doctype": "Journal Entry Account",
"parentfield": "entries"
"parentfield": "accounts"
},
{
"account": "_Test Account Bank Account - _TC",
"credit": 400.0,
"debit": 0.0,
"doctype": "Journal Entry Account",
"parentfield": "entries"
"parentfield": "accounts"
}
],
"fiscal_year": "_Test Fiscal Year 2013",
@ -62,7 +62,7 @@
"cheque_no": "33",
"company": "_Test Company",
"doctype": "Journal Entry",
"entries": [
"accounts": [
{
"account": "_Test Receivable - _TC",
"party_type": "Customer",
@ -70,7 +70,7 @@
"credit": 0.0,
"debit": 400.0,
"doctype": "Journal Entry Account",
"parentfield": "entries"
"parentfield": "accounts"
},
{
"account": "Sales - _TC",
@ -78,7 +78,7 @@
"credit": 400.0,
"debit": 0.0,
"doctype": "Journal Entry Account",
"parentfield": "entries"
"parentfield": "accounts"
}
],
"fiscal_year": "_Test Fiscal Year 2013",

View File

@ -35,7 +35,7 @@ class PaymentTool(Document):
v.against_voucher_type))
if v.payment_amount:
d1 = jv.append("entries")
d1 = jv.append("accounts")
d1.account = self.party_account
d1.party_type = self.party_type
d1.party = self.party
@ -45,7 +45,7 @@ class PaymentTool(Document):
d1.set('is_advance', 'Yes' if v.against_voucher_type in ['Sales Order', 'Purchase Order'] else 'No')
total_payment_amount = flt(total_payment_amount) + flt(d1.debit) - flt(d1.credit)
d2 = jv.append("entries")
d2 = jv.append("accounts")
d2.account = self.payment_account
d2.set('debit' if total_payment_amount < 0 else 'credit', abs(total_payment_amount))
if self.payment_account:

View File

@ -123,11 +123,11 @@ class TestPaymentTool(unittest.TestCase):
def create_against_jv(self, test_record, args):
jv = frappe.copy_doc(test_record)
jv.get("entries")[0].update(args)
jv.get("accounts")[0].update(args)
if args.get("debit"):
jv.get("entries")[1].credit = args["debit"]
jv.get("accounts")[1].credit = args["debit"]
elif args.get("credit"):
jv.get("entries")[1].debit = args["credit"]
jv.get("accounts")[1].debit = args["credit"]
jv.insert()
jv.submit()
@ -174,7 +174,7 @@ class TestPaymentTool(unittest.TestCase):
[paytool.party_account, paytool.party, 100.00, None, None, None, None, expected_outstanding.get("Purchase Order")[0]]
]
for jv_entry in new_jv.get("entries"):
for jv_entry in new_jv.get("accounts"):
if paytool.party_account == jv_entry.get("account") and paytool.party == jv_entry.get("party"):
row = [
jv_entry.get("account"),

View File

@ -16,10 +16,10 @@ class TestPeriodClosingVoucher(unittest.TestCase):
jv.submit()
jv1 = frappe.copy_doc(jv_records[0])
jv1.get("entries")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv1.get("entries")[1].cost_center = "_Test Cost Center - _TC"
jv1.get("entries")[1].debit = 600.0
jv1.get("entries")[0].credit = 600.0
jv1.get("accounts")[1].account = "_Test Account Cost for Goods Sold - _TC"
jv1.get("accounts")[1].cost_center = "_Test Cost Center - _TC"
jv1.get("accounts")[1].debit = 600.0
jv1.get("accounts")[0].credit = 600.0
jv1.insert()
jv1.submit()

View File

@ -107,7 +107,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
this.get_terms();
},
entries_add: function(doc, cdt, cdn) {
items_add: function(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
this.frm.script_manager.copy_from_first_row("items", row,
["expense_account", "cost_center", "project_name"]);

View File

@ -12,12 +12,12 @@ from erpnext.controllers.buying_controller import BuyingController
from erpnext.accounts.party import get_party_account, get_due_date
form_grid_templates = {
"entries": "templates/form_grid/item_grid.html"
"items": "templates/form_grid/item_grid.html"
}
class PurchaseInvoice(BuyingController):
tname = 'Purchase Invoice Item'
fname = 'entries'
fname = 'items'
def __init__(self, arg1, arg2=None):
super(PurchaseInvoice, self).__init__(arg1, arg2)
@ -53,7 +53,7 @@ class PurchaseInvoice(BuyingController):
self.set_aging_date()
self.set_against_expense_account()
self.validate_write_off_account()
self.update_valuation_rate("entries")
self.update_valuation_rate("items")
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount",
"items")
self.create_remarks()
@ -78,7 +78,7 @@ class PurchaseInvoice(BuyingController):
"Purchase Invoice Advance", "advances", "debit", "purchase_order")
def check_active_purchase_items(self):
for d in self.get('entries'):
for d in self.get('items'):
if d.item_code: # extra condn coz item_code is not mandatory in PV
if frappe.db.get_value("Item", d.item_code, "is_purchase_item") != 'Yes':
msgprint(_("Item {0} is not Purchase Item").format(d.item_code), raise_exception=True)
@ -99,7 +99,7 @@ class PurchaseInvoice(BuyingController):
def check_for_stopped_status(self):
check_list = []
for d in self.get('entries'):
for d in self.get('items'):
if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt:
check_list.append(d.purchase_order)
stopped = frappe.db.sql("select name from `tabPurchase Order` where status = 'Stopped' and name = %s", d.purchase_order)
@ -159,7 +159,7 @@ class PurchaseInvoice(BuyingController):
against_accounts = []
stock_items = self.get_stock_items()
for item in self.get("entries"):
for item in self.get("items"):
if auto_accounting_for_stock and item.item_code in stock_items \
and self.is_opening == 'No':
# in case of auto inventory accounting, against expense account is always
@ -181,13 +181,13 @@ class PurchaseInvoice(BuyingController):
def po_required(self):
if frappe.db.get_value("Buying Settings", None, "po_required") == 'Yes':
for d in self.get('entries'):
for d in self.get('items'):
if not d.purchase_order:
throw(_("Purchse Order number required for Item {0}").format(d.item_code))
def pr_required(self):
if frappe.db.get_value("Buying Settings", None, "pr_required") == 'Yes':
for d in self.get('entries'):
for d in self.get('items'):
if not d.purchase_receipt:
throw(_("Purchase Receipt number required for Item {0}").format(d.item_code))
@ -196,7 +196,7 @@ class PurchaseInvoice(BuyingController):
throw(_("Please enter Write Off Account"))
def check_prev_docstatus(self):
for d in self.get('entries'):
for d in self.get('items'):
if d.purchase_order:
submitted = frappe.db.sql("select name from `tabPurchase Order` where docstatus = 1 and name = %s", d.purchase_order)
if not submitted:
@ -301,7 +301,7 @@ class PurchaseInvoice(BuyingController):
# item gl entries
negative_expense_to_be_booked = 0.0
stock_items = self.get_stock_items()
for item in self.get("entries"):
for item in self.get("items"):
if flt(item.base_amount):
gl_entries.append(
self.get_gl_dict({

View File

@ -78,7 +78,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pr.submit()
pi = frappe.copy_doc(test_records[1])
for d in pi.get("entries"):
for d in pi.get("items"):
d.purchase_receipt = pr.name
pi.insert()
pi.submit()
@ -107,8 +107,8 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
pi = frappe.copy_doc(test_records[1])
pi.get("entries")[0].item_code = "_Test Non Stock Item"
pi.get("entries")[0].expense_account = "_Test Account Cost for Goods Sold - _TC"
pi.get("items")[0].item_code = "_Test Non Stock Item"
pi.get("items")[0].expense_account = "_Test Account Cost for Goods Sold - _TC"
pi.get("taxes").pop(0)
pi.get("taxes").pop(1)
pi.insert()
@ -140,7 +140,7 @@ class TestPurchaseInvoice(unittest.TestCase):
["_Test Item Home Desktop 100", 90, 59],
["_Test Item Home Desktop 200", 135, 177]
]
for i, item in enumerate(wrapper.get("entries")):
for i, item in enumerate(wrapper.get("items")):
self.assertEqual(item.item_code, expected_values[i][0])
self.assertEqual(item.item_tax_amount, expected_values[i][1])
self.assertEqual(item.valuation_rate, expected_values[i][2])
@ -166,7 +166,7 @@ class TestPurchaseInvoice(unittest.TestCase):
def test_purchase_invoice_with_subcontracted_item(self):
wrapper = frappe.copy_doc(test_records[0])
wrapper.get("entries")[0].item_code = "_Test FG Item"
wrapper.get("items")[0].item_code = "_Test FG Item"
wrapper.insert()
wrapper.load_from_db()
@ -174,7 +174,7 @@ class TestPurchaseInvoice(unittest.TestCase):
["_Test FG Item", 90, 59],
["_Test Item Home Desktop 200", 135, 177]
]
for i, item in enumerate(wrapper.get("entries")):
for i, item in enumerate(wrapper.get("items")):
self.assertEqual(item.item_code, expected_values[i][0])
self.assertEqual(item.item_tax_amount, expected_values[i][1])
self.assertEqual(item.valuation_rate, expected_values[i][2])
@ -209,7 +209,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pi = frappe.copy_doc(test_records[0])
pi.append("advances", {
"journal_entry": jv.name,
"jv_detail_no": jv.get("entries")[0].name,
"jv_detail_no": jv.get("accounts")[0].name,
"advance_amount": 400,
"allocated_amount": 300,
"remarks": jv.remark

View File

@ -199,7 +199,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
this.write_off_outstanding_amount_automatically();
},
entries_add: function(doc, cdt, cdn) {
items_add: function(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
this.frm.script_manager.copy_from_first_row("items", row, ["income_account", "cost_center"]);
},
@ -209,7 +209,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
this.hide_fields(this.frm.doc);
},
entries_on_form_rendered: function(doc, grid_row) {
items_on_form_rendered: function(doc, grid_row) {
erpnext.setup_serial_no(grid_row)
}

View File

@ -13,12 +13,12 @@ from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.selling_controller import SellingController
form_grid_templates = {
"entries": "templates/form_grid/item_grid.html"
"items": "templates/form_grid/item_grid.html"
}
class SalesInvoice(SellingController):
tname = 'Sales Invoice Item'
fname = 'entries'
fname = 'items'
def __init__(self, arg1, arg2=None):
super(SalesInvoice, self).__init__(arg1, arg2)
@ -133,7 +133,7 @@ class SalesInvoice(SellingController):
'second_source_field': 'qty',
'second_join_field': 'so_detail',
'overflow_type': 'delivery',
'extra_cond': """ and exists(select name from `tabSales Invoice`
'extra_cond': """ and exists(select name from `tabSales Invoice`
where name=`tabSales Invoice Item`.parent and ifnull(update_stock, 0) = 1)"""
})
@ -187,7 +187,7 @@ class SalesInvoice(SellingController):
self.update_stock = cint(pos.get("update_stock"))
# set pos values in items
for item in self.get("entries"):
for item in self.get("items"):
if item.get('item_code'):
for fname, val in get_pos_settings_item_details(pos,
frappe._dict(item.as_dict()), pos).items():
@ -249,7 +249,7 @@ class SalesInvoice(SellingController):
def validate_fixed_asset_account(self):
"""Validate Fixed Asset and whether Income Account Entered Exists"""
for d in self.get('entries'):
for d in self.get('items'):
item = frappe.db.sql("""select name,is_asset_item,is_sales_item from `tabItem`
where name = %s""", d.item_code)
acc = frappe.db.sql("""select account_type from `tabAccount`
@ -296,7 +296,7 @@ class SalesInvoice(SellingController):
def set_against_income_account(self):
"""Set against account for debit to account"""
against_acc = []
for d in self.get('entries'):
for d in self.get('items'):
if d.income_account not in against_acc:
against_acc.append(d.income_account)
self.against_income_account = ','.join(against_acc)
@ -311,7 +311,7 @@ class SalesInvoice(SellingController):
dic = {'Sales Order':'so_required','Delivery Note':'dn_required'}
for i in dic:
if frappe.db.get_value('Selling Settings', None, dic[i]) == 'Yes':
for d in self.get('entries'):
for d in self.get('items'):
if frappe.db.get_value('Item', d.item_code, 'is_stock_item') == 'Yes' \
and not d.get(i.lower().replace(' ','_')):
msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)
@ -336,12 +336,12 @@ class SalesInvoice(SellingController):
def validate_item_code(self):
for d in self.get('entries'):
for d in self.get('items'):
if not d.item_code:
msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
def validate_delivery_note(self):
for d in self.get("entries"):
for d in self.get("items"):
if d.delivery_note:
msgprint(_("Stock cannot be updated against Delivery Note {0}").format(d.delivery_note), raise_exception=1)
@ -366,7 +366,7 @@ class SalesInvoice(SellingController):
.format(self.name, self.c_form_no), raise_exception = 1)
def update_current_stock(self):
for d in self.get('entries'):
for d in self.get('items'):
if d.item_code and d.warehouse:
bin = frappe.db.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
@ -399,12 +399,12 @@ class SalesInvoice(SellingController):
if cint(self.is_pos) == 1:
w = self.get_warehouse()
if w:
for d in self.get('entries'):
for d in self.get('items'):
if not d.warehouse:
d.warehouse = cstr(w)
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
make_packing_list(self, 'entries')
make_packing_list(self, 'items')
else:
self.set('packed_items', [])
@ -421,7 +421,7 @@ class SalesInvoice(SellingController):
frappe.db.set(self,'paid_amount',0)
def check_prev_docstatus(self):
for d in self.get('entries'):
for d in self.get('items'):
if d.sales_order:
submitted = frappe.db.sql("""select name from `tabSales Order`
where docstatus = 1 and name = %s""", d.sales_order)
@ -514,7 +514,7 @@ class SalesInvoice(SellingController):
def make_item_gl_entries(self, gl_entries):
# income account gl entries
for item in self.get("entries"):
for item in self.get("items"):
if flt(item.base_amount):
gl_entries.append(
self.get_gl_dict({

View File

@ -44,11 +44,11 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("entries")),
self.assertEquals(len(si.get("items")),
len(expected_values)-1)
# check if item values are calculated
for d in si.get("entries"):
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
@ -80,10 +80,10 @@ class TestSalesInvoice(unittest.TestCase):
si = frappe.copy_doc(test_records[2])
si.currency = "USD"
si.conversion_rate = 50
si.get("entries")[0].rate = 1
si.get("entries")[0].price_list_rate = 1
si.get("entries")[1].rate = 3
si.get("entries")[1].price_list_rate = 3
si.get("items")[0].rate = 1
si.get("items")[0].price_list_rate = 1
si.get("items")[1].rate = 3
si.get("items")[1].price_list_rate = 3
si.insert()
expected_values = {
@ -94,11 +94,11 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("entries")),
self.assertEquals(len(si.get("items")),
len(expected_values)-1)
# check if item values are calculated
for d in si.get("entries"):
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
@ -148,11 +148,11 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("entries")),
self.assertEquals(len(si.get("items")),
len(expected_values)-1)
# check if item values are calculated
for d in si.get("entries"):
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
@ -204,7 +204,7 @@ class TestSalesInvoice(unittest.TestCase):
expected_values = sorted([
[si.debit_to, 1500, 0.0],
[test_records[3]["entries"][0]["income_account"], 0.0, 1163.45],
[test_records[3]["items"][0]["income_account"], 0.0, 1163.45],
[test_records[3]["taxes"][0]["account_head"], 0.0, 130.31],
[test_records[3]["taxes"][1]["account_head"], 0.0, 2.61],
[test_records[3]["taxes"][2]["account_head"], 0.0, 1.31],
@ -234,8 +234,8 @@ class TestSalesInvoice(unittest.TestCase):
for i, tax in enumerate(si.get("taxes")):
tax.idx = i+1
si.get("entries")[0].price_list_rate = 62.5
si.get("entries")[0].price_list_rate = 191
si.get("items")[0].price_list_rate = 62.5
si.get("items")[0].price_list_rate = 191
for i in xrange(6):
si.get("taxes")[i].included_in_print_rate = 1
@ -259,11 +259,11 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("entries")),
self.assertEquals(len(si.get("items")),
len(expected_values)-1)
# check if item values are calculated
for d in si.get("entries"):
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
@ -296,10 +296,10 @@ class TestSalesInvoice(unittest.TestCase):
si = frappe.copy_doc(test_records[3])
si.currency = "USD"
si.conversion_rate = 50
si.get("entries")[0].price_list_rate = 55.56
si.get("entries")[0].discount_percentage = 10
si.get("entries")[1].price_list_rate = 187.5
si.get("entries")[1].discount_percentage = 20
si.get("items")[0].price_list_rate = 55.56
si.get("items")[0].discount_percentage = 10
si.get("items")[1].price_list_rate = 187.5
si.get("items")[1].discount_percentage = 20
si.get("taxes")[6].rate = 5000
si.insert()
@ -312,10 +312,10 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("entries")), len(expected_values)-1)
self.assertEquals(len(si.get("items")), len(expected_values)-1)
# check if item values are calculated
for d in si.get("entries"):
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
@ -355,7 +355,7 @@ class TestSalesInvoice(unittest.TestCase):
import test_records as jv_test_records
jv = frappe.get_doc(frappe.copy_doc(jv_test_records[0]))
jv.get("entries")[0].against_invoice = w.name
jv.get("accounts")[0].against_invoice = w.name
jv.insert()
jv.submit()
@ -375,7 +375,7 @@ class TestSalesInvoice(unittest.TestCase):
tlb.submit()
si = frappe.get_doc(frappe.copy_doc(test_records[0]))
si.get("entries")[0].time_log_batch = tlb.name
si.get("items")[0].time_log_batch = tlb.name
si.insert()
si.submit()
@ -407,7 +407,7 @@ class TestSalesInvoice(unittest.TestCase):
expected_values = sorted([
[si.debit_to, 630.0, 0.0],
[test_records[1]["entries"][0]["income_account"], 0.0, 500.0],
[test_records[1]["items"][0]["income_account"], 0.0, 500.0],
[test_records[1]["taxes"][0]["account_head"], 0.0, 80.0],
[test_records[1]["taxes"][1]["account_head"], 0.0, 50.0],
])
@ -461,11 +461,11 @@ class TestSalesInvoice(unittest.TestCase):
expected_gl_entries = sorted([
[si.debit_to, 630.0, 0.0],
[pos["entries"][0]["income_account"], 0.0, 500.0],
[pos["items"][0]["income_account"], 0.0, 500.0],
[pos["taxes"][0]["account_head"], 0.0, 80.0],
[pos["taxes"][1]["account_head"], 0.0, 50.0],
[stock_in_hand, 0.0, 75.0],
[pos["entries"][0]["expense_account"], 75.0, 0.0],
[pos["items"][0]["expense_account"], 75.0, 0.0],
[si.debit_to, 0.0, 600.0],
["_Test Account Bank Account - _TC", 600.0, 0.0]
])
@ -522,7 +522,7 @@ class TestSalesInvoice(unittest.TestCase):
si_doc = copy.deepcopy(test_records[1])
si_doc["update_stock"] = 1
si_doc["posting_time"] = "12:05"
si_doc.get("entries")[0]["warehouse"] = "_Test Warehouse No Account - _TC"
si_doc.get("items")[0]["warehouse"] = "_Test Warehouse No Account - _TC"
si = frappe.copy_doc(si_doc)
si.insert()
@ -544,7 +544,7 @@ class TestSalesInvoice(unittest.TestCase):
expected_gl_entries = sorted([
[si.debit_to, 630.0, 0.0],
[si_doc.get("entries")[0]["income_account"], 0.0, 500.0],
[si_doc.get("items")[0]["income_account"], 0.0, 500.0],
[si_doc.get("taxes")[0]["account_head"], 0.0, 80.0],
[si_doc.get("taxes")[1]["account_head"], 0.0, 50.0],
])
@ -565,7 +565,7 @@ class TestSalesInvoice(unittest.TestCase):
set_perpetual_inventory()
si = frappe.get_doc(test_records[1])
si.get("entries")[0].item_code = None
si.get("items")[0].item_code = None
si.insert()
si.submit()
@ -576,7 +576,7 @@ class TestSalesInvoice(unittest.TestCase):
expected_values = sorted([
[si.debit_to, 630.0, 0.0],
[test_records[1]["entries"][0]["income_account"], 0.0, 500.0],
[test_records[1]["items"][0]["income_account"], 0.0, 500.0],
[test_records[1]["taxes"][0]["account_head"], 0.0, 80.0],
[test_records[1]["taxes"][1]["account_head"], 0.0, 50.0],
])
@ -591,7 +591,7 @@ class TestSalesInvoice(unittest.TestCase):
self.clear_stock_account_balance()
set_perpetual_inventory()
si = frappe.get_doc(test_records[1])
si.get("entries")[0].item_code = "_Test Non Stock Item"
si.get("items")[0].item_code = "_Test Non Stock Item"
si.insert()
si.submit()
@ -602,7 +602,7 @@ class TestSalesInvoice(unittest.TestCase):
expected_values = sorted([
[si.debit_to, 630.0, 0.0],
[test_records[1]["entries"][0]["income_account"], 0.0, 500.0],
[test_records[1]["items"][0]["income_account"], 0.0, 500.0],
[test_records[1]["taxes"][0]["account_head"], 0.0, 80.0],
[test_records[1]["taxes"][1]["account_head"], 0.0, 50.0],
])
@ -642,7 +642,7 @@ class TestSalesInvoice(unittest.TestCase):
si.append("advances", {
"doctype": "Sales Invoice Advance",
"journal_entry": jv.name,
"jv_detail_no": jv.get("entries")[0].name,
"jv_detail_no": jv.get("accounts")[0].name,
"advance_amount": 400,
"allocated_amount": 300,
"remarks": jv.remark
@ -683,9 +683,9 @@ class TestSalesInvoice(unittest.TestCase):
si = frappe.copy_doc(test_records[0])
si.update_stock = 1
si.get("entries")[0].item_code = "_Test Serialized Item With Series"
si.get("entries")[0].qty = 1
si.get("entries")[0].serial_no = serial_nos[0]
si.get("items")[0].item_code = "_Test Serialized Item With Series"
si.get("items")[0].qty = 1
si.get("items")[0].serial_no = serial_nos[0]
si.insert()
si.submit()
@ -701,7 +701,7 @@ class TestSalesInvoice(unittest.TestCase):
si = self.test_serialized()
si.cancel()
serial_nos = get_serial_nos(si.get("entries")[0].serial_no)
serial_nos = get_serial_nos(si.get("items")[0].serial_no)
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0], "status"), "Available")
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0], "warehouse"), "_Test Warehouse - _TC")
@ -721,9 +721,9 @@ class TestSalesInvoice(unittest.TestCase):
si = frappe.copy_doc(test_records[0])
si.update_stock = 1
si.get("entries")[0].item_code = "_Test Serialized Item With Series"
si.get("entries")[0].qty = 1
si.get("entries")[0].serial_no = serial_nos[0]
si.get("items")[0].item_code = "_Test Serialized Item With Series"
si.get("items")[0].qty = 1
si.get("items")[0].serial_no = serial_nos[0]
si.insert()
self.assertRaises(SerialNoStatusError, si.submit)

View File

@ -184,7 +184,7 @@ def update_against_doc(d, jv_obj):
"""
Updates against document, if partial amount splits into rows
"""
jv_detail = jv_obj.get("entries", {"name": d["voucher_detail_no"]})[0]
jv_detail = jv_obj.get("accounts", {"name": d["voucher_detail_no"]})[0]
jv_detail.set(d["dr_or_cr"], d["allocated_amt"])
jv_detail.set(d["against_fld"], d["against_voucher"])
@ -192,7 +192,7 @@ def update_against_doc(d, jv_obj):
jvd = frappe.db.sql("""select cost_center, balance, against_account, is_advance
from `tabJournal Entry Account` where name = %s""", d['voucher_detail_no'])
# new entry with balance amount
ch = jv_obj.append("entries")
ch = jv_obj.append("accounts")
ch.account = d['account']
ch.party_type = d["party_type"]
ch.party = d["party"]

View File

@ -90,7 +90,7 @@ class TestPurchaseOrder(unittest.TestCase):
pi = make_purchase_invoice(po.name)
self.assertEquals(pi.doctype, "Purchase Invoice")
self.assertEquals(len(pi.get("entries", [])), len(test_records[0]["items"]))
self.assertEquals(len(pi.get("items", [])), len(test_records[0]["items"]))
pi.credit_to = "_Test Payable - _TC"
pi.posting_date = "2013-05-12"

View File

@ -385,7 +385,7 @@ class AccountsController(TransactionBase):
and ifnull(allocated_amount, 0) = 0""" % (childtype, '%s', '%s'), (parentfield, self.name))
def get_advances(self, account_head, party_type, party, child_doctype, parentfield, dr_or_cr, against_order_field):
so_list = list(set([d.get(against_order_field) for d in self.get("entries") if d.get(against_order_field)]))
so_list = list(set([d.get(against_order_field) for d in self.get("items") if d.get(against_order_field)]))
cond = ""
if so_list:
cond = "or (ifnull(t2.%s, '') in (%s))" % ("against_" + against_order_field, ', '.join(['%s']*len(so_list)))
@ -421,7 +421,7 @@ class AccountsController(TransactionBase):
})
def validate_advance_jv(self, advance_table_fieldname, against_order_field):
order_list = list(set([d.get(against_order_field) for d in self.get("entries") if d.get(against_order_field)]))
order_list = list(set([d.get(against_order_field) for d in self.get("items") if d.get(against_order_field)]))
if order_list:
account = self.get("debit_to" if self.doctype=="Sales Invoice" else "credit_to")
@ -452,7 +452,7 @@ class AccountsController(TransactionBase):
item_tolerance = {}
global_tolerance = None
for item in self.get("entries"):
for item in self.get("items"):
if item.get(item_ref_dn):
ref_amt = flt(frappe.db.get_value(ref_dt + " Item",
item.get(item_ref_dn), based_on), self.precision(based_on, item))

View File

@ -199,7 +199,7 @@ class StatusUpdater(Document):
all_zero_amount_refdoc = frappe.db.sql_list("""select name from `tab%s`
where docstatus=1 and net_total = 0""" % ref_dt)
for item in self.get("entries"):
for item in self.get("items"):
if item.get(ref_fieldname) \
and item.get(ref_fieldname) in all_zero_amount_refdoc \
and item.get(ref_fieldname) not in zero_amount_refdoc:

View File

@ -20,12 +20,12 @@ erpnext.hr.ExpenseClaimController = frappe.ui.form.Controller.extend({
jv.remark = 'Payment against Expense Claim: ' + cur_frm.doc.name;
jv.fiscal_year = cur_frm.doc.fiscal_year;
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'entries');
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts');
d1.debit = cur_frm.doc.total_sanctioned_amount;
d1.against_expense_claim = cur_frm.doc.name;
// credit to bank
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'entries');
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts');
d1.credit = cur_frm.doc.total_sanctioned_amount;
d1.against_expense_claim = cur_frm.doc.name;
if(r.message) {

View File

@ -48,12 +48,12 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
jv.posting_date = dateutil.obj_to_str(new Date());
// credit to bank
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'entries');
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts');
d1.account = r.message['default_bank_account'];
d1.credit = r.message['amount']
// debit to salary account
var d2 = frappe.model.add_child(jv, 'Journal Entry Account', 'entries');
var d2 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts');
d2.debit = r.message['amount']
loaddoc('Journal Entry', jv.name);

View File

@ -6,209 +6,209 @@ from frappe.model import rename_field
from frappe.modules import scrub, get_doctype_module
rename_map = {
# "Opportunity": [
# ["enquiry_details", "items"]
# ],
# "Quotation": [
# ["quotation_details", "items"],
# ["other_charges", "taxes"]
# ],
# "Sales Order": [
# ["sales_order_details", "items"],
# ["other_charges", "taxes"],
# ["packing_details", "packed_items"]
# ],
# "Delivery Note": [
# ["delivery_note_details", "items"],
# ["other_charges", "taxes"],
# ["packing_details", "packed_items"]
# ],
"Opportunity": [
["enquiry_details", "items"]
],
"Quotation": [
["quotation_details", "items"],
["other_charges", "taxes"]
],
"Sales Order": [
["sales_order_details", "items"],
["other_charges", "taxes"],
["packing_details", "packed_items"]
],
"Delivery Note": [
["delivery_note_details", "items"],
["other_charges", "taxes"],
["packing_details", "packed_items"]
],
"Sales Invoice": [
["entries", "items"],
# ["other_charges", "taxes"],
# ["packing_details", "packed_items"],
# ["advance_adjustment_details", "advances"]
["other_charges", "taxes"],
["packing_details", "packed_items"],
["advance_adjustment_details", "advances"]
],
"Material Request": [
["indent_details", "items"]
],
"Supplier Quotation": [
["quotation_items", "items"],
["other_charges", "taxes"]
],
"Purchase Order": [
["po_details", "items"],
["other_charges", "taxes"],
["po_raw_material_details", "supplied_items"]
],
"Purchase Receipt": [
["purchase_receipt_details", "items"],
["other_charges", "taxes"],
["pr_raw_material_details", "supplied_items"]
],
# "Material Request": [
# ["indent_details", "items"]
# ],
# "Supplier Quotation": [
# ["quotation_items", "items"],
# ["other_charges", "taxes"]
# ],
# "Purchase Order": [
# ["po_details", "items"],
# ["other_charges", "taxes"],
# ["po_raw_material_details", "supplied_items"]
# ],
# "Purchase Receipt": [
# ["purchase_receipt_details", "items"],
# ["other_charges", "taxes"],
# ["pr_raw_material_details", "supplied_items"]
# ],
"Purchase Invoice": [
["entries", "items"],
# ["other_charges", "taxes"],
# ["advance_allocation_details", "advances"]
["other_charges", "taxes"],
["advance_allocation_details", "advances"]
],
"Production Order": [
["production_order_operations", "operations"]
],
"BOM": [
["bom_operations", "operations"],
["bom_materials", "items"],
["flat_bom_details", "exploded_items"]
],
"Payment Reconciliation": [
["payment_reconciliation_payments", "payments"],
["payment_reconciliation_invoices", "invoices"]
],
"Sales Taxes and Charges Master": [
["other_charges", "taxes"],
["valid_for_territories", "territories"]
],
"Purchase Taxes and Charges Master": [
["other_charges", "taxes"]
],
"Shipping Rule": [
["shipping_rule_conditions", "conditions"],
["valid_for_territories", "territories"]
],
"Price List": [
["valid_for_territories", "territories"]
],
"Appraisal": [
["appraisal_details", "goals"]
],
"Appraisal Template": [
["kra_sheet", "goals"]
],
# "Production Order": [
# ["production_order_operations", "operations"]
# ],
# "BOM": [
# ["bom_operations", "operations"],
# ["bom_materials", "items"],
# ["flat_bom_details", "exploded_items"]
# ],
# "Payment Reconciliation": [
# ["payment_reconciliation_payments", "payments"],
# ["payment_reconciliation_invoices", "invoices"]
# ],
# "Sales Taxes and Charges Master": [
# ["other_charges", "taxes"],
# ["valid_for_territories", "territories"]
# ],
# "Purchase Taxes and Charges Master": [
# ["other_charges", "taxes"]
# ],
# "Shipping Rule": [
# ["shipping_rule_conditions", "conditions"],
# ["valid_for_territories", "territories"]
# ],
# "Price List": [
# ["valid_for_territories", "territories"]
# ],
# "Appraisal": [
# ["appraisal_details", "goals"]
# ],
# "Appraisal Template": [
# ["kra_sheet", "goals"]
# ],
"Bank Reconciliation": [
["entries", "journal_entries"]
],
# "Cost Center": [
# ["budget_details", "budgets"]
# ],
# "C-Form": [
# ["invoice_details", "invoices"]
# ],
# "Customize Form": [
# ["customize_form_fields", "fields"]
# ],
# "Email Alert": [
# ["email_alert_recipients", "recipients"]
# ],
# "Employee": [
# ["employee_leave_approvers", "leave_approvers"],
# ["educational_qualification_details", "educational_qualifications"],
# ["previous_experience_details", "external_work_experiences"],
# ["experience_in_company_details", "internal_work_experiences"]
# ],
# "Event": [
# ["event_individuals", "users"],
# ["event_roles", "roles"]
# ],
# "Expense Claim": [
# ["expense_voucher_details", "expenses"]
# ],
# "Fiscal Year": [
# ["fiscal_year_companies", "companies"]
# ],
# "Holiday List": [
# ["holiday_list_details", "holidays"]
# ],
# "Installation Note": [
# ["installed_item_details", "items"]
# ],
# "Item": [
# ["item_variants", "variants"],
# ["item_reorder", "reorder_levels"],
# ["uom_conversion_details", "uoms"],
# ["item_supplier_details", "supplier_item_codes"],
# ["item_customer_details", "customer_item_codes"],
# ["item_tax", "taxes"],
# ["item_specification_details", "quality_parameters"],
# ["item_website_specifications", "website_specifications"]
# ],
# "Item Group": [
# ["item_website_specifications", "website_specifications"]
# ],
# "Landed Cost Voucher": [
# ["landed_cost_purchase_receipts", "purchase_receipts"],
# ["landed_cost_items", "items"],
# ["landed_cost_taxes_and_charges", "taxes"]
# ],
# "Maintenance Schedule": [
# ["item_maintenance_detail", "items"],
# ["maintenance_schedule_detail", "schedules"]
# ],
# "Maintenance Visit": [
# ["maintenance_visit_details", "purposes"]
# ],
# "Packing Slip": [
# ["item_details", "items"]
# ],
# "Customer": [
# ["party_accounts", "accounts"]
# ],
# "Customer Group": [
# ["party_accounts", "accounts"]
# ],
# "Supplier": [
# ["party_accounts", "accounts"]
# ],
# "Supplier Type": [
# ["party_accounts", "accounts"]
# ],
# "Payment Tool": [
# ["payment_tool_details", "against_vouchers"]
# ],
# "Production Planning Tool": [
# ["pp_so_details", "sales_orders"],
# ["pp_details", "items"]
# ],
# "Project": [
# ["project_milestones", "milestones"]
# ],
# "Quality Inspection": [
# ["qa_specification_details", "readings"]
# ],
# "Salary Slip": [
# ["earning_details", "earnings"],
# ["deduction_details", "deductions"]
# ],
# "Salary Structure": [
# ["earning_details", "earnings"],
# ["deduction_details", "deductions"]
# ],
# "Sales BOM": [
# ["sales_bom_items", "items"]
# ],
# "SMS Settings": [
# ["static_parameter_details", "static_parameters"]
# ],
# "Stock Entry": [
# ["mtn_details", "items"]
# ],
# "Sales Partner": [
# ["partner_target_details", "targets"]
# ],
# "Sales Person": [
# ["target_details", "targets"]
# ],
# "Territory": [
# ["target_details", "targets"]
# ],
# "Time Log Batch": [
# ["time_log_batch_details", "time_logs"]
# ],
# "Workflow": [
# ["workflow_document_states", "document_states"],
# ["workflow_transitions", "transitions"]
# ],
# "Workstation": [
# ["workstation_operation_hours", "working_hours"]
# ],
"Cost Center": [
["budget_details", "budgets"]
],
"C-Form": [
["invoice_details", "invoices"]
],
"Customize Form": [
["customize_form_fields", "fields"]
],
"Email Alert": [
["email_alert_recipients", "recipients"]
],
"Employee": [
["employee_leave_approvers", "leave_approvers"],
# ["educational_qualification_details", "educational_qualifications"],
# ["previous_experience_details", "external_work_experiences"], work_history
# ["experience_in_company_details", "internal_work_experiences"], internal_work_history
],
"Event": [
["event_individuals", "users"],
["event_roles", "roles"]
],
"Expense Claim": [
["expense_voucher_details", "expenses"]
],
"Fiscal Year": [
["fiscal_year_companies", "companies"]
],
"Holiday List": [
["holiday_list_details", "holidays"]
],
"Installation Note": [
["installed_item_details", "items"]
],
"Item": [
["item_variants", "variants"],
["item_reorder", "reorder_levels"],
["uom_conversion_details", "uoms"],
# ["item_supplier_details", "supplier_item_codes"],
# ["item_customer_details", "customer_item_codes"],
["item_tax", "taxes"],
["item_specification_details", "quality_parameters"],
["item_website_specifications", "website_specifications"]
],
"Item Group": [
["item_website_specifications", "website_specifications"]
],
"Landed Cost Voucher": [
["landed_cost_purchase_receipts", "purchase_receipts"],
["landed_cost_items", "items"],
["landed_cost_taxes_and_charges", "taxes"]
],
"Maintenance Schedule": [
["item_maintenance_detail", "items"],
["maintenance_schedule_detail", "schedules"]
],
"Maintenance Visit": [
["maintenance_visit_details", "purposes"]
],
"Packing Slip": [
["item_details", "items"]
],
"Customer": [
["party_accounts", "accounts"]
],
"Customer Group": [
["party_accounts", "accounts"]
],
"Supplier": [
["party_accounts", "accounts"]
],
"Supplier Type": [
["party_accounts", "accounts"]
],
"Payment Tool": [
# ["payment_tool_details", "against_vouchers"]
],
"Production Planning Tool": [
["pp_so_details", "sales_orders"],
["pp_details", "items"]
],
"Project": [
["project_milestones", "milestones"]
],
"Quality Inspection": [
["qa_specification_details", "readings"]
],
"Salary Slip": [
["earning_details", "earnings"],
["deduction_details", "deductions"]
],
"Salary Structure": [
["earning_details", "earnings"],
["deduction_details", "deductions"]
],
"Sales BOM": [
["sales_bom_items", "items"]
],
"SMS Settings": [
# ["static_parameter_details", "static_parameters"]
],
"Stock Entry": [
["mtn_details", "items"]
],
"Sales Partner": [
["partner_target_details", "targets"]
],
"Sales Person": [
["target_details", "targets"]
],
"Territory": [
["target_details", "targets"]
],
"Time Log Batch": [
["time_log_batch_details", "time_logs"]
],
"Workflow": [
# ["workflow_document_states", "document_states"],
["workflow_transitions", "transitions"]
],
"Workstation": [
["workstation_operation_hours", "working_hours"]
],
"Payment Reconciliation Payment": [
["journal_voucher", "journal_entry"],
],
@ -217,18 +217,13 @@ rename_map = {
],
"Sales Invoice Advance": [
["journal_voucher", "journal_entry"],
],
"Journal Entry": [
["entries", "accounts"]
]
}
def execute():
#rename table fieldnames
for dn in rename_map:
frappe.reload_doc(get_doctype_module(dn), "doctype", scrub(dn))
for dt, field_list in rename_map.items():
for field in field_list:
rename_field(dt, field[0], field[1])
# rename doctypes
tables = frappe.db.sql_list("show tables")
for old_dt, new_dt in [["Journal Voucher Detail", "Journal Entry Account"],
@ -238,6 +233,14 @@ def execute():
if "tab"+old_dt not in tables:
frappe.rename_doc("DocType", old_dt, new_dt, force=True)
#rename table fieldnames
for dn in rename_map:
frappe.reload_doc(get_doctype_module(dn), "doctype", scrub(dn))
for dt, field_list in rename_map.items():
for field in field_list:
rename_field(dt, field[0], field[1])
# update voucher type
for old, new in [["Bank Voucher", "Bank Entry"], ["Cash Voucher", "Cash Entry"],
["Credit Card Voucher", "Credit Card Entry"], ["Contra Voucher", "Contra Entry"],

View File

@ -67,7 +67,7 @@ def make_sales_invoice(source_name, target=None):
target_doc.description = "via Time Logs"
target = frappe.new_doc("Sales Invoice")
target.append("entries", get_mapped_doc("Time Log Batch", source_name, {
target.append("items", get_mapped_doc("Time Log Batch", source_name, {
"Time Log Batch": {
"doctype": "Sales Invoice Item",
"field_map": {

View File

@ -50,8 +50,8 @@ class TestSalesOrder(unittest.TestCase):
si = self.make_next_doc_testcase(so, "Sales Invoice")
self.assertEquals(si.doctype, "Sales Invoice")
self.assertEquals(len(si.get("entries")), len(so.get("items")))
self.assertEquals(len(si.get("entries")), 1)
self.assertEquals(len(si.get("items")), len(so.get("items")))
self.assertEquals(len(si.get("items")), 1)
si.set("debit_to", "_Test Receivable - _TC")
si.set("posting_date", "2013-10-10")
@ -59,7 +59,7 @@ class TestSalesOrder(unittest.TestCase):
si.submit()
si1 = self.make_next_doc_testcase(so, "Sales Invoice")
self.assertEquals(len(si1.get("entries")), 0)
self.assertEquals(len(si1.get("items")), 0)
def test_update_qty(self):
so = frappe.copy_doc(test_records[0]).insert()
@ -82,7 +82,7 @@ class TestSalesOrder(unittest.TestCase):
si1.set("debit_to", "_Test Receivable - _TC")
si1.set("posting_date", "2013-10-10")
si1.get("entries")[0].qty = 1
si1.get("items")[0].qty = 1
si1.insert()
si1.submit()
@ -96,7 +96,7 @@ class TestSalesOrder(unittest.TestCase):
si2.set("debit_to", "_Test Receivable - _TC")
si2.set("posting_date", "2013-10-10")
si2.set("update_stock", 1)
si2.get("entries")[0].qty = 3
si2.get("items")[0].qty = 3
si2.insert()
si2.submit()

View File

@ -312,7 +312,7 @@ def make_sales_invoice(source_name, target_doc=None):
target.ignore_pricing_rule = 1
target.run_method("set_missing_values")
if len(target.get("entries")) == 0:
if len(target.get("items")) == 0:
frappe.throw(_("All these items have already been invoiced"))
target.run_method("calculate_taxes_and_totals")

View File

@ -34,10 +34,10 @@ class TestDeliveryNote(unittest.TestCase):
dn.submit()
si = make_sales_invoice(dn.name)
self.assertEquals(len(si.get("entries")), len(dn.get("items")))
self.assertEquals(len(si.get("items")), len(dn.get("items")))
# modify amount
si.get("entries")[0].rate = 200
si.get("items")[0].rate = 200
self.assertRaises(frappe.ValidationError, frappe.get_doc(si).insert)

View File

@ -393,7 +393,7 @@ def make_purchase_invoice(source_name, target_doc=None):
invoiced_qty_map = get_invoiced_qty_map(source_name)
def set_missing_values(source, target):
if len(target.get("entries")) == 0:
if len(target.get("items")) == 0:
frappe.throw(_("All items have already been invoiced"))
doc = frappe.get_doc(target)

View File

@ -24,10 +24,10 @@ class TestPurchaseReceipt(unittest.TestCase):
pi = make_purchase_invoice(pr.name)
self.assertEquals(pi.doctype, "Purchase Invoice")
self.assertEquals(len(pi.get("entries")), len(pr.get("items")))
self.assertEquals(len(pi.get("items")), len(pr.get("items")))
# modify rate
pi.get("entries")[0].rate = 200
pi.get("items")[0].rate = 200
self.assertRaises(frappe.ValidationError, frappe.get_doc(pi).submit)
def test_purchase_receipt_no_gl_entry(self):

View File

@ -799,7 +799,7 @@ return_map = {
"Sales Return": {
# [Ref DocType, [Item tables' parentfields]]
"delivery_note_no": ["Delivery Note", ["items", "packed_items"]],
"sales_invoice_no": ["Sales Invoice", ["entries", "packed_items"]]
"sales_invoice_no": ["Sales Invoice", ["items", "packed_items"]]
},
"Purchase Return": {
"purchase_receipt_no": ["Purchase Receipt", ["items"]]
@ -832,7 +832,7 @@ def make_return_jv(stock_entry):
from erpnext.accounts.utils import get_balance_on
for r in result:
jv.append("entries", {
jv.append("accounts", {
"account": r.get("account"),
"party_type": r.get("party_type"),
"party": r.get("party"),

View File

@ -325,9 +325,9 @@ class TestStockEntry(unittest.TestCase):
# insert a pos invoice with update stock
si = frappe.copy_doc(sales_invoice_test_records[1])
si.update_stock = 1
si.get("entries")[0].warehouse = "_Test Warehouse - _TC"
si.get("entries")[0].item_code = item_code
si.get("entries")[0].qty = 5.0
si.get("items")[0].warehouse = "_Test Warehouse - _TC"
si.get("items")[0].item_code = item_code
si.get("items")[0].qty = 5.0
si.insert()
si.submit()
@ -401,7 +401,7 @@ class TestStockEntry(unittest.TestCase):
si = frappe.get_doc(si_doc)
si.posting_date = dn.posting_date
si.debit_to = "_Test Receivable - _TC"
for d in si.get("entries"):
for d in si.get("items"):
d.income_account = "Sales - _TC"
d.cost_center = "_Test Cost Center - _TC"
si.insert()
@ -435,14 +435,14 @@ class TestStockEntry(unittest.TestCase):
from erpnext.stock.doctype.stock_entry.stock_entry import make_return_jv
jv = make_return_jv(se.name)
self.assertEqual(len(jv.get("entries")), 2)
self.assertEqual(len(jv.get("accounts")), 2)
self.assertEqual(jv.get("voucher_type"), "Credit Note")
self.assertEqual(jv.get("posting_date"), se.posting_date)
self.assertEqual(jv.get("entries")[0].get("account"), "_Test Receivable - _TC")
self.assertEqual(jv.get("entries")[0].get("party_type"), "Customer")
self.assertEqual(jv.get("entries")[0].get("party"), "_Test Customer")
self.assertTrue(jv.get("entries")[0].get("against_invoice"))
self.assertEqual(jv.get("entries")[1].get("account"), "Sales - _TC")
self.assertEqual(jv.get("accounts")[0].get("account"), "_Test Receivable - _TC")
self.assertEqual(jv.get("accounts")[0].get("party_type"), "Customer")
self.assertEqual(jv.get("accounts")[0].get("party"), "_Test Customer")
self.assertTrue(jv.get("accounts")[0].get("against_invoice"))
self.assertEqual(jv.get("accounts")[1].get("account"), "Sales - _TC")
def test_make_return_jv_for_sales_invoice_non_packing_item(self):
self._clear_stock_account_balance()
@ -496,7 +496,7 @@ class TestStockEntry(unittest.TestCase):
si = make_sales_invoice(so.name)
si.posting_date = dn.posting_date
si.debit_to = "_Test Receivable - _TC"
for d in si.get("entries"):
for d in si.get("items"):
d.income_account = "Sales - _TC"
d.cost_center = "_Test Cost Center - _TC"
si.insert()
@ -542,7 +542,7 @@ class TestStockEntry(unittest.TestCase):
pi = frappe.get_doc(pi_doc)
pi.posting_date = pr.posting_date
pi.credit_to = "_Test Payable - _TC"
for d in pi.get("entries"):
for d in pi.get("items"):
d.expense_account = "_Test Account Cost for Goods Sold - _TC"
d.cost_center = "_Test Cost Center - _TC"
@ -595,13 +595,13 @@ class TestStockEntry(unittest.TestCase):
from erpnext.stock.doctype.stock_entry.stock_entry import make_return_jv
jv = make_return_jv(se.name)
self.assertEqual(len(jv.get("entries")), 2)
self.assertEqual(len(jv.get("accounts")), 2)
self.assertEqual(jv.get("voucher_type"), "Debit Note")
self.assertEqual(jv.get("posting_date"), se.posting_date)
self.assertEqual(jv.get("entries")[0].get("account"), "_Test Payable - _TC")
self.assertEqual(jv.get("entries")[0].get("party"), "_Test Supplier")
self.assertEqual(jv.get("entries")[1].get("account"), "_Test Account Cost for Goods Sold - _TC")
self.assertTrue(jv.get("entries")[0].get("against_voucher"))
self.assertEqual(jv.get("accounts")[0].get("account"), "_Test Payable - _TC")
self.assertEqual(jv.get("accounts")[0].get("party"), "_Test Supplier")
self.assertEqual(jv.get("accounts")[1].get("account"), "_Test Account Cost for Goods Sold - _TC")
self.assertTrue(jv.get("accounts")[0].get("against_voucher"))
def test_make_return_jv_for_purchase_receipt(self):
self._clear_stock_account_balance()
@ -646,7 +646,7 @@ class TestStockEntry(unittest.TestCase):
pi = frappe.get_doc(pi_doc)
pi.posting_date = pr.posting_date
pi.credit_to = "_Test Payable - _TC"
for d in pi.get("entries"):
for d in pi.get("items"):
d.expense_account = "_Test Account Cost for Goods Sold - _TC"
d.cost_center = "_Test Cost Center - _TC"
for d in pi.get("taxes"):