Table Field Renaming: code replace, JV and budget distribution renamed

This commit is contained in:
Nabin Hait 2014-12-25 16:01:55 +05:30
parent d8f4984d71
commit e7d153624f
222 changed files with 1523 additions and 1483 deletions

View File

@ -58,9 +58,9 @@
"permlevel": 0
},
{
"fieldname": "entries",
"fieldname": "journal_entries",
"fieldtype": "Table",
"label": "Entries",
"label": "Journal Entries",
"options": "Bank Reconciliation Detail",
"permlevel": 0
},
@ -85,7 +85,7 @@
"icon": "icon-check",
"idx": 1,
"issingle": 1,
"modified": "2014-05-27 03:37:21.783216",
"modified": "2014-12-25 13:16:16.711609",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Reconciliation",

View File

@ -21,7 +21,7 @@ class BankReconciliation(Document):
dl = frappe.db.sql("""select t1.name, t1.cheque_no, t1.cheque_date, t2.debit,
t2.credit, t1.posting_date, t2.against_account, t1.clearance_date
from
`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
`tabJournal Voucher` t1, `tabJournal Entry Account` t2
where
t2.parent = t1.name and t2.account = %s
and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,6 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
test_records = frappe.get_test_records('Budget Distribution')

View File

@ -1 +0,0 @@
Percent allocation for month for parent Budget Distribution.

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -5,7 +5,7 @@
// -----------------------------
frappe.require("assets/erpnext/js/utils.js");
cur_frm.fields_dict.invoice_details.grid.get_field("invoice_no").get_query = function(doc) {
cur_frm.fields_dict.invoices.grid.get_field("invoice_no").get_query = function(doc) {
return {
filters: {
"docstatus": 1,
@ -23,7 +23,7 @@ cur_frm.fields_dict.state.get_query = function(doc) {
cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return get_server_fields('get_invoice_details', d.invoice_no, 'invoice_details', doc, cdt, cdn, 1);
return get_server_fields('get_invoice_details', d.invoice_no, 'invoices', doc, cdt, cdn, 1);
}
cur_frm.cscript.company = function(doc, cdt, cdn) {

View File

@ -12,7 +12,7 @@ class CForm(Document):
"""Validate invoice that c-form is applicable
and no other c-form is received for that"""
for d in self.get('invoice_details'):
for d in self.get('invoices'):
if d.invoice_no:
inv = frappe.db.sql("""select c_form_applicable, c_form_no from
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
@ -42,7 +42,7 @@ class CForm(Document):
frappe.db.sql("""update `tabSales Invoice` set c_form_no=null where c_form_no=%s""", self.name)
def set_cform_in_sales_invoices(self):
inv = [d.invoice_no for d in self.get('invoice_details')]
inv = [d.invoice_no for d in self.get('invoices')]
if inv:
frappe.db.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s where name in (%s)""" %
('%s', '%s', ', '.join(['%s'] * len(inv))), tuple([self.name, self.modified] + inv))
@ -54,7 +54,7 @@ class CForm(Document):
frappe.throw(_("Please enter atleast 1 invoice in the table"))
def set_total_invoiced_amount(self):
total = sum([flt(d.grand_total) for d in self.get('invoice_details')])
total = sum([flt(d.grand_total) for d in self.get('invoices')])
frappe.db.set(self, 'total_invoiced_amount', total)
def get_invoice_details(self, invoice_no):

View File

@ -12,8 +12,8 @@ erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({
setup_queries: function() {
var me = this;
if(this.frm.fields_dict["budget_details"].grid.get_field("account")) {
this.frm.set_query("account", "budget_details", function() {
if(this.frm.fields_dict["budgets"].grid.get_field("account")) {
this.frm.set_query("account", "budgets", function() {
return {
filters:[
['Account', 'company', '=', me.frm.doc.company],

View File

@ -85,7 +85,7 @@
"label": "Distribution Id",
"oldfieldname": "distribution_id",
"oldfieldtype": "Link",
"options": "Budget Distribution",
"options": "Monthly Distribution",
"permlevel": 0
},
{
@ -145,7 +145,7 @@
"icon": "icon-money",
"idx": 1,
"in_create": 0,
"modified": "2014-12-24 15:18:16.937207",
"modified": "2014-12-25 15:35:09.968578",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Cost Center",

View File

@ -51,7 +51,7 @@ class CostCenter(NestedSet):
def validate_budget_details(self):
check_acc_list = []
for d in self.get('budget_details'):
for d in self.get('budgets'):
if self.group_or_ledger=="Group":
msgprint(_("Budget cannot be set for Group Cost Centers"), raise_exception=1)

View File

@ -1,12 +1,12 @@
[
{
"budget_details": [
"budgets": [
{
"account": "_Test Account Cost for Goods Sold - _TC",
"budget_allocated": 100000,
"doctype": "Budget Detail",
"fiscal_year": "_Test Fiscal Year 2013",
"parentfield": "budget_details"
"parentfield": "budgets"
}
],
"company": "_Test Company",

View File

@ -80,7 +80,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
setup_balance_formatter: function() {
var me = this;
$.each(["balance", "party_balance"], function(i, field) {
var df = frappe.meta.get_docfield("Journal Voucher Detail", field, me.frm.doc.name);
var df = frappe.meta.get_docfield("Journal Entry Account", field, me.frm.doc.name);
df.formatter = function(value, df, options, doc) {
var currency = frappe.meta.get_field_currency(df, doc);
var dr_or_cr = value ? ('<label>' + (value > 0.0 ? __("Dr") : __("Cr")) + '</label>') : "";
@ -227,9 +227,9 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
return;
var update_jv_details = function(doc, r) {
var jvdetail = frappe.model.add_child(doc, "Journal Voucher Detail", "entries");
var jvdetail = frappe.model.add_child(doc, "Journal Entry Account", "entries");
$.each(r, function(i, d) {
var row = frappe.model.add_child(doc, "Journal Voucher Detail", "entries");
var row = frappe.model.add_child(doc, "Journal Entry Account", "entries");
row.account = d.account;
row.balance = d.balance;
});
@ -268,7 +268,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
}
}
frappe.ui.form.on("Journal Voucher Detail", "party", function(frm, cdt, cdn) {
frappe.ui.form.on("Journal Entry Account", "party", function(frm, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn);
if(!d.account && d.party_type && d.party) {
return frm.call({

View File

@ -6,9 +6,9 @@
"doctype": "DocType",
"fields": [
{
"fieldname": "voucher_type_and_date",
"fieldname": "entry_type_and_date",
"fieldtype": "Section Break",
"label": "Voucher Type and Date",
"label": "Entry Type and Date",
"options": "icon-flag",
"permlevel": 0
},
@ -42,7 +42,7 @@
"label": "Voucher Type",
"oldfieldname": "voucher_type",
"oldfieldtype": "Select",
"options": "Journal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nOpening Entry",
"options": "Journal Entry\nBank Entry\nCash Entry\nCredit Card Entry\nDebit Note\nCredit Note\nContra Entry\nExcise Entry\nWrite Off Entry\nOpening Entry",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
@ -87,7 +87,7 @@
"label": "Entries",
"oldfieldname": "entries",
"oldfieldtype": "Table",
"options": "Journal Voucher Detail",
"options": "Journal Entry Account",
"permlevel": 0,
"print_hide": 0,
"read_only": 0
@ -307,7 +307,7 @@
},
{
"default": "Accounts Receivable",
"depends_on": "eval:doc.voucher_type == 'Write Off Voucher'",
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_based_on",
"fieldtype": "Select",
"label": "Write Off Based On",
@ -318,7 +318,7 @@
"report_hide": 1
},
{
"depends_on": "eval:doc.voucher_type == 'Write Off Voucher'",
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_amount",
"fieldtype": "Currency",
"label": "Write Off Amount <=",
@ -329,7 +329,7 @@
"report_hide": 1
},
{
"depends_on": "eval:doc.voucher_type == 'Write Off Voucher'",
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "get_outstanding_invoices",
"fieldtype": "Button",
"label": "Get Outstanding Invoices",
@ -439,7 +439,7 @@
"no_copy": 1,
"oldfieldname": "amended_from",
"oldfieldtype": "Link",
"options": "Journal Voucher",
"options": "Journal Entry",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
@ -448,10 +448,10 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2014-12-12 16:48:57.294150",
"modified": "2014-12-25 15:29:26.441984",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Voucher",
"name": "Journal Entry",
"owner": "Administrator",
"permissions": [
{

View File

@ -10,9 +10,9 @@ from erpnext.controllers.accounts_controller import AccountsController
from erpnext.accounts.utils import get_balance_on
class JournalVoucher(AccountsController):
class JournalEntry(AccountsController):
def __init__(self, arg1, arg2=None):
super(JournalVoucher, self).__init__(arg1, arg2)
super(JournalEntry, self).__init__(arg1, arg2)
def get_feed(self):
return self.voucher_type
@ -22,7 +22,7 @@ class JournalVoucher(AccountsController):
self.is_opening='No'
self.clearance_date = None
super(JournalVoucher, self).validate_date_with_fiscal_year()
super(JournalEntry, self).validate_date_with_fiscal_year()
self.validate_party()
self.validate_cheque_info()
self.validate_entries_for_advance()
@ -133,7 +133,7 @@ class JournalVoucher(AccountsController):
if d.against_jv == self.name:
frappe.throw(_("You can not enter current voucher in 'Against Journal Voucher' column"))
against_entries = frappe.db.sql("""select * from `tabJournal Voucher Detail`
against_entries = frappe.db.sql("""select * from `tabJournal Entry Account`
where account = %s and docstatus = 1 and parent = %s
and ifnull(against_jv, '') = '' and ifnull(against_invoice, '') = ''
and ifnull(against_voucher, '') = ''""", (d.account, d.against_jv), as_dict=True)
@ -423,18 +423,18 @@ class JournalVoucher(AccountsController):
return frappe.db.sql("""select name, credit_to as account, supplier as party, outstanding_amount
from `tabPurchase Invoice` where docstatus = 1 and company = %s
and outstanding_amount > 0 %s""" % ('%s', cond), self.company, as_dict=True)
def update_expense_claim(self):
for d in self.entries:
if d.against_expense_claim:
amt = frappe.db.sql("""select sum(debit) as amt from `tabJournal Voucher Detail`
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:
if d.against_expense_claim:
sanctioned_amount, reimbursed_amount = frappe.db.get_value("Expense Claim", d.against_expense_claim,
sanctioned_amount, reimbursed_amount = frappe.db.get_value("Expense Claim", d.against_expense_claim,
("total_sanctioned_amount", "total_amount_reimbursed"))
pending_amount = cint(sanctioned_amount) - cint(reimbursed_amount)
if d.debit > pending_amount:
@ -520,7 +520,7 @@ def get_opening_accounts(company):
def get_against_jv(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select jv.name, jv.posting_date, jv.user_remark
from `tabJournal Voucher` jv, `tabJournal Voucher Detail` jv_detail
from `tabJournal Voucher` jv, `tabJournal Entry Account` jv_detail
where jv_detail.parent = jv.name and jv_detail.account = %s and jv_detail.party = %s
and (ifnull(jvd.against_invoice, '') = '' and ifnull(jvd.against_voucher, '') = '' and ifnull(jvd.against_jv, '') = '' )
and jv.docstatus = 1 and jv.{0} like %s order by jv.name desc limit %s, %s""".format(searchfield),
@ -532,7 +532,7 @@ def get_outstanding(args):
if args.get("doctype") == "Journal Voucher" and args.get("party"):
against_jv_amount = frappe.db.sql("""
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
from `tabJournal Voucher Detail` where parent=%s and party=%s
from `tabJournal Entry Account` where parent=%s and party=%s
and ifnull(against_invoice, '')='' and ifnull(against_voucher, '')=''
and ifnull(against_jv, '')=''""", (args['docname'], args['party']))

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import unittest, frappe
from frappe.utils import flt
class TestJournalVoucher(unittest.TestCase):
class TestJournalEntry(unittest.TestCase):
def test_journal_voucher_with_against_jv(self):
jv_invoice = frappe.copy_doc(test_records[2])
@ -40,11 +40,11 @@ class TestJournalVoucher(unittest.TestCase):
test_voucher.submit()
if test_voucher.doctype == "Journal Voucher":
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where account = %s and docstatus = 1 and parent = %s""",
("_Test Receivable - _TC", test_voucher.name)))
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail`
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"
@ -54,10 +54,10 @@ class TestJournalVoucher(unittest.TestCase):
submitted_voucher = frappe.get_doc(test_voucher.doctype, test_voucher.name)
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where %s=%s""" % (field_dict.get(test_voucher.doctype), '%s'), (submitted_voucher.name)))
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
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":
@ -76,7 +76,7 @@ class TestJournalVoucher(unittest.TestCase):
if test_voucher.doctype == "Journal Voucher":
# if test_voucher is a Journal Voucher, test cancellation of test_voucher
test_voucher.cancel()
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Entry Account`
where against_jv=%s""", test_voucher.name))
elif test_voucher.doctype in ["Sales Order", "Purchase Order"]:

View File

@ -11,14 +11,14 @@
"party": "_Test Customer",
"credit": 400.0,
"debit": 0.0,
"doctype": "Journal Voucher Detail",
"doctype": "Journal Entry Account",
"parentfield": "entries"
},
{
"account": "_Test Account Bank Account - _TC",
"credit": 0.0,
"debit": 400.0,
"doctype": "Journal Voucher Detail",
"doctype": "Journal Entry Account",
"parentfield": "entries"
}
],
@ -40,14 +40,14 @@
"party": "_Test Supplier",
"credit": 0.0,
"debit": 400.0,
"doctype": "Journal Voucher Detail",
"doctype": "Journal Entry Account",
"parentfield": "entries"
},
{
"account": "_Test Account Bank Account - _TC",
"credit": 400.0,
"debit": 0.0,
"doctype": "Journal Voucher Detail",
"doctype": "Journal Entry Account",
"parentfield": "entries"
}
],
@ -69,7 +69,7 @@
"party": "_Test Customer",
"credit": 0.0,
"debit": 400.0,
"doctype": "Journal Voucher Detail",
"doctype": "Journal Entry Account",
"parentfield": "entries"
},
{
@ -77,7 +77,7 @@
"cost_center": "_Test Cost Center - _TC",
"credit": 400.0,
"debit": 0.0,
"doctype": "Journal Voucher Detail",
"doctype": "Journal Entry Account",
"parentfield": "entries"
}
],

View File

@ -149,7 +149,7 @@
"no_copy": 1,
"oldfieldname": "against_jv",
"oldfieldtype": "Link",
"options": "Journal Voucher",
"options": "Journal Entry",
"permlevel": 0,
"print_hide": 0,
"search_index": 1
@ -206,10 +206,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2014-12-08 19:32:47.996777",
"modified": "2014-12-25 15:44:03.077639",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Voucher Detail",
"name": "Journal Entry Account",
"owner": "Administrator",
"permissions": []
}

View File

@ -1,9 +1,9 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class BudgetDistributionDetail(Document):
pass
class JournalEntryAccount(Document):
pass

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -29,21 +29,21 @@
"search_index": 1
},
{
"fieldname": "budget_distribution_details",
"fieldname": "percentages",
"fieldtype": "Table",
"label": "Budget Distribution Details",
"label": "Monthly Distribution Percentages",
"oldfieldname": "budget_distribution_details",
"oldfieldtype": "Table",
"options": "Budget Distribution Detail",
"options": "Monthly Distribution Percentage",
"permlevel": 0
}
],
"icon": "icon-bar-chart",
"idx": 1,
"modified": "2014-05-09 02:16:47.567367",
"modified": "2014-12-25 15:45:04.729489",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Budget Distribution",
"name": "Monthly Distribution",
"name_case": "Title Case",
"owner": "Administrator",
"permissions": [

View File

@ -7,7 +7,7 @@ from frappe.utils import flt
from frappe import _
from frappe.model.document import Document
class BudgetDistribution(Document):
class MonthlyDistribution(Document):
def get_months(self):
month_list = ['January','February','March','April','May','June','July','August','September',
'October','November','December']

View File

@ -0,0 +1,10 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import frappe
import unittest
test_records = frappe.get_test_records('Monthly Distribution')
class TestMonthlyDistribution(unittest.TestCase):
pass

View File

@ -39,6 +39,6 @@
}, {
"month": "December",
"percentage_allocation": "10"
}
}
]
}]

View File

@ -1,6 +1,6 @@
{
"autoname": "BDD/.#####",
"creation": "2013-02-22 01:27:38.000000",
"creation": "2013-02-22 01:27:38",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -27,9 +27,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-20 19:22:59.000000",
"modified": "2014-12-25 15:45:11.173204",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Budget Distribution Detail",
"owner": "Administrator"
"name": "Monthly Distribution Percentage",
"owner": "Administrator",
"permissions": []
}

View File

@ -1,10 +1,9 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class JournalVoucherDetail(Document):
pass
class MonthlyDistributionPercentage(Document):
pass

View File

@ -72,7 +72,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
callback: function(r, rt) {
var invoices = [];
$.each(me.frm.doc.payment_reconciliation_invoices || [], function(i, row) {
$.each(me.frm.doc.invoices || [], function(i, row) {
if (row.invoice_number && !inList(invoices, row.invoice_number))
invoices.push(row.invoice_number);
});
@ -80,11 +80,11 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
frappe.meta.get_docfield("Payment Reconciliation Payment", "invoice_number",
me.frm.doc.name).options = invoices.join("\n");
$.each(me.frm.doc.payment_reconciliation_payments || [], function(i, p) {
$.each(me.frm.doc.payments || [], function(i, p) {
if(!inList(invoices, cstr(p.invoice_number))) p.invoice_number = null;
});
refresh_field("payment_reconciliation_payments");
refresh_field("payments");
}
});

View File

@ -29,7 +29,7 @@ class PaymentReconciliation(Document):
t1.name as voucher_no, t1.posting_date, t1.remark,
t2.name as voucher_detail_no, {dr_or_cr} as payment_amount, t2.is_advance
from
`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
`tabJournal Voucher` t1, `tabJournal Entry Account` t2
where
t1.name = t2.parent and t1.docstatus = 1 and t2.docstatus = 1
and t2.party_type = %(party_type)s and t2.party = %(party)s
@ -55,9 +55,9 @@ class PaymentReconciliation(Document):
self.add_payment_entries(jv_entries)
def add_payment_entries(self, jv_entries):
self.set('payment_reconciliation_payments', [])
self.set('payments', [])
for e in jv_entries:
ent = self.append('payment_reconciliation_payments', {})
ent = self.append('payments', {})
ent.journal_voucher = e.get('voucher_no')
ent.posting_date = e.get('posting_date')
ent.amount = flt(e.get('payment_amount'))
@ -66,7 +66,7 @@ class PaymentReconciliation(Document):
ent.is_advance = e.get('is_advance')
def get_invoice_entries(self):
#Fetch JVs, Sales and Purchase Invoices for 'payment_reconciliation_invoices' to reconcile against
#Fetch JVs, Sales and Purchase Invoices for 'invoices' to reconcile against
non_reconciled_invoices = []
dr_or_cr = "debit" if self.party_type == "Customer" else "credit"
cond = self.check_condition(dr_or_cr)
@ -123,11 +123,11 @@ class PaymentReconciliation(Document):
self.add_invoice_entries(non_reconciled_invoices)
def add_invoice_entries(self, non_reconciled_invoices):
#Populate 'payment_reconciliation_invoices' with JVs and Invoices to reconcile against
self.set('payment_reconciliation_invoices', [])
#Populate 'invoices' with JVs and Invoices to reconcile against
self.set('invoices', [])
for e in non_reconciled_invoices:
ent = self.append('payment_reconciliation_invoices', {})
ent = self.append('invoices', {})
ent.invoice_type = e.get('voucher_type')
ent.invoice_number = e.get('voucher_no')
ent.invoice_date = e.get('posting_date')
@ -139,7 +139,7 @@ class PaymentReconciliation(Document):
self.validate_invoice()
dr_or_cr = "credit" if self.party_type == "Customer" else "debit"
lst = []
for e in self.get('payment_reconciliation_payments'):
for e in self.get('payments'):
if e.invoice_type and e.invoice_number and e.allocated_amount:
lst.append({
'voucher_no' : e.journal_voucher,
@ -168,18 +168,18 @@ class PaymentReconciliation(Document):
def validate_invoice(self):
if not self.get("payment_reconciliation_invoices"):
if not self.get("invoices"):
frappe.throw(_("No records found in the Invoice table"))
if not self.get("payment_reconciliation_payments"):
if not self.get("payments"):
frappe.throw(_("No records found in the Payment table"))
unreconciled_invoices = frappe._dict()
for d in self.get("payment_reconciliation_invoices"):
for d in self.get("invoices"):
unreconciled_invoices.setdefault(d.invoice_type, {}).setdefault(d.invoice_number, d.outstanding_amount)
invoices_to_reconcile = []
for p in self.get("payment_reconciliation_payments"):
for p in self.get("payments"):
if p.invoice_type and p.invoice_number and p.allocated_amount:
invoices_to_reconcile.append(p.invoice_number)

View File

@ -24,7 +24,7 @@ frappe.ui.form.on("Payment Tool", "onload", function(frm) {
}
});
frm.set_query("against_voucher_type", "payment_tool_details", function() {
frm.set_query("against_voucher_type", "against_vouchers", function() {
return {
filters: {"name": ["in", ["Sales Invoice", "Purchase Invoice", "Journal Voucher", "Sales Order", "Purchase Order"]]}
};
@ -75,7 +75,7 @@ erpnext.payment_tool.check_mandatory_to_set_button = function(frm) {
frappe.ui.form.on("Payment Tool", "get_outstanding_vouchers", function(frm) {
erpnext.payment_tool.check_mandatory_to_fetch(frm.doc);
frm.set_value("payment_tool_details", []);
frm.set_value("against_vouchers", []);
return frappe.call({
method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_outstanding_vouchers',
@ -93,16 +93,16 @@ frappe.ui.form.on("Payment Tool", "get_outstanding_vouchers", function(frm) {
frm.fields_dict.get_outstanding_vouchers.$input.removeClass("btn-primary");
frm.fields_dict.make_journal_voucher.$input.addClass("btn-primary");
frappe.model.clear_table(frm.doc, "payment_tool_details");
frappe.model.clear_table(frm.doc, "against_vouchers");
$.each(r.message, function(i, d) {
var invoice_detail = frappe.model.add_child(frm.doc, "Payment Tool Detail", "payment_tool_details");
var invoice_detail = frappe.model.add_child(frm.doc, "Payment Tool Detail", "against_vouchers");
invoice_detail.against_voucher_type = d.voucher_type;
invoice_detail.against_voucher_no = d.voucher_no;
invoice_detail.total_amount = d.invoice_amount;
invoice_detail.outstanding_amount = d.outstanding_amount;
});
}
refresh_field("payment_tool_details");
refresh_field("against_vouchers");
erpnext.payment_tool.set_total_payment_amount(frm);
}
});
@ -114,7 +114,7 @@ frappe.ui.form.on("Payment Tool Detail", "against_voucher_type", function(frm) {
});
erpnext.payment_tool.validate_against_voucher = function(frm) {
$.each(frm.doc.payment_tool_details || [], function(i, row) {
$.each(frm.doc.against_vouchers || [], function(i, row) {
if(frm.doc.party_type=="Customer"
&& !in_list(["Sales Order", "Sales Invoice", "Journal Voucher"], row.against_voucher_type)) {
frappe.model.set_value(row.doctype, row.name, "against_voucher_type", "");
@ -154,13 +154,13 @@ frappe.ui.form.on("Payment Tool Detail", "payment_amount", function(frm) {
erpnext.payment_tool.set_total_payment_amount(frm);
});
frappe.ui.form.on("Payment Tool Detail", "payment_tool_details_remove", function(frm) {
frappe.ui.form.on("Payment Tool Detail", "against_vouchers_remove", function(frm) {
erpnext.payment_tool.set_total_payment_amount(frm);
});
erpnext.payment_tool.set_total_payment_amount = function(frm) {
var total_amount = 0.00;
$.each(frm.doc.payment_tool_details || [], function(i, row) {
$.each(frm.doc.against_vouchers || [], function(i, row) {
if (row.payment_amount && (row.payment_amount <= row.outstanding_amount)) {
total_amount = total_amount + row.payment_amount;
} else {

View File

@ -29,7 +29,7 @@ class PaymentTool(Document):
if not self.total_payment_amount:
frappe.throw(_("Please enter Payment Amount in atleast one row"))
for v in self.get("payment_tool_details"):
for v in self.get("against_vouchers"):
if not frappe.db.get_value(v.against_voucher_type, {"name": v.against_voucher_no}):
frappe.throw(_("Row {0}: {1} is not a valid {2}").format(v.idx, v.against_voucher_no,
v.against_voucher_type))

View File

@ -154,7 +154,7 @@ class TestPaymentTool(unittest.TestCase):
def check_jv_entries(self, paytool, outstanding_entries, expected_outstanding):
for e in outstanding_entries:
d1 = paytool.append("payment_tool_details")
d1 = paytool.append("against_vouchers")
d1.against_voucher_type = e.get("voucher_type")
d1.against_voucher_no = e.get("voucher_no")
d1.total_amount = e.get("invoice_amount")

View File

@ -2,8 +2,8 @@
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.tname = "Purchase Invoice Item";
cur_frm.cscript.fname = "entries";
cur_frm.cscript.other_fname = "other_charges";
cur_frm.cscript.fname = "items";
cur_frm.cscript.other_fname = "taxes";
frappe.provide("erpnext.accounts");
{% include 'buying/doctype/purchase_common/purchase_common.js' %};
@ -99,7 +99,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
},
allocated_amount: function() {
this.calculate_total_advance("Purchase Invoice", "advance_allocation_details");
this.calculate_total_advance("Purchase Invoice", "advances");
this.frm.refresh_fields();
},
@ -109,12 +109,12 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
entries_add: function(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
this.frm.script_manager.copy_from_first_row("entries", row,
this.frm.script_manager.copy_from_first_row("items", row,
["expense_account", "cost_center", "project_name"]);
},
on_submit: function() {
$.each(this.frm.doc["entries"], function(i, row) {
$.each(this.frm.doc["items"], function(i, row) {
if(row.purchase_receipt) frappe.model.clear_doc("Purchase Receipt", row.purchase_receipt)
})
}
@ -153,7 +153,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
}
}
cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
cur_frm.fields_dict['items'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
return {
query: "erpnext.controllers.queries.item_query",
filters:{
@ -182,7 +182,7 @@ return{
}
}
cur_frm.set_query("expense_account", "entries", function(doc) {
cur_frm.set_query("expense_account", "items", function(doc) {
return{
query: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.get_expense_account",
filters: {'company': doc.company}
@ -192,15 +192,15 @@ cur_frm.set_query("expense_account", "entries", function(doc) {
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
if(d.idx == 1 && d.expense_account){
var cl = doc.entries || [];
var cl = doc.items || [];
for(var i = 0; i < cl.length; i++){
if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
}
}
refresh_field('entries');
refresh_field('items');
}
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(doc) {
return {
filters: {
'company': doc.company,
@ -213,15 +213,15 @@ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = functio
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
if(d.idx == 1 && d.cost_center){
var cl = doc.entries || [];
var cl = doc.items || [];
for(var i = 0; i < cl.length; i++){
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
}
}
refresh_field('entries');
refresh_field('items');
}
cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
cur_frm.fields_dict['items'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return{
filters:[
['Project', 'status', 'not in', 'Completed, Cancelled']

View File

@ -45,8 +45,8 @@ class PurchaseInvoice(BuyingController):
self.check_active_purchase_items()
self.check_conversion_rate()
self.validate_credit_to_acc()
self.clear_unallocated_advances("Purchase Invoice Advance", "advance_allocation_details")
self.validate_advance_jv("advance_allocation_details", "purchase_order")
self.clear_unallocated_advances("Purchase Invoice Advance", "advances")
self.validate_advance_jv("advances", "purchase_order")
self.check_for_stopped_status()
self.validate_with_previous_doc()
self.validate_uom_is_integer("uom", "qty")
@ -55,7 +55,7 @@ class PurchaseInvoice(BuyingController):
self.validate_write_off_account()
self.update_valuation_rate("entries")
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount",
"purchase_receipt_details")
"items")
self.create_remarks()
def create_remarks(self):
@ -75,7 +75,7 @@ class PurchaseInvoice(BuyingController):
def get_advances(self):
super(PurchaseInvoice, self).get_advances(self.credit_to, "Supplier", self.supplier,
"Purchase Invoice Advance", "advance_allocation_details", "debit", "purchase_order")
"Purchase Invoice Advance", "advances", "debit", "purchase_order")
def check_active_purchase_items(self):
for d in self.get('entries'):
@ -216,7 +216,7 @@ class PurchaseInvoice(BuyingController):
"""
lst = []
for d in self.get('advance_allocation_details'):
for d in self.get('advances'):
if flt(d.allocated_amount) > 0:
args = {
'voucher_no' : d.journal_voucher,
@ -277,7 +277,7 @@ class PurchaseInvoice(BuyingController):
# tax table gl entries
valuation_tax = {}
for tax in self.get("other_charges"):
for tax in self.get("taxes"):
if tax.category in ("Total", "Valuation and Total") and flt(tax.tax_amount):
gl_entries.append(
self.get_gl_dict({

View File

@ -109,8 +109,8 @@ class TestPurchaseInvoice(unittest.TestCase):
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("other_charges").pop(0)
pi.get("other_charges").pop(1)
pi.get("taxes").pop(0)
pi.get("taxes").pop(1)
pi.insert()
pi.submit()
@ -159,7 +159,7 @@ class TestPurchaseInvoice(unittest.TestCase):
["_Test Account Discount - _TC", 168.03, 1512.30],
]
for i, tax in enumerate(wrapper.get("other_charges")):
for i, tax in enumerate(wrapper.get("taxes")):
self.assertEqual(tax.account_head, expected_values[i][0])
self.assertEqual(tax.tax_amount, expected_values[i][1])
self.assertEqual(tax.total, expected_values[i][2])
@ -193,7 +193,7 @@ class TestPurchaseInvoice(unittest.TestCase):
["_Test Account Discount - _TC", 168.03, 1512.30],
]
for i, tax in enumerate(wrapper.get("other_charges")):
for i, tax in enumerate(wrapper.get("taxes")):
self.assertEqual(tax.account_head, expected_values[i][0])
self.assertEqual(tax.tax_amount, expected_values[i][1])
self.assertEqual(tax.total, expected_values[i][2])
@ -207,7 +207,7 @@ class TestPurchaseInvoice(unittest.TestCase):
jv.submit()
pi = frappe.copy_doc(test_records[0])
pi.append("advance_allocation_details", {
pi.append("advances", {
"journal_voucher": jv.name,
"jv_detail_no": jv.get("entries")[0].name,
"advance_amount": 400,
@ -218,17 +218,17 @@ class TestPurchaseInvoice(unittest.TestCase):
pi.submit()
pi.load_from_db()
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where against_voucher=%s""", pi.name))
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where against_voucher=%s and debit=300""", pi.name))
self.assertEqual(pi.outstanding_amount, 1212.30)
pi.cancel()
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Entry Account`
where against_voucher=%s""", pi.name))
def test_recurring_invoice(self):

View File

@ -7,7 +7,7 @@
"credit_to": "_Test Payable - _TC",
"currency": "INR",
"doctype": "Purchase Invoice",
"entries": [
"items": [
{
"amount": 500,
"base_amount": 500,
@ -19,7 +19,7 @@
"item_code": "_Test Item Home Desktop 100",
"item_name": "_Test Item Home Desktop 100",
"item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}",
"parentfield": "entries",
"parentfield": "items",
"qty": 10,
"rate": 50,
"uom": "_Test UOM"
@ -34,7 +34,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item Home Desktop 200",
"item_name": "_Test Item Home Desktop 200",
"parentfield": "entries",
"parentfield": "items",
"qty": 5,
"rate": 150,
"uom": "_Test UOM"
@ -43,7 +43,7 @@
"fiscal_year": "_Test Fiscal Year 2013",
"grand_total_import": 0,
"naming_series": "_T-BILL",
"other_charges": [
"taxes": [
{
"account_head": "_Test Account Shipping Charges - _TC",
"add_deduct_tax": "Add",
@ -52,7 +52,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Shipping Charges",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 100
},
{
@ -63,7 +63,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Customs Duty",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 10
},
{
@ -74,7 +74,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Excise Duty",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12
},
{
@ -85,7 +85,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Education Cess",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 2,
"row_id": 3
},
@ -97,7 +97,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "S&H Education Cess",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 1,
"row_id": 3
},
@ -109,7 +109,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "CST",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 2,
"row_id": 5
},
@ -121,7 +121,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "VAT",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12.5
},
{
@ -132,7 +132,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Discount",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 10,
"row_id": 7
}
@ -149,7 +149,7 @@
"credit_to": "_Test Payable - _TC",
"currency": "INR",
"doctype": "Purchase Invoice",
"entries": [
"items": [
{
"conversion_factor": 1.0,
"cost_center": "_Test Cost Center - _TC",
@ -157,7 +157,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item",
"item_name": "_Test Item",
"parentfield": "entries",
"parentfield": "items",
"qty": 10.0,
"rate": 50.0,
"uom": "_Test UOM"
@ -166,7 +166,7 @@
"fiscal_year": "_Test Fiscal Year 2013",
"grand_total_import": 0,
"naming_series": "_T-Purchase Invoice-",
"other_charges": [
"taxes": [
{
"account_head": "_Test Account Shipping Charges - _TC",
"add_deduct_tax": "Add",
@ -175,7 +175,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Shipping Charges",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 100.0
},
{
@ -186,7 +186,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "VAT",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 120.0
},
{
@ -197,7 +197,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Customs Duty",
"doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 150.0
}
],

View File

@ -20,7 +20,7 @@ cur_frm.pformat.in_words_import = function(doc) {
return '';
}
cur_frm.pformat.other_charges= function(doc) {
cur_frm.pformat.taxes= function(doc) {
//function to make row of table
var make_row = function(title, val, bold) {
@ -41,7 +41,7 @@ cur_frm.pformat.other_charges= function(doc) {
return doc_field.print_hide;
}
var cl = doc.other_charges || [];
var cl = doc.taxes || [];
// outer table
var out='<div><table class="noborder" style="width:100%">\
@ -104,7 +104,7 @@ cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
}
validated = false;
refresh_field('charge_type', d.name, 'other_charges');
refresh_field('charge_type', d.name, 'taxes');
cur_frm.cscript.row_id(doc, cdt, cdn);
cur_frm.cscript.rate(doc, cdt, cdn);
@ -130,10 +130,10 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) {
}
}
validated = false;
refresh_field('row_id', d.name, 'other_charges');
refresh_field('row_id', d.name, 'taxes');
}
cur_frm.set_query("account_head", "other_charges", function(doc) {
cur_frm.set_query("account_head", "taxes", function(doc) {
return {
query: "erpnext.controllers.queries.tax_account_query",
filters: {
@ -143,7 +143,7 @@ cur_frm.set_query("account_head", "other_charges", function(doc) {
}
});
cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) {
cur_frm.fields_dict['taxes'].grid.get_field("cost_center").get_query = function(doc) {
return {
filters: {
'company': doc.company,
@ -160,7 +160,7 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
d.rate = '';
}
validated = false;
refresh_field('rate', d.name, 'other_charges');
refresh_field('rate', d.name, 'taxes');
}
cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
@ -176,5 +176,5 @@ cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
}
validated = false;
refresh_field('tax_amount', d.name, 'other_charges');
refresh_field('tax_amount', d.name, 'taxes');
}

View File

@ -60,7 +60,7 @@
"precision": ""
},
{
"fieldname": "other_charges",
"fieldname": "taxes",
"fieldtype": "Table",
"label": "Purchase Taxes and Charges",
"oldfieldname": "purchase_tax_details",
@ -71,7 +71,7 @@
],
"icon": "icon-money",
"idx": 1,
"modified": "2014-10-07 12:40:17.165882",
"modified": "2014-12-24 17:19:29.921875",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Taxes and Charges Master",

View File

@ -0,0 +1,10 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import frappe
import unittest
test_records = frappe.get_test_records('Purchase Taxes and Charges Master')
class TestPurchaseTaxesandChargesMaster(unittest.TestCase):
pass

View File

@ -0,0 +1,6 @@
[
{
"doctype": "Purchase Taxes and Charges Master",
"name": "_Test Purchase Taxes and Charges Master 1"
}
]

View File

@ -2,8 +2,8 @@
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.tname = "Sales Invoice Item";
cur_frm.cscript.fname = "entries";
cur_frm.cscript.other_fname = "other_charges";
cur_frm.cscript.fname = "items";
cur_frm.cscript.other_fname = "taxes";
cur_frm.cscript.sales_team_fname = "sales_team";
// print heading
@ -68,7 +68,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
if(cint(doc.update_stock)!=1) {
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
var from_delivery_note = false;
from_delivery_note = cur_frm.doc.entries
from_delivery_note = cur_frm.doc.items
.some(function(item) {
return item.delivery_note ? true : false;
});
@ -173,7 +173,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
},
allocated_amount: function() {
this.calculate_total_advance("Sales Invoice", "advance_adjustment_details");
this.calculate_total_advance("Sales Invoice", "advances");
this.frm.refresh_fields();
},
@ -201,7 +201,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
entries_add: function(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
this.frm.script_manager.copy_from_first_row("entries", row, ["income_account", "cost_center"]);
this.frm.script_manager.copy_from_first_row("items", row, ["income_account", "cost_center"]);
},
set_dynamic_labels: function() {
@ -223,7 +223,7 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_
cur_frm.cscript.hide_fields = function(doc) {
par_flds = ['project_name', 'due_date', 'is_opening', 'source', 'total_advance', 'gross_profit',
'gross_profit_percent', 'get_advances_received',
'advance_adjustment_details', 'sales_partner', 'commission_rate',
'advances', 'sales_partner', 'commission_rate',
'total_commission', 'advances', 'from_date', 'to_date'];
item_flds_normal = ['sales_order', 'delivery_note']
@ -231,18 +231,18 @@ cur_frm.cscript.hide_fields = function(doc) {
if(cint(doc.is_pos) == 1) {
hide_field(par_flds);
unhide_field('payments_section');
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, false);
cur_frm.fields_dict['items'].grid.set_column_disp(item_flds_normal, false);
} else {
hide_field('payments_section');
for (i in par_flds) {
var docfield = frappe.meta.docfield_map[doc.doctype][par_flds[i]];
if(!docfield.hidden) unhide_field(par_flds[i]);
}
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, true);
cur_frm.fields_dict['items'].grid.set_column_disp(item_flds_normal, true);
}
item_flds_stock = ['serial_no', 'batch_no', 'actual_qty', 'expense_account', 'warehouse']
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_stock,
cur_frm.fields_dict['items'].grid.set_column_disp(item_flds_stock,
(cint(doc.update_stock)==1 ? true : false));
// India related fields
@ -342,7 +342,7 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
// Income Account in Details Table
// --------------------------------
cur_frm.set_query("income_account", "entries", function(doc) {
cur_frm.set_query("income_account", "items", function(doc) {
return{
query: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_income_account",
filters: {'company': doc.company}
@ -351,7 +351,7 @@ cur_frm.set_query("income_account", "entries", function(doc) {
// expense account
if (sys_defaults.auto_accounting_for_stock) {
cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
cur_frm.fields_dict['items'].grid.get_field('expense_account').get_query = function(doc) {
return {
filters: {
'report_type': 'Profit and Loss',
@ -365,7 +365,7 @@ if (sys_defaults.auto_accounting_for_stock) {
// Cost Center in Details Table
// -----------------------------
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(doc) {
return {
filters: {
'company': doc.company,
@ -387,7 +387,7 @@ cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
$.each(doc["entries"], function(i, row) {
$.each(doc["items"], function(i, row) {
if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note)
})

View File

@ -48,8 +48,8 @@ class SalesInvoice(SellingController):
self.check_stop_sales_order("sales_order")
self.validate_debit_to_acc()
self.validate_fixed_asset_account()
self.clear_unallocated_advances("Sales Invoice Advance", "advance_adjustment_details")
self.validate_advance_jv("advance_adjustment_details", "sales_order")
self.clear_unallocated_advances("Sales Invoice Advance", "advances")
self.validate_advance_jv("advances", "sales_order")
self.add_remarks()
if cint(self.is_pos):
@ -69,7 +69,7 @@ class SalesInvoice(SellingController):
self.validate_c_form()
self.validate_time_logs_are_submitted()
self.validate_multiple_billing("Delivery Note", "dn_detail", "amount",
"delivery_note_details")
"items")
def on_submit(self):
super(SalesInvoice, self).on_submit()
@ -200,12 +200,12 @@ class SalesInvoice(SellingController):
self.terms = frappe.db.get_value("Terms and Conditions", self.tc_name, "terms")
# fetch charges
if self.taxes_and_charges and not len(self.get("other_charges")):
self.set_taxes("other_charges", "taxes_and_charges")
if self.taxes_and_charges and not len(self.get("taxes")):
self.set_taxes("taxes", "taxes_and_charges")
def get_advances(self):
super(SalesInvoice, self).get_advances(self.debit_to, "Customer", self.customer,
"Sales Invoice Advance", "advance_adjustment_details", "credit", "sales_order")
"Sales Invoice Advance", "advances", "credit", "sales_order")
def get_company_abbr(self):
return frappe.db.sql("select abbr from tabCompany where name=%s", self.company)[0][0]
@ -219,7 +219,7 @@ class SalesInvoice(SellingController):
"""
lst = []
for d in self.get('advance_adjustment_details'):
for d in self.get('advances'):
if flt(d.allocated_amount) > 0:
args = {
'voucher_no' : d.journal_voucher,
@ -371,7 +371,7 @@ class SalesInvoice(SellingController):
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
for d in self.get('packing_details'):
for d in self.get('packed_items'):
bin = frappe.db.sql("select actual_qty, projected_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
d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
@ -406,7 +406,7 @@ class SalesInvoice(SellingController):
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
make_packing_list(self, 'entries')
else:
self.set('packing_details', [])
self.set('packed_items', [])
if cint(self.is_pos) == 1:
if flt(self.paid_amount) == 0:
@ -500,7 +500,7 @@ class SalesInvoice(SellingController):
)
def make_tax_gl_entries(self, gl_entries):
for tax in self.get("other_charges"):
for tax in self.get("taxes"):
if flt(tax.tax_amount_after_discount_amount):
gl_entries.append(
self.get_gl_dict({

View File

@ -8,7 +8,7 @@
"debit_to": "_Test Receivable - _TC",
"doctype": "Sales Invoice",
"due_date": "2013-01-23",
"entries": [
"items": [
{
"amount": 500.0,
"base_amount": 500.0,
@ -19,7 +19,7 @@
"income_account": "Sales - _TC",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_name": "138-CMS Shoe",
"parentfield": "entries",
"parentfield": "items",
"qty": 1.0,
"rate": 500.0
}
@ -30,13 +30,13 @@
"is_pos": 0,
"naming_series": "_T-Sales Invoice-",
"net_total": 500.0,
"other_charges": [
"taxes": [
{
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 6
},
{
@ -44,7 +44,7 @@
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 6.36
}
],
@ -77,7 +77,7 @@
"debit_to": "_Test Receivable - _TC",
"doctype": "Sales Invoice",
"due_date": "2013-03-07",
"entries": [
"items": [
{
"amount": 500.0,
"base_amount": 500.0,
@ -89,7 +89,7 @@
"income_account": "Sales - _TC",
"item_code": "_Test Item",
"item_name": "_Test Item",
"parentfield": "entries",
"parentfield": "items",
"price_list_rate": 500.0,
"qty": 1.0
}
@ -100,13 +100,13 @@
"is_pos": 0,
"naming_series": "_T-Sales Invoice-",
"net_total": 500.0,
"other_charges": [
"taxes": [
{
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 16
},
{
@ -114,7 +114,7 @@
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 10
}
],
@ -133,7 +133,7 @@
"debit_to": "_Test Receivable - _TC",
"doctype": "Sales Invoice",
"due_date": "2013-01-23",
"entries": [
"items": [
{
"cost_center": "_Test Cost Center - _TC",
"doctype": "Sales Invoice Item",
@ -142,7 +142,7 @@
"item_code": "_Test Item Home Desktop 100",
"item_name": "_Test Item Home Desktop 100",
"item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}",
"parentfield": "entries",
"parentfield": "items",
"price_list_rate": 50,
"qty": 10,
"rate": 50,
@ -155,7 +155,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item Home Desktop 200",
"item_name": "_Test Item Home Desktop 200",
"parentfield": "entries",
"parentfield": "items",
"price_list_rate": 150,
"qty": 5,
"rate": 150,
@ -166,14 +166,14 @@
"grand_total_export": 0,
"is_pos": 0,
"naming_series": "_T-Sales Invoice-",
"other_charges": [
"taxes": [
{
"account_head": "_Test Account Shipping Charges - _TC",
"charge_type": "Actual",
"cost_center": "_Test Cost Center - _TC",
"description": "Shipping Charges",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 100
},
{
@ -182,7 +182,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Customs Duty",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 10
},
{
@ -191,7 +191,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Excise Duty",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12
},
{
@ -200,7 +200,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Education Cess",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 2,
"row_id": 3
},
@ -210,7 +210,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "S&H Education Cess",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 1,
"row_id": 3
},
@ -220,7 +220,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "CST",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 2,
"row_id": 5
},
@ -230,7 +230,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12.5
},
{
@ -239,7 +239,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Discount",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": -10,
"row_id": 7
}
@ -259,7 +259,7 @@
"debit_to": "_Test Receivable - _TC",
"doctype": "Sales Invoice",
"due_date": "2013-01-23",
"entries": [
"items": [
{
"cost_center": "_Test Cost Center - _TC",
"doctype": "Sales Invoice Item",
@ -268,7 +268,7 @@
"item_code": "_Test Item Home Desktop 100",
"item_name": "_Test Item Home Desktop 100",
"item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}",
"parentfield": "entries",
"parentfield": "items",
"price_list_rate": 62.5,
"qty": 10,
"stock_uom": "_Test UOM"
@ -280,7 +280,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item Home Desktop 200",
"item_name": "_Test Item Home Desktop 200",
"parentfield": "entries",
"parentfield": "items",
"price_list_rate": 190.66,
"qty": 5,
"stock_uom": "_Test UOM"
@ -290,7 +290,7 @@
"grand_total_export": 0,
"is_pos": 0,
"naming_series": "_T-Sales Invoice-",
"other_charges": [
"taxes": [
{
"account_head": "_Test Account Excise Duty - _TC",
"charge_type": "On Net Total",
@ -299,7 +299,7 @@
"doctype": "Sales Taxes and Charges",
"idx": 1,
"included_in_print_rate": 1,
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12
},
{
@ -310,7 +310,7 @@
"doctype": "Sales Taxes and Charges",
"idx": 2,
"included_in_print_rate": 1,
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 2,
"row_id": 1
},
@ -322,7 +322,7 @@
"doctype": "Sales Taxes and Charges",
"idx": 3,
"included_in_print_rate": 1,
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 1,
"row_id": 1
},
@ -334,7 +334,7 @@
"doctype": "Sales Taxes and Charges",
"idx": 4,
"included_in_print_rate": 1,
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 2,
"row_id": 3
},
@ -346,7 +346,7 @@
"doctype": "Sales Taxes and Charges",
"idx": 5,
"included_in_print_rate": 1,
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12.5
},
{
@ -356,7 +356,7 @@
"description": "Customs Duty",
"doctype": "Sales Taxes and Charges",
"idx": 6,
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 10
},
{
@ -366,7 +366,7 @@
"description": "Shipping Charges",
"doctype": "Sales Taxes and Charges",
"idx": 7,
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 100
},
{
@ -376,7 +376,7 @@
"description": "Discount",
"doctype": "Sales Taxes and Charges",
"idx": 8,
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": -10,
"row_id": 7
}

View File

@ -69,7 +69,7 @@ class TestSalesInvoice(unittest.TestCase):
"_Test Account Discount - _TC": [-180.78, 1627.05]
}
for d in si.get("other_charges"):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
@ -119,7 +119,7 @@ class TestSalesInvoice(unittest.TestCase):
"_Test Account Discount - _TC": [-180.78, 1627.05]
}
for d in si.get("other_charges"):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
@ -129,7 +129,7 @@ class TestSalesInvoice(unittest.TestCase):
def test_sales_invoice_discount_amount(self):
si = frappe.copy_doc(test_records[3])
si.discount_amount = 104.95
si.append("other_charges", {
si.append("taxes", {
"doctype": "Sales Taxes and Charges",
"charge_type": "On Previous Row Amount",
"account_head": "_Test Account Service Tax - _TC",
@ -174,7 +174,7 @@ class TestSalesInvoice(unittest.TestCase):
"_Test Account Service Tax - _TC": [-18.03, -16.88, 1500]
}
for d in si.get("other_charges"):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
@ -184,7 +184,7 @@ class TestSalesInvoice(unittest.TestCase):
def test_discount_amount_gl_entry(self):
si = frappe.copy_doc(test_records[3])
si.discount_amount = 104.95
si.append("other_charges", {
si.append("taxes", {
"doctype": "Sales Taxes and Charges",
"charge_type": "On Previous Row Amount",
"account_head": "_Test Account Service Tax - _TC",
@ -205,14 +205,14 @@ 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]["other_charges"][0]["account_head"], 0.0, 130.31],
[test_records[3]["other_charges"][1]["account_head"], 0.0, 2.61],
[test_records[3]["other_charges"][2]["account_head"], 0.0, 1.31],
[test_records[3]["other_charges"][3]["account_head"], 0.0, 25.96],
[test_records[3]["other_charges"][4]["account_head"], 0.0, 145.43],
[test_records[3]["other_charges"][5]["account_head"], 0.0, 116.35],
[test_records[3]["other_charges"][6]["account_head"], 0.0, 100],
[test_records[3]["other_charges"][7]["account_head"], 168.54, 0.0],
[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],
[test_records[3]["taxes"][3]["account_head"], 0.0, 25.96],
[test_records[3]["taxes"][4]["account_head"], 0.0, 145.43],
[test_records[3]["taxes"][5]["account_head"], 0.0, 116.35],
[test_records[3]["taxes"][6]["account_head"], 0.0, 100],
[test_records[3]["taxes"][7]["account_head"], 168.54, 0.0],
["_Test Account Service Tax - _TC", 16.88, 0.0],
])
@ -231,19 +231,19 @@ class TestSalesInvoice(unittest.TestCase):
def test_inclusive_rate_validations(self):
si = frappe.copy_doc(test_records[2])
for i, tax in enumerate(si.get("other_charges")):
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
for i in xrange(6):
si.get("other_charges")[i].included_in_print_rate = 1
si.get("taxes")[i].included_in_print_rate = 1
# tax type "Actual" cannot be inclusive
self.assertRaises(frappe.ValidationError, si.insert)
# taxes above included type 'On Previous Row Total' should also be included
si.get("other_charges")[0].included_in_print_rate = 0
si.get("taxes")[0].included_in_print_rate = 0
self.assertRaises(frappe.ValidationError, si.insert)
def test_sales_invoice_calculation_base_currency_with_tax_inclusive_price(self):
@ -284,7 +284,7 @@ class TestSalesInvoice(unittest.TestCase):
"_Test Account Discount - _TC": [-180.33, 1622.98]
}
for d in si.get("other_charges"):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
@ -300,7 +300,7 @@ class TestSalesInvoice(unittest.TestCase):
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("other_charges")[6].rate = 5000
si.get("taxes")[6].rate = 5000
si.insert()
@ -336,7 +336,7 @@ class TestSalesInvoice(unittest.TestCase):
"_Test Account Discount - _TC": [-7245.01, 65205.16]
}
for d in si.get("other_charges"):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
@ -408,8 +408,8 @@ 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]["other_charges"][0]["account_head"], 0.0, 80.0],
[test_records[1]["other_charges"][1]["account_head"], 0.0, 50.0],
[test_records[1]["taxes"][0]["account_head"], 0.0, 80.0],
[test_records[1]["taxes"][1]["account_head"], 0.0, 50.0],
])
for i, gle in enumerate(gl_entries):
@ -462,8 +462,8 @@ 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["other_charges"][0]["account_head"], 0.0, 80.0],
[pos["other_charges"][1]["account_head"], 0.0, 50.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],
[si.debit_to, 0.0, 600.0],
@ -515,7 +515,7 @@ class TestSalesInvoice(unittest.TestCase):
as pr_test_records
pr = frappe.copy_doc(pr_test_records[0])
pr.naming_series = "_T-Purchase Receipt-"
pr.get("purchase_receipt_details")[0].warehouse = "_Test Warehouse No Account - _TC"
pr.get("items")[0].warehouse = "_Test Warehouse No Account - _TC"
pr.insert()
pr.submit()
@ -545,8 +545,8 @@ 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("other_charges")[0]["account_head"], 0.0, 80.0],
[si_doc.get("other_charges")[1]["account_head"], 0.0, 50.0],
[si_doc.get("taxes")[0]["account_head"], 0.0, 80.0],
[si_doc.get("taxes")[1]["account_head"], 0.0, 50.0],
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_gl_entries[i][0], gle.account)
@ -577,8 +577,8 @@ 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]["other_charges"][0]["account_head"], 0.0, 80.0],
[test_records[1]["other_charges"][1]["account_head"], 0.0, 50.0],
[test_records[1]["taxes"][0]["account_head"], 0.0, 80.0],
[test_records[1]["taxes"][1]["account_head"], 0.0, 50.0],
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[i][0], gle.account)
@ -603,8 +603,8 @@ 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]["other_charges"][0]["account_head"], 0.0, 80.0],
[test_records[1]["other_charges"][1]["account_head"], 0.0, 50.0],
[test_records[1]["taxes"][0]["account_head"], 0.0, 80.0],
[test_records[1]["taxes"][1]["account_head"], 0.0, 50.0],
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[i][0], gle.account)
@ -639,7 +639,7 @@ class TestSalesInvoice(unittest.TestCase):
jv.submit()
si = frappe.copy_doc(test_records[0])
si.append("advance_adjustment_details", {
si.append("advances", {
"doctype": "Sales Invoice Advance",
"journal_voucher": jv.name,
"jv_detail_no": jv.get("entries")[0].name,
@ -651,17 +651,17 @@ class TestSalesInvoice(unittest.TestCase):
si.submit()
si.load_from_db()
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where against_invoice=%s""", si.name))
self.assertTrue(frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where against_invoice=%s and credit=300""", si.name))
self.assertEqual(si.outstanding_amount, 261.8)
si.cancel()
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail`
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Entry Account`
where against_invoice=%s""", si.name))
def test_recurring_invoice(self):
@ -679,7 +679,7 @@ class TestSalesInvoice(unittest.TestCase):
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
se = make_serialized_item()
serial_nos = get_serial_nos(se.get("mtn_details")[0].serial_no)
serial_nos = get_serial_nos(se.get("items")[0].serial_no)
si = frappe.copy_doc(test_records[0])
si.update_stock = 1
@ -713,7 +713,7 @@ class TestSalesInvoice(unittest.TestCase):
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
se = make_serialized_item()
serial_nos = get_serial_nos(se.get("mtn_details")[0].serial_no)
serial_nos = get_serial_nos(se.get("items")[0].serial_no)
sr = frappe.get_doc("Serial No", serial_nos[0])
sr.status = "Not Available"

View File

@ -33,7 +33,7 @@ cur_frm.pformat.in_words_export = function(doc) {
return '';
}
cur_frm.pformat.other_charges= function(doc){
cur_frm.pformat.taxes= function(doc){
//function to make row of table
var make_row = function(title, val, bold){
var bstart = '<b>'; var bend = '</b>';
@ -54,7 +54,7 @@ cur_frm.pformat.other_charges= function(doc){
out ='';
if (!doc.print_without_amount) {
var cl = doc.other_charges || [];
var cl = doc.taxes || [];
// outer table
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
@ -104,7 +104,7 @@ cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
d.charge_type = '';
}
validated = false;
refresh_field('charge_type', d.name, 'other_charges');
refresh_field('charge_type', d.name, 'taxes');
cur_frm.cscript.row_id(doc, cdt, cdn);
cur_frm.cscript.rate(doc, cdt, cdn);
cur_frm.cscript.tax_amount(doc, cdt, cdn);
@ -127,12 +127,12 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) {
}
}
validated = false;
refresh_field('row_id', d.name, 'other_charges');
refresh_field('row_id', d.name, 'taxes');
}
/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
cur_frm.fields_dict['taxes'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
return{
query: "erpnext.controllers.queries.tax_account_query",
filters: {
@ -142,7 +142,7 @@ cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query =
}
}
cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) {
cur_frm.fields_dict['taxes'].grid.get_field("cost_center").get_query = function(doc) {
return{
'company': doc.company,
'group_or_ledger': "Ledger"
@ -156,7 +156,7 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
d.rate = '';
}
validated = false;
refresh_field('rate', d.name, 'other_charges');
refresh_field('rate', d.name, 'taxes');
}
cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
@ -170,5 +170,5 @@ cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
d.tax_amount = '';
}
validated = false;
refresh_field('tax_amount', d.name, 'other_charges');
refresh_field('tax_amount', d.name, 'taxes');
};

View File

@ -14,4 +14,4 @@ class SalesTaxesandChargesMaster(Document):
(self.name, self.company))
# at least one territory
self.validate_table_has_rows("valid_for_territories")
self.validate_table_has_rows("territories")

View File

@ -2,13 +2,13 @@
{
"company": "_Test Company",
"doctype": "Sales Taxes and Charges Master",
"other_charges": [
"taxes": [
{
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 6
},
{
@ -16,20 +16,20 @@
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 6.36
}
],
"title": "_Test Sales Taxes and Charges Master",
"valid_for_territories": [
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "valid_for_territories",
"parentfield": "territories",
"territory": "All Territories"
},
{
"doctype": "Applicable Territory",
"parentfield": "valid_for_territories",
"parentfield": "territories",
"territory": "_Test Territory Rest Of The World"
}
]
@ -37,14 +37,14 @@
{
"company": "_Test Company",
"doctype": "Sales Taxes and Charges Master",
"other_charges": [
"taxes": [
{
"account_head": "_Test Account Shipping Charges - _TC",
"charge_type": "Actual",
"cost_center": "_Test Cost Center - _TC",
"description": "Shipping Charges",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 100
},
{
@ -53,7 +53,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Customs Duty",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 10
},
{
@ -62,7 +62,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Excise Duty",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12
},
{
@ -71,7 +71,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Education Cess",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 2,
"row_id": 3
},
@ -81,7 +81,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "S&H Education Cess",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 1,
"row_id": 3
},
@ -91,7 +91,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "CST",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 2,
"row_id": 5
},
@ -101,7 +101,7 @@
"cost_center": "_Test Cost Center - _TC",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12.5
},
{
@ -110,16 +110,16 @@
"cost_center": "_Test Cost Center - _TC",
"description": "Discount",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": -10,
"row_id": 7
}
],
"title": "_Test India Tax Master",
"valid_for_territories": [
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "valid_for_territories",
"parentfield": "territories",
"territory": "_Test Territory India"
}
]
@ -127,13 +127,13 @@
{
"company": "_Test Company",
"doctype": "Sales Taxes and Charges Master",
"other_charges": [
"taxes": [
{
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 12
},
{
@ -141,15 +141,15 @@
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"parentfield": "taxes",
"rate": 4
}
],
"title": "_Test Sales Taxes and Charges Master - Rest of the World",
"valid_for_territories": [
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "valid_for_territories",
"parentfield": "territories",
"territory": "_Test Territory Rest Of The World"
}
]

View File

@ -17,7 +17,7 @@ class ManyBlankToValuesError(frappe.ValidationError): pass
class ShippingRule(Document):
def validate(self):
self.validate_value("calculate_based_on", "in", ["Net Total", "Net Weight"])
self.shipping_rule_conditions = self.get("shipping_rule_conditions")
self.conditions = self.get("conditions")
self.validate_from_to_values()
self.sort_shipping_rule_conditions()
self.validate_overlapping_shipping_rule_conditions()
@ -25,7 +25,7 @@ class ShippingRule(Document):
def validate_from_to_values(self):
zero_to_values = []
for d in self.get("shipping_rule_conditions"):
for d in self.get("conditions"):
self.round_floats_in(d)
# values cannot be negative
@ -44,8 +44,8 @@ class ShippingRule(Document):
def sort_shipping_rule_conditions(self):
"""Sort Shipping Rule Conditions based on increasing From Value"""
self.shipping_rules_conditions = sorted(self.shipping_rule_conditions, key=lambda d: flt(d.from_value))
for i, d in enumerate(self.shipping_rule_conditions):
self.shipping_rules_conditions = sorted(self.conditions, key=lambda d: flt(d.from_value))
for i, d in enumerate(self.conditions):
d.idx = i + 1
def validate_overlapping_shipping_rule_conditions(self):
@ -60,9 +60,9 @@ class ShippingRule(Document):
return (not separate)
overlaps = []
for i in xrange(0, len(self.shipping_rule_conditions)):
for j in xrange(i+1, len(self.shipping_rule_conditions)):
d1, d2 = self.shipping_rule_conditions[i], self.shipping_rule_conditions[j]
for i in xrange(0, len(self.conditions)):
for j in xrange(i+1, len(self.conditions)):
d1, d2 = self.conditions[i], self.conditions[j]
if d1.as_dict() != d2.as_dict():
# in our case, to_value can be zero, hence pass the from_value if so
range_a = (d1.from_value, d1.to_value or d1.from_value)

View File

@ -7,32 +7,32 @@
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule",
"name": "_Test Shipping Rule",
"shipping_rule_conditions": [
"conditions": [
{
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 50.0,
"to_value": 100
},
{
"doctype": "Shipping Rule Condition",
"from_value": 101,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 100.0,
"to_value": 200
},
{
"doctype": "Shipping Rule Condition",
"from_value": 201,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 0.0
}
],
"valid_for_territories": [
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "valid_for_territories",
"parentfield": "territories",
"territory": "_Test Territory"
}
]
@ -45,32 +45,32 @@
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule - India",
"name": "_Test Shipping Rule - India",
"shipping_rule_conditions": [
"conditions": [
{
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 50.0,
"to_value": 100
},
{
"doctype": "Shipping Rule Condition",
"from_value": 101,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 100.0,
"to_value": 200
},
{
"doctype": "Shipping Rule Condition",
"from_value": 201,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 0.0
}
],
"valid_for_territories": [
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "valid_for_territories",
"parentfield": "territories",
"territory": "_Test Territory India"
}
]
@ -83,32 +83,32 @@
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule - Rest of the World",
"name": "_Test Shipping Rule - Rest of the World",
"shipping_rule_conditions": [
"conditions": [
{
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 500.0,
"to_value": 1000
},
{
"doctype": "Shipping Rule Condition",
"from_value": 1001,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 1000.0,
"to_value": 2000
},
{
"doctype": "Shipping Rule Condition",
"from_value": 2001,
"parentfield": "shipping_rule_conditions",
"parentfield": "conditions",
"shipping_amount": 1500.0
}
],
"valid_for_territories": [
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "valid_for_territories",
"parentfield": "territories",
"territory": "_Test Territory Rest Of The World"
}
]

View File

@ -11,13 +11,13 @@ class TestShippingRule(unittest.TestCase):
def test_from_greater_than_to(self):
shipping_rule = frappe.copy_doc(test_records[0])
shipping_rule.name = test_records[0].get('name')
shipping_rule.get("shipping_rule_conditions")[0].from_value = 101
shipping_rule.get("conditions")[0].from_value = 101
self.assertRaises(FromGreaterThanToError, shipping_rule.insert)
def test_many_zero_to_values(self):
shipping_rule = frappe.copy_doc(test_records[0])
shipping_rule.name = test_records[0].get('name')
shipping_rule.get("shipping_rule_conditions")[0].to_value = 0
shipping_rule.get("conditions")[0].to_value = 0
self.assertRaises(ManyBlankToValuesError, shipping_rule.insert)
def test_overlapping_conditions(self):
@ -30,8 +30,8 @@ class TestShippingRule(unittest.TestCase):
]:
shipping_rule = frappe.copy_doc(test_records[0])
shipping_rule.name = test_records[0].get('name')
shipping_rule.get("shipping_rule_conditions")[0].from_value = range_a[0]
shipping_rule.get("shipping_rule_conditions")[0].to_value = range_a[1]
shipping_rule.get("shipping_rule_conditions")[1].from_value = range_b[0]
shipping_rule.get("shipping_rule_conditions")[1].to_value = range_b[1]
shipping_rule.get("conditions")[0].from_value = range_a[0]
shipping_rule.get("conditions")[0].to_value = range_a[1]
shipping_rule.get("conditions")[1].from_value = range_b[0]
shipping_rule.get("conditions")[1].to_value = range_b[1]
self.assertRaises(OverlappingConditionError, shipping_rule.insert)

View File

@ -1,15 +1,15 @@
{
"creation": "2011-12-21 11:08:55",
"doc_type": "Sales Invoice",
"docstatus": 0,
"doctype": "Print Format",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"60%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"10%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Rate\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.entries -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}</td>\n\t\t\t<td class=\"text-right\">{{ item.amount }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total_export\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.other_charges -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total_export\") }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n{% if doc.get(\"other_charges\", filters={\"included_in_print_rate\": 1}) %}\n<hr>\n<p><b>Taxes Included:</b></p>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t{%- for row in doc.other_charges -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t<tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n{%- endif -%}\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
"idx": 1,
"modified": "2014-07-22 02:08:26.603223",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice",
"owner": "Administrator",
"print_format_type": "Server",
"creation": "2011-12-21 11:08:55",
"doc_type": "Sales Invoice",
"docstatus": 0,
"doctype": "Print Format",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"60%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"10%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Rate\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}</td>\n\t\t\t<td class=\"text-right\">{{ item.amount }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total_export\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total_export\") }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n{% if doc.get(\"taxes\", filters={\"included_in_print_rate\": 1}) %}\n<hr>\n<p><b>Taxes Included:</b></p>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t<tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n{%- endif -%}\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
"idx": 1,
"modified": "2014-12-25 02:08:26.603223",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice",
"owner": "Administrator",
"print_format_type": "Server",
"standard": "Yes"
}
}

View File

@ -35,7 +35,7 @@ def get_entries(filters):
conditions = get_conditions(filters)
entries = frappe.db.sql("""select jv.name, jvd.account, jv.posting_date,
jv.clearance_date, jvd.against_account, jvd.debit, jvd.credit
from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
from `tabJournal Entry Account` jvd, `tabJournal Voucher` jv
where jvd.parent = jv.name and jv.docstatus=1 %s
order by jv.name DESC""" % conditions, filters, as_list=1)
return entries

View File

@ -24,7 +24,7 @@ def execute(filters=None):
total_credit += flt(d[3])
amounts_not_reflected_in_system = frappe.db.sql("""select sum(ifnull(jvd.debit, 0) - ifnull(jvd.credit, 0))
from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
from `tabJournal Entry Account` jvd, `tabJournal Voucher` jv
where jvd.parent = jv.name and jv.docstatus=1 and jvd.account=%s
and jv.posting_date > %s and jv.clearance_date <= %s and ifnull(jv.is_opening, 'No') = 'No'
""", (filters["account"], filters["report_date"], filters["report_date"]))
@ -57,7 +57,7 @@ def get_entries(filters):
jv.posting_date, jv.name, jvd.debit, jvd.credit,
jvd.against_account, jv.cheque_no, jv.cheque_date, jv.clearance_date
from
`tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
`tabJournal Entry Account` jvd, `tabJournal Voucher` jv
where jvd.parent = jv.name and jv.docstatus=1
and jvd.account = %(account)s and jv.posting_date <= %(report_date)s
and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s

View File

@ -77,7 +77,7 @@ def get_entries(filters):
entries = frappe.db.sql("""select jv.name, jvd.account, jv.posting_date,
jvd.against_voucher, jvd.against_invoice, jvd.debit, jvd.credit,
jv.cheque_no, jv.cheque_date, jv.remark
from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
from `tabJournal Entry Account` jvd, `tabJournal Voucher` jv
where jvd.parent = jv.name and jv.docstatus=1 %s order by jv.name DESC""" %
(conditions), tuple(party_accounts), as_dict=1)

View File

@ -163,7 +163,7 @@ def check_if_jv_modified(args):
check if jv is submitted
"""
ret = frappe.db.sql("""
select t2.{dr_or_cr} from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
select t2.{dr_or_cr} from `tabJournal Voucher` t1, `tabJournal Entry Account` t2
where t1.name = t2.parent and t2.account = %(account)s
and t2.party_type = %(party_type)s and t2.party = %(party)s
and ifnull(t2.against_voucher, '')=''
@ -190,7 +190,7 @@ def update_against_doc(d, jv_obj):
if d['allocated_amt'] < d['unadjusted_amt']:
jvd = frappe.db.sql("""select cost_center, balance, against_account, is_advance
from `tabJournal Voucher Detail` where name = %s""", d['voucher_detail_no'])
from `tabJournal Entry Account` where name = %s""", d['voucher_detail_no'])
# new entry with balance amount
ch = jv_obj.append("entries")
ch.account = d['account']
@ -209,11 +209,11 @@ def update_against_doc(d, jv_obj):
jv_obj.save()
def remove_against_link_from_jv(ref_type, ref_no, against_field):
linked_jv = frappe.db.sql_list("""select parent from `tabJournal Voucher Detail`
linked_jv = frappe.db.sql_list("""select parent from `tabJournal Entry Account`
where `%s`=%s and docstatus < 2""" % (against_field, "%s"), (ref_no))
if linked_jv:
frappe.db.sql("""update `tabJournal Voucher Detail` set `%s`=null,
frappe.db.sql("""update `tabJournal Entry Account` set `%s`=null,
modified=%s, modified_by=%s
where `%s`=%s and docstatus < 2""" % (against_field, "%s", "%s", against_field, "%s"),
(now(), frappe.session.user, ref_no))

View File

@ -178,7 +178,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
calculate_taxes_and_totals: function() {
this._super();
this.calculate_total_advance("Purchase Invoice", "advance_allocation_details");
this.calculate_total_advance("Purchase Invoice", "advances");
this.frm.refresh_fields();
},
@ -368,9 +368,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
setup_field_label_map(["tax_amount", "total"], company_currency, this.other_fname);
}
if(this.frm.fields_dict["advance_allocation_details"]) {
if(this.frm.fields_dict["advances"]) {
setup_field_label_map(["advance_amount", "allocated_amount"], company_currency,
"advance_allocation_details");
"advances");
}
// toggle columns

View File

@ -4,8 +4,8 @@
frappe.provide("erpnext.buying");
cur_frm.cscript.tname = "Purchase Order Item";
cur_frm.cscript.fname = "po_details";
cur_frm.cscript.other_fname = "other_charges";
cur_frm.cscript.fname = "items";
cur_frm.cscript.other_fname = "taxes";
{% include 'buying/doctype/purchase_common/purchase_common.js' %};
{% include 'accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js' %}
@ -105,9 +105,9 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
this.get_terms();
},
po_details_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("po_details", row, ["schedule_date"]);
this.frm.script_manager.copy_from_first_row("items", row, ["schedule_date"]);
}
});
@ -126,7 +126,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
}
}
cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
cur_frm.fields_dict['items'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return {
filters:[
['Project', 'status', 'not in', 'Completed, Cancelled']
@ -134,7 +134,7 @@ cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = fun
}
}
cur_frm.fields_dict['po_details'].grid.get_field('bom').get_query = function(doc, cdt, cdn) {
cur_frm.fields_dict['items'].grid.get_field('bom').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn]
return {
filters: [
@ -188,7 +188,7 @@ cur_frm.pformat.indent_no = function(doc, cdt, cdn){
out ='';
var cl = doc.po_details || [];
var cl = doc.items || [];
// outer table
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';

View File

@ -9,12 +9,12 @@ from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
form_grid_templates = {
"po_details": "templates/form_grid/item_grid.html"
"items": "templates/form_grid/item_grid.html"
}
class PurchaseOrder(BuyingController):
tname = 'Purchase Order Item'
fname = 'po_details'
fname = 'items'
def __init__(self, arg1, arg2=None):
super(PurchaseOrder, self).__init__(arg1, arg2)
@ -51,7 +51,7 @@ class PurchaseOrder(BuyingController):
self.validate_with_previous_doc()
self.validate_for_subcontracting()
self.validate_minimum_order_qty()
self.create_raw_materials_supplied("po_raw_material_details")
self.create_raw_materials_supplied("supplied_items")
def validate_with_previous_doc(self):
super(PurchaseOrder, self).validate_with_previous_doc(self.tname, {
@ -71,7 +71,7 @@ class PurchaseOrder(BuyingController):
itemwise_min_order_qty = frappe._dict(frappe.db.sql("select name, min_order_qty from tabItem"))
itemwise_qty = frappe._dict()
for d in self.get("po_details"):
for d in self.get("items"):
itemwise_qty.setdefault(d.item_code, 0)
itemwise_qty[d.item_code] += flt(d.stock_qty)
@ -80,7 +80,7 @@ class PurchaseOrder(BuyingController):
frappe.throw(_("Item #{0}: Ordered qty can not less than item's minimum order qty (defined in item master).").format(item_code))
def get_schedule_dates(self):
for d in self.get('po_details'):
for d in self.get('items'):
if d.prevdoc_detail_docname and not d.schedule_date:
d.schedule_date = frappe.db.get_value("Material Request Item",
d.prevdoc_detail_docname, "schedule_date")
@ -91,14 +91,14 @@ class PurchaseOrder(BuyingController):
# Check for Stopped status
def check_for_stopped_status(self, pc_obj):
check_list =[]
for d in self.get('po_details'):
for d in self.get('items'):
if d.meta.get_field('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list:
check_list.append(d.prevdoc_docname)
pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
def update_requested_qty(self):
material_request_map = {}
for d in self.get("po_details"):
for d in self.get("items"):
if d.prevdoc_doctype and d.prevdoc_doctype == "Material Request" and d.prevdoc_detail_docname:
material_request_map.setdefault(d.prevdoc_docname, []).append(d.prevdoc_detail_docname)
@ -128,7 +128,7 @@ class PurchaseOrder(BuyingController):
bin_doc.save()
item_wh_list = []
for d in self.get("po_details"):
for d in self.get("items"):
if (not po_item_rows or d.name in po_item_rows) and [d.item_code, d.warehouse] not in item_wh_list \
and frappe.db.get_value("Item", d.item_code, "is_stock_item") == "Yes" and d.warehouse:
item_wh_list.append([d.item_code, d.warehouse])

View File

@ -23,7 +23,7 @@ class TestPurchaseOrder(unittest.TestCase):
pr.supplier_warehouse = "_Test Warehouse 1 - _TC"
pr.posting_date = "2013-05-12"
self.assertEquals(pr.doctype, "Purchase Receipt")
self.assertEquals(len(pr.get("purchase_receipt_details")), len(test_records[0]["po_details"]))
self.assertEquals(len(pr.get("items")), len(test_records[0]["items"]))
pr.naming_series = "_T-Purchase Receipt-"
frappe.get_doc(pr).insert()
@ -38,7 +38,7 @@ class TestPurchaseOrder(unittest.TestCase):
po = frappe.get_doc("Purchase Order", po.name)
po.is_subcontracted = "No"
po.get("po_details")[0].item_code = "_Test Item"
po.get("items")[0].item_code = "_Test Item"
po.submit()
self.assertEquals(self._get_ordered_qty("_Test Item", "_Test Warehouse - _TC"), existing_ordered_qty + 10)
@ -46,15 +46,15 @@ class TestPurchaseOrder(unittest.TestCase):
pr = make_purchase_receipt(po.name)
self.assertEquals(pr.doctype, "Purchase Receipt")
self.assertEquals(len(pr.get("purchase_receipt_details", [])), len(test_records[0]["po_details"]))
self.assertEquals(len(pr.get("items", [])), len(test_records[0]["items"]))
pr.posting_date = "2013-05-12"
pr.naming_series = "_T-Purchase Receipt-"
pr.purchase_receipt_details[0].qty = 4.0
pr.items[0].qty = 4.0
pr.insert()
pr.submit()
po.load_from_db()
self.assertEquals(po.get("po_details")[0].received_qty, 4)
self.assertEquals(po.get("items")[0].received_qty, 4)
self.assertEquals(self._get_ordered_qty("_Test Item", "_Test Warehouse - _TC"), existing_ordered_qty + 6)
frappe.db.set_value('Item', '_Test Item', 'tolerance', 50)
@ -62,19 +62,19 @@ class TestPurchaseOrder(unittest.TestCase):
pr1 = make_purchase_receipt(po.name)
pr1.naming_series = "_T-Purchase Receipt-"
pr1.posting_date = "2013-05-12"
pr1.get("purchase_receipt_details")[0].qty = 8
pr1.get("items")[0].qty = 8
pr1.insert()
pr1.submit()
po.load_from_db()
self.assertEquals(po.get("po_details")[0].received_qty, 12)
self.assertEquals(po.get("items")[0].received_qty, 12)
self.assertEquals(self._get_ordered_qty("_Test Item", "_Test Warehouse - _TC"), existing_ordered_qty)
pr1.load_from_db()
pr1.cancel()
po.load_from_db()
self.assertEquals(po.get("po_details")[0].received_qty, 4)
self.assertEquals(po.get("items")[0].received_qty, 4)
self.assertEquals(self._get_ordered_qty("_Test Item", "_Test Warehouse - _TC"), existing_ordered_qty + 6)
def test_make_purchase_invoice(self):
@ -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]["po_details"]))
self.assertEquals(len(pi.get("entries", [])), len(test_records[0]["items"]))
pi.credit_to = "_Test Payable - _TC"
pi.posting_date = "2013-05-12"
@ -100,7 +100,7 @@ class TestPurchaseOrder(unittest.TestCase):
def test_subcontracting(self):
po = frappe.copy_doc(test_records[0])
po.insert()
self.assertEquals(len(po.get("po_raw_material_details")), 2)
self.assertEquals(len(po.get("supplied_items")), 2)
def test_warehouse_company_validation(self):
from erpnext.stock.utils import InvalidWarehouseCompany
@ -112,7 +112,7 @@ class TestPurchaseOrder(unittest.TestCase):
def test_uom_integer_validation(self):
from erpnext.utilities.transaction_base import UOMMustBeIntegerError
po = frappe.copy_doc(test_records[0])
po.get("po_details")[0].qty = 3.4
po.get("items")[0].qty = 3.4
self.assertRaises(UOMMustBeIntegerError, po.insert)
def test_recurring_order(self):

View File

@ -12,7 +12,7 @@
"is_subcontracted": "Yes",
"naming_series": "_T-Purchase Order-",
"net_total": 5000.0,
"po_details": [
"items": [
{
"base_amount": 5000.0,
"conversion_factor": 1.0,
@ -20,7 +20,7 @@
"doctype": "Purchase Order Item",
"item_code": "_Test FG Item",
"item_name": "_Test FG Item",
"parentfield": "po_details",
"parentfield": "items",
"qty": 10.0,
"rate": 500.0,
"schedule_date": "2013-03-01",
@ -46,7 +46,7 @@
"is_subcontracted": "No",
"naming_series": "_T-Purchase Order-",
"net_total": 5000.0,
"po_details": [
"items": [
{
"base_amount": 5000.0,
"conversion_factor": 1.0,
@ -54,7 +54,7 @@
"doctype": "Purchase Order Item",
"item_code": "_Test Item",
"item_name": "_Test Item",
"parentfield": "po_details",
"parentfield": "items",
"qty": 10.0,
"rate": 500.0,
"schedule_date": "2013-03-01",

View File

@ -9,7 +9,7 @@ from frappe.model.document import Document
class QualityInspection(Document):
def get_item_specification_details(self):
self.set('qa_specification_details', [])
self.set('readings', [])
variant_of = frappe.db.get_query("Item", self.item_code, "variant_of")
if variant_of:
specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \
@ -18,7 +18,7 @@ class QualityInspection(Document):
specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \
where parent = %s order by idx", self.item_code)
for d in specification:
child = self.append('qa_specification_details', {})
child = self.append('readings', {})
child.specification = d[0]
child.value = d[1]
child.status = 'Accepted'

View File

@ -59,7 +59,7 @@ cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
}
}
cur_frm.fields_dict['party_accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
filters: {

View File

@ -3,8 +3,8 @@
// define defaults for purchase common
cur_frm.cscript.tname = "Supplier Quotation Item";
cur_frm.cscript.fname = "quotation_items";
cur_frm.cscript.other_fname = "other_charges";
cur_frm.cscript.fname = "items";
cur_frm.cscript.other_fname = "taxes";
// attach required files
{% include 'buying/doctype/purchase_common/purchase_common.js' %};
@ -52,7 +52,7 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
// no need to trigger updation of stock uom, as this field doesn't exist in supplier quotation
}
cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query =
cur_frm.fields_dict['items'].grid.get_field('project_name').get_query =
function(doc, cdt, cdn) {
return{
filters:[

View File

@ -8,12 +8,12 @@ from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
form_grid_templates = {
"quotation_items": "templates/form_grid/item_grid.html"
"items": "templates/form_grid/item_grid.html"
}
class SupplierQuotation(BuyingController):
tname = "Supplier Quotation Item"
fname = "quotation_items"
fname = "items"
def validate(self):
super(SupplierQuotation, self).validate()

View File

@ -11,14 +11,14 @@
"is_subcontracted": "No",
"naming_series": "_T-Supplier Quotation-",
"net_total": 5000.0,
"quotation_items": [
"items": [
{
"base_amount": 5000.0,
"description": "_Test FG Item",
"doctype": "Supplier Quotation Item",
"item_code": "_Test FG Item",
"item_name": "_Test FG Item",
"parentfield": "quotation_items",
"parentfield": "items",
"qty": 10.0,
"rate": 500.0,
"uom": "_Test UOM",

View File

@ -21,11 +21,11 @@ class TestPurchaseOrder(unittest.TestCase):
po = make_purchase_order(sq.name)
self.assertEquals(po.doctype, "Purchase Order")
self.assertEquals(len(po.get("po_details")), len(sq.get("quotation_items")))
self.assertEquals(len(po.get("items")), len(sq.get("items")))
po.naming_series = "_T-Purchase Order-"
for doc in po.get("po_details"):
for doc in po.get("items"):
if doc.get("item_code"):
doc.set("schedule_date", "2013-04-12")

View File

@ -145,8 +145,8 @@ class AccountsController(TransactionBase):
get_taxes_and_charges(tax_master_doctype, self.get(tax_master_field), tax_parentfield))
def set_other_charges(self):
self.set("other_charges", [])
self.set_taxes("other_charges", "taxes_and_charges")
self.set("taxes", [])
self.set_taxes("taxes", "taxes_and_charges")
def calculate_taxes_and_totals(self):
self.discount_amount_applied = False
@ -394,7 +394,7 @@ class AccountsController(TransactionBase):
select
t1.name as jv_no, t1.remark, t2.{0} as amount, t2.name as jv_detail_no, `against_{1}` as against_order
from
`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
`tabJournal Voucher` t1, `tabJournal Entry Account` t2
where
t1.name = t2.parent and t2.account = %s
and t2.party_type=%s and t2.party=%s
@ -426,7 +426,7 @@ class AccountsController(TransactionBase):
account = self.get("debit_to" if self.doctype=="Sales Invoice" else "credit_to")
jv_against_order = frappe.db.sql("""select parent, %s as against_order
from `tabJournal Voucher Detail`
from `tabJournal Entry Account`
where docstatus=1 and account=%s and ifnull(is_advance, 'No') = 'Yes'
and ifnull(against_sales_order, '') in (%s)
group by parent, against_sales_order""" %
@ -501,7 +501,7 @@ class AccountsController(TransactionBase):
select
sum(ifnull({dr_or_cr}, 0))
from
`tabJournal Voucher Detail`
`tabJournal Entry Account`
where
{against_field} = %s and docstatus = 1 and is_advance = "Yes" """.format(dr_or_cr=dr_or_cr, \
against_field=against_field), self.name)

View File

@ -17,7 +17,7 @@ class BuyingController(StockController):
if hasattr(self, "fname"):
self.table_print_templates = {
self.fname: "templates/print_formats/includes/item_grid.html",
"other_charges": "templates/print_formats/includes/taxes.html",
"taxes": "templates/print_formats/includes/taxes.html",
}
def get_feed(self):
@ -46,7 +46,7 @@ class BuyingController(StockController):
self.set_missing_item_details()
if self.get("__islocal"):
self.set_taxes("other_charges", "taxes_and_charges")
self.set_taxes("taxes", "taxes_and_charges")
def set_supplier_from_item_default(self):
if self.meta.get_field("supplier") and not self.supplier:
@ -66,8 +66,8 @@ class BuyingController(StockController):
validate_warehouse_company(w, self.company)
def validate_stock_or_nonstock_items(self):
if self.meta.get_field("other_charges") and not self.get_stock_items():
tax_for_valuation = [d.account_head for d in self.get("other_charges")
if self.meta.get_field("taxes") and not self.get_stock_items():
tax_for_valuation = [d.account_head for d in self.get("taxes")
if d.category in ["Valuation", "Valuation and Total"]]
if tax_for_valuation:
frappe.throw(_("Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"))
@ -82,9 +82,9 @@ class BuyingController(StockController):
self.currency)
def calculate_taxes_and_totals(self):
self.other_fname = "other_charges"
self.other_fname = "taxes"
super(BuyingController, self).calculate_taxes_and_totals()
self.calculate_total_advance("Purchase Invoice", "advance_allocation_details")
self.calculate_total_advance("Purchase Invoice", "advances")
def calculate_item_values(self):
for item in self.item_doclist:
@ -175,7 +175,7 @@ class BuyingController(StockController):
last_stock_item_idx = d.idx
total_valuation_amount = sum([flt(d.tax_amount) for d in
self.get("other_charges")
self.get("taxes")
if d.category in ["Valuation", "Valuation and Total"]])

View File

@ -15,7 +15,7 @@ class SellingController(StockController):
if hasattr(self, "fname"):
self.table_print_templates = {
self.fname: "templates/print_formats/includes/item_grid.html",
"other_charges": "templates/print_formats/includes/taxes.html",
"taxes": "templates/print_formats/includes/taxes.html",
}
def get_feed(self):
@ -44,7 +44,7 @@ class SellingController(StockController):
self.set_missing_lead_customer_details()
self.set_price_list_and_item_details()
if self.get("__islocal"):
self.set_taxes("other_charges", "taxes_and_charges")
self.set_taxes("taxes", "taxes_and_charges")
def set_missing_lead_customer_details(self):
if getattr(self, "customer", None):
@ -73,7 +73,7 @@ class SellingController(StockController):
# shipping rule calculation based on item's net weight
shipping_amount = 0.0
for condition in shipping_rule.get("shipping_rule_conditions"):
for condition in shipping_rule.get("conditions"):
if not condition.to_value or (flt(condition.from_value) <= value <= flt(condition.to_value)):
shipping_amount = condition.shipping_amount
break
@ -85,28 +85,28 @@ class SellingController(StockController):
"cost_center": shipping_rule.cost_center
}
existing_shipping_charge = self.get("other_charges", filters=shipping_charge)
existing_shipping_charge = self.get("taxes", filters=shipping_charge)
if existing_shipping_charge:
# take the last record found
existing_shipping_charge[-1].rate = shipping_amount
else:
shipping_charge["rate"] = shipping_amount
shipping_charge["description"] = shipping_rule.label
self.append("other_charges", shipping_charge)
self.append("taxes", shipping_charge)
self.calculate_taxes_and_totals()
def remove_shipping_charge(self):
if self.shipping_rule:
shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule)
existing_shipping_charge = self.get("other_charges", {
existing_shipping_charge = self.get("taxes", {
"doctype": "Sales Taxes and Charges",
"charge_type": "Actual",
"account_head": shipping_rule.account,
"cost_center": shipping_rule.cost_center
})
if existing_shipping_charge:
self.get("other_charges").remove(existing_shipping_charge[-1])
self.get("taxes").remove(existing_shipping_charge[-1])
self.calculate_taxes_and_totals()
def set_total_in_words(self):
@ -124,11 +124,11 @@ class SellingController(StockController):
self.grand_total_export or self.rounded_total_export, self.currency)
def calculate_taxes_and_totals(self):
self.other_fname = "other_charges"
self.other_fname = "taxes"
super(SellingController, self).calculate_taxes_and_totals()
self.calculate_total_advance("Sales Invoice", "advance_adjustment_details")
self.calculate_total_advance("Sales Invoice", "advances")
self.calculate_commission()
self.calculate_contribution()
@ -343,7 +343,7 @@ class SellingController(StockController):
reserved_qty_for_main_item = -flt(d.qty)
if self.has_sales_bom(d.item_code):
for p in self.get("packing_details"):
for p in self.get("packed_items"):
if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
# the packing details table's qty is already multiplied with parent's qty
il.append(frappe._dict({

View File

@ -33,7 +33,7 @@ cur_frm.cscript.kra_template = function(doc, dt, dn) {
cur_frm.cscript.calculate_total_score = function(doc,cdt,cdn){
//return get_server_fields('calculate_total','','',doc,cdt,cdn,1);
var val = doc.appraisal_details || [];
var val = doc.goals || [];
var total =0;
for(var i = 0; i<val.length; i++){
total = flt(total)+flt(val[i].score_earned)
@ -48,21 +48,21 @@ cur_frm.cscript.score = function(doc,cdt,cdn){
if (flt(d.score) > 5) {
msgprint(__("Score must be less than or equal to 5"));
d.score = 0;
refresh_field('score', d.name, 'appraisal_details');
refresh_field('score', d.name, 'goals');
}
total = flt(d.per_weightage*d.score)/100;
d.score_earned = total.toPrecision(2);
refresh_field('score_earned', d.name, 'appraisal_details');
refresh_field('score_earned', d.name, 'goals');
}
else{
d.score_earned = 0;
refresh_field('score_earned', d.name, 'appraisal_details');
refresh_field('score_earned', d.name, 'goals');
}
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
var val = doc.appraisal_details || [];
var val = doc.goals || [];
var total =0;
for(var i = 0; i<val.length; i++){
total = flt(total)+flt(val[i].score_earned);

View File

@ -40,7 +40,7 @@ class Appraisal(Document):
def calculate_total(self):
total, total_w = 0, 0
for d in self.get('appraisal_details'):
for d in self.get('goals'):
if d.score:
d.score_earned = flt(d.score) * flt(d.per_weightage) / 100
total = total + d.score_earned

View File

@ -10,7 +10,7 @@ from frappe.model.document import Document
class AppraisalTemplate(Document):
def validate(self):
self.total_points = 0
for d in self.get("kra_sheet"):
for d in self.get("goals"):
self.total_points += int(d.per_weightage or 0)
if int(self.total_points) != 100:

View File

@ -12,7 +12,7 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
onload: function() {
if(this.frm.doc.__islocal) this.frm.set_value("employee_name", "");
this.frm.set_query("leave_approver", "employee_leave_approvers", function() {
this.frm.set_query("leave_approver", "leave_approvers", function() {
return {
filters: [["UserRole", "role", "=", "Leave Approver"]]
}

View File

@ -138,9 +138,9 @@ class Employee(Document):
def validate_employee_leave_approver(self):
from erpnext.hr.doctype.leave_application.leave_application import InvalidLeaveApproverError
for l in self.get("employee_leave_approvers")[:]:
for l in self.get("leave_approvers")[:]:
if "Leave Approver" not in frappe.get_roles(l.leave_approver):
self.get("employee_leave_approvers").remove(l)
self.get("leave_approvers").remove(l)
msgprint(_("{0} is not a valid Leave Approver. Removing row #{1}.").format(l.leave_approver, l.idx))
def validate_reports_to(self):

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 Voucher Detail', 'entries');
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'entries');
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 Voucher Detail', 'entries');
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'entries');
d1.credit = cur_frm.doc.total_sanctioned_amount;
d1.against_expense_claim = cur_frm.doc.name;
if(r.message) {
@ -69,7 +69,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn) {
}
cur_frm.cscript.clear_sanctioned = function(doc) {
var val = doc.expense_voucher_details || [];
var val = doc.expenses || [];
for(var i = 0; i<val.length; i++){
val[i].sanctioned_amount ='';
}
@ -129,7 +129,7 @@ cur_frm.cscript.validate = function(doc) {
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
doc.total_claimed_amount = 0;
doc.total_sanctioned_amount = 0;
$.each((doc.expense_voucher_details || []), function(i, d) {
$.each((doc.expenses || []), function(i, d) {
doc.total_claimed_amount += d.claim_amount;
if(d.sanctioned_amount==null) {
d.sanctioned_amount = d.claim_amount;

View File

@ -30,7 +30,7 @@ class ExpenseClaim(Document):
validate_fiscal_year(self.posting_date, self.fiscal_year, "Posting Date")
def validate_exp_details(self):
if not self.get('expense_voucher_details'):
if not self.get('expenses'):
frappe.throw(_("Please add expense voucher details"))
def validate_expense_approver(self):

View File

@ -18,9 +18,9 @@ class HolidayList(Document):
self.validate_values()
yr_start_date, yr_end_date = self.get_fy_start_end_dates()
date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date)
last_idx = max([cint(d.idx) for d in self.get("holiday_list_details")] or [0,])
last_idx = max([cint(d.idx) for d in self.get("holidays")] or [0,])
for i, d in enumerate(date_list):
ch = self.append('holiday_list_details', {})
ch = self.append('holidays', {})
ch.description = self.weekly_off
ch.holiday_date = d
ch.idx = last_idx + i + 1
@ -54,7 +54,7 @@ class HolidayList(Document):
return date_list
def clear_table(self):
self.set('holiday_list_details', [])
self.set('holidays', [])
def update_default_holiday_list(self):
frappe.db.sql("""update `tabHoliday List` set is_default = 0

View File

@ -2,7 +2,7 @@
{
"doctype": "Holiday List",
"fiscal_year": "_Test Fiscal Year 2013",
"holiday_list_details": [
"holidays": [
{
"description": "New Year",
"holiday_date": "2013-01-01"

View File

@ -143,7 +143,7 @@ class LeaveApplication(Document):
def validate_leave_approver(self):
employee = frappe.get_doc("Employee", self.employee)
leave_approvers = [l.leave_approver for l in employee.get("employee_leave_approvers")]
leave_approvers = [l.leave_approver for l in employee.get("leave_approvers")]
if len(leave_approvers) and self.leave_approver not in leave_approvers:
frappe.throw(_("Leave approver must be one of {0}").format(comma_or(leave_approvers)), InvalidLeaveApproverError)

View File

@ -61,7 +61,7 @@ class TestLeaveApplication(unittest.TestCase):
temp_session_user = frappe.session.user
frappe.set_user("Administrator")
employee = frappe.get_doc("Employee", employee)
employee.append("employee_leave_approvers", {
employee.append("leave_approvers", {
"doctype": "Employee Leave Approver",
"leave_approver": leave_approver
})
@ -72,11 +72,11 @@ class TestLeaveApplication(unittest.TestCase):
temp_session_user = frappe.session.user
frappe.set_user("Administrator")
employee = frappe.get_doc("Employee", employee)
d = employee.get("employee_leave_approvers", {
d = employee.get("leave_approvers", {
"leave_approver": leave_approver
})
if d:
employee.get("employee_leave_approvers").remove(d[0])
employee.get("leave_approvers").remove(d[0])
employee.save()
frappe.set_user(temp_session_user)

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 Voucher Detail', 'entries');
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'entries');
d1.account = r.message['default_bank_account'];
d1.credit = r.message['amount']
// debit to salary account
var d2 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
var d2 = frappe.model.add_child(jv, 'Journal Entry Account', 'entries');
d2.debit = r.message['amount']
loaddoc('Journal Voucher', jv.name);

View File

@ -65,13 +65,13 @@ cur_frm.cscript.d_depends_on_lwp = cur_frm.cscript.d_modified_amount;
// Calculate earning total
// ------------------------------------------------------------------------
var calculate_earning_total = function(doc, dt, dn) {
var tbl = doc.earning_details || [];
var tbl = doc.earnings || [];
var total_earn = 0;
for(var i = 0; i < tbl.length; i++){
if(cint(tbl[i].e_depends_on_lwp) == 1) {
tbl[i].e_modified_amount = Math.round(tbl[i].e_amount)*(flt(doc.payment_days)/cint(doc.total_days_in_month)*100)/100;
refresh_field('e_modified_amount', tbl[i].name, 'earning_details');
refresh_field('e_modified_amount', tbl[i].name, 'earnings');
}
total_earn += flt(tbl[i].e_modified_amount);
}
@ -82,13 +82,13 @@ var calculate_earning_total = function(doc, dt, dn) {
// Calculate deduction total
// ------------------------------------------------------------------------
var calculate_ded_total = function(doc, dt, dn) {
var tbl = doc.deduction_details || [];
var tbl = doc.deductions || [];
var total_ded = 0;
for(var i = 0; i < tbl.length; i++){
if(cint(tbl[i].d_depends_on_lwp) == 1) {
tbl[i].d_modified_amount = Math.round(tbl[i].d_amount)*(flt(doc.payment_days)/cint(doc.total_days_in_month)*100)/100;
refresh_field('d_modified_amount', tbl[i].name, 'deduction_details');
refresh_field('d_modified_amount', tbl[i].name, 'deductions');
}
total_ded += flt(tbl[i].d_modified_amount);
}

View File

@ -134,8 +134,8 @@ class SalarySlip(TransactionBase):
from frappe.utils import money_in_words
self.check_existing()
if not (len(self.get("earning_details")) or
len(self.get("deduction_details"))):
if not (len(self.get("earnings")) or
len(self.get("deductions"))):
self.get_emp_and_leave_details()
else:
self.get_leave_details(self.leave_without_pay)
@ -150,7 +150,7 @@ class SalarySlip(TransactionBase):
def calculate_earning_total(self):
self.gross_pay = flt(self.arrear_amount) + flt(self.leave_encashment_amount)
for d in self.get("earning_details"):
for d in self.get("earnings"):
if cint(d.e_depends_on_lwp) == 1:
d.e_modified_amount = rounded(flt(d.e_amount) * flt(self.payment_days)
/ cint(self.total_days_in_month), 2)
@ -162,7 +162,7 @@ class SalarySlip(TransactionBase):
def calculate_ded_total(self):
self.total_deduction = 0
for d in self.get('deduction_details'):
for d in self.get('deductions'):
if cint(d.d_depends_on_lwp) == 1:
d.d_modified_amount = rounded(flt(d.d_amount) * flt(self.payment_days)
/ cint(self.total_days_in_month), 2)

View File

@ -1,37 +1,37 @@
[
{
"company": "_Test Company",
"deduction_details": [
"deductions": [
{
"d_amount": 100,
"d_depends_on_lwp": 0,
"d_type": "_Test Professional Tax",
"doctype": "Salary Slip Deduction",
"parentfield": "deduction_details"
"parentfield": "deductions"
},
{
"d_amount": 50,
"d_depends_on_lwp": 1,
"d_type": "_Test TDS",
"doctype": "Salary Slip Deduction",
"parentfield": "deduction_details"
"parentfield": "deductions"
}
],
"doctype": "Salary Slip",
"earning_details": [
"earnings": [
{
"doctype": "Salary Slip Earning",
"e_amount": 15000,
"e_depends_on_lwp": 1,
"e_type": "_Test Basic Salary",
"parentfield": "earning_details"
"parentfield": "earnings"
},
{
"doctype": "Salary Slip Earning",
"e_amount": 500,
"e_depends_on_lwp": 0,
"e_type": "_Test Allowance",
"parentfield": "earning_details"
"parentfield": "earnings"
}
],
"employee": "_T-Employee-0001",

View File

@ -27,10 +27,10 @@ class TestSalarySlip(unittest.TestCase):
ss.insert()
self.assertEquals(ss.total_days_in_month, 31)
self.assertEquals(ss.payment_days, 30)
self.assertEquals(ss.earning_details[0].e_modified_amount, 14516.13)
self.assertEquals(ss.earning_details[1].e_modified_amount, 500)
self.assertEquals(ss.deduction_details[0].d_modified_amount, 100)
self.assertEquals(ss.deduction_details[1].d_modified_amount, 48.39)
self.assertEquals(ss.earnings[0].e_modified_amount, 14516.13)
self.assertEquals(ss.earnings[1].e_modified_amount, 500)
self.assertEquals(ss.deductions[0].d_modified_amount, 100)
self.assertEquals(ss.deductions[1].d_modified_amount, 48.39)
self.assertEquals(ss.gross_pay, 15016.13)
self.assertEquals(ss.net_pay, 14867.74)
@ -39,10 +39,10 @@ class TestSalarySlip(unittest.TestCase):
ss.insert()
self.assertEquals(ss.total_days_in_month, 30)
self.assertEquals(ss.payment_days, 29)
self.assertEquals(ss.earning_details[0].e_modified_amount, 14500)
self.assertEquals(ss.earning_details[1].e_modified_amount, 500)
self.assertEquals(ss.deduction_details[0].d_modified_amount, 100)
self.assertEquals(ss.deduction_details[1].d_modified_amount, 48.33)
self.assertEquals(ss.earnings[0].e_modified_amount, 14500)
self.assertEquals(ss.earnings[1].e_modified_amount, 500)
self.assertEquals(ss.deductions[0].d_modified_amount, 100)
self.assertEquals(ss.deductions[1].d_modified_amount, 48.33)
self.assertEquals(ss.gross_pay, 15000)
self.assertEquals(ss.net_pay, 14851.67)

View File

@ -4,10 +4,10 @@
cur_frm.add_fetch('employee', 'company', 'company');
cur_frm.cscript.onload = function(doc, dt, dn){
e_tbl = doc.earning_details || [];
d_tbl = doc.deduction_details || [];
e_tbl = doc.earnings || [];
d_tbl = doc.deductions || [];
if (e_tbl.length == 0 && d_tbl.length == 0)
return $c_obj(doc,'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
return $c_obj(doc,'make_earn_ded_table','', function(r, rt) { refresh_many(['earnings', 'deductions']);});
}
cur_frm.cscript.refresh = function(doc, dt, dn){
@ -38,8 +38,8 @@ cur_frm.cscript.d_modified_amt = function(doc, cdt, cdn){
}
var calculate_totals = function(doc, cdt, cdn) {
var tbl1 = doc.earning_details || [];
var tbl2 = doc.deduction_details || [];
var tbl1 = doc.earnings || [];
var tbl2 = doc.deductions || [];
var total_earn = 0; var total_ded = 0;
for(var i = 0; i < tbl1.length; i++){

View File

@ -40,16 +40,16 @@ class SalaryStructure(Document):
list1 = frappe.db.sql("select name from `tab%s` where docstatus != 2" % doct_name)
for li in list1:
child = self.append(tab_fname, {})
if(tab_fname == 'earning_details'):
if(tab_fname == 'earnings'):
child.e_type = cstr(li[0])
child.modified_value = 0
elif(tab_fname == 'deduction_details'):
elif(tab_fname == 'deductions'):
child.d_type = cstr(li[0])
child.d_modified_amt = 0
def make_earn_ded_table(self):
self.make_table('Earning Type','earning_details','Salary Structure Earning')
self.make_table('Deduction Type','deduction_details', 'Salary Structure Deduction')
self.make_table('Earning Type','earnings','Salary Structure Earning')
self.make_table('Deduction Type','deductions', 'Salary Structure Deduction')
def check_existing(self):
ret = frappe.db.sql("""select name from `tabSalary Structure` where is_active = 'Yes'

View File

@ -26,12 +26,12 @@ cur_frm.cscript.update_cost = function() {
}
cur_frm.cscript.with_operations = function(doc) {
cur_frm.fields_dict["bom_materials"].grid.set_column_disp("operation", doc.with_operations);
cur_frm.fields_dict["bom_materials"].grid.toggle_reqd("operation", doc.with_operations);
cur_frm.fields_dict["items"].grid.set_column_disp("operation", doc.with_operations);
cur_frm.fields_dict["items"].grid.toggle_reqd("operation", doc.with_operations);
}
erpnext.bom.set_operation = function(doc) {
var op_table = doc["bom_operations"] || [];
var op_table = doc["operations"] || [];
var operations = [];
for (var i=0, j=op_table.length; i<j; i++) {
@ -40,10 +40,10 @@ erpnext.bom.set_operation = function(doc) {
frappe.meta.get_docfield("BOM Item", "operation", cur_frm.docname).options = operations.join("\n");
refresh_field("bom_materials");
refresh_field("items");
}
cur_frm.cscript.bom_operations_remove = function(){
cur_frm.cscript.operations_remove = function(){
erpnext.bom.set_operation(doc);
}
@ -84,7 +84,7 @@ var get_bom_material_detail= function(doc, cdt, cdn) {
callback: function(r) {
d = locals[cdt][cdn];
$.extend(d, r.message);
refresh_field("bom_materials");
refresh_field("items");
doc = locals[doc.doctype][doc.name];
erpnext.bom.calculate_rm_cost(doc);
erpnext.bom.calculate_total(doc);
@ -111,7 +111,7 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
}
erpnext.bom.calculate_op_cost = function(doc) {
var op = doc.bom_operations || [];
var op = doc.operations || [];
doc.operating_cost = 0.0;
for(var i=0;i<op.length;i++) {
operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
@ -123,13 +123,13 @@ erpnext.bom.calculate_op_cost = function(doc) {
}
erpnext.bom.calculate_rm_cost = function(doc) {
var rm = doc.bom_materials || [];
var rm = doc.items || [];
total_rm_cost = 0;
for(var i=0;i<rm.length;i++) {
amt = flt(rm[i].rate) * flt(rm[i].qty);
set_multiple('BOM Item',rm[i].name, {'amount': amt}, 'bom_materials');
set_multiple('BOM Item',rm[i].name, {'amount': amt}, 'items');
set_multiple('BOM Item',rm[i].name,
{'qty_consumed_per_unit': flt(rm[i].qty)/flt(doc.quantity)}, 'bom_materials');
{'qty_consumed_per_unit': flt(rm[i].qty)/flt(doc.quantity)}, 'items');
total_rm_cost += amt;
}
cur_frm.set_value("raw_material_cost", total_rm_cost);
@ -157,7 +157,7 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
}
}
cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {
cur_frm.fields_dict['items'].grid.get_field('item_code').get_query = function(doc) {
return{
query: "erpnext.controllers.queries.item_query",
filters: {
@ -166,7 +166,7 @@ cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = fun
}
}
cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc, cdt, cdn) {
cur_frm.fields_dict['items'].grid.get_field('bom_no').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return{
filters:{

View File

@ -63,7 +63,7 @@ class BOM(Document):
frappe.throw(_("Raw material cannot be same as main Item"))
def set_bom_material_details(self):
for item in self.get("bom_materials"):
for item in self.get("items"):
ret = self.get_bom_material_detail({"item_code": item.item_code, "bom_no": item.bom_no,
"qty": item.qty})
@ -117,7 +117,7 @@ class BOM(Document):
if self.docstatus == 2:
return
for d in self.get("bom_materials"):
for d in self.get("items"):
rate = self.get_bom_material_detail({'item_code': d.item_code, 'bom_no': d.bom_no,
'qty': d.qty})["rate"]
if rate:
@ -178,8 +178,8 @@ class BOM(Document):
def clear_operations(self):
if not self.with_operations:
self.set('bom_operations', [])
for d in self.get("bom_materials"):
self.set('operations', [])
for d in self.get("items"):
d.operation = None
def validate_main_item(self):
@ -195,7 +195,7 @@ class BOM(Document):
def validate_materials(self):
""" Validate raw material entries """
check_list = []
for m in self.get('bom_materials'):
for m in self.get('items'):
if m.bom_no:
validate_bom_no(m.item_code, m.bom_no)
@ -262,7 +262,7 @@ class BOM(Document):
def calculate_op_cost(self):
"""Update workstation rate and calculates totals"""
self.operating_cost = 0
for d in self.get('bom_operations'):
for d in self.get('operations'):
if d.workstation:
if not d.hour_rate:
d.hour_rate = flt(frappe.db.get_value("Workstation", d.workstation, "hour_rate"))
@ -275,7 +275,7 @@ class BOM(Document):
def calculate_rm_cost(self):
"""Fetch RM rate as per today's valuation rate and calculate totals"""
total_rm_cost = 0
for d in self.get('bom_materials'):
for d in self.get('items'):
if d.bom_no:
d.rate = self.get_bom_unitcost(d.bom_no)
d.amount = flt(d.rate, self.precision("rate", d)) * flt(d.qty, self.precision("qty", d))
@ -292,7 +292,7 @@ class BOM(Document):
def get_exploded_items(self):
""" Get all raw materials including items from child bom"""
self.cur_exploded_items = {}
for d in self.get('bom_materials'):
for d in self.get('items'):
if d.bom_no:
self.get_child_exploded_items(d.bom_no, d.qty)
else:
@ -331,9 +331,9 @@ class BOM(Document):
def add_exploded_items(self):
"Add items to Flat BOM table"
frappe.db.sql("""delete from `tabBOM Explosion Item` where parent=%s""", self.name)
self.set('flat_bom_details', [])
self.set('exploded_items', [])
for d in self.cur_exploded_items:
ch = self.append('flat_bom_details', {})
ch = self.append('exploded_items', {})
for i in self.cur_exploded_items[d].keys():
ch.set(i, self.cur_exploded_items[d][i])
ch.amount = flt(ch.qty) * flt(ch.rate)

View File

@ -13,17 +13,17 @@ class TestBOM(unittest.TestCase):
def test_get_items(self):
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
items_dict = get_bom_items_as_dict(bom="BOM/_Test FG Item 2/001", qty=1, fetch_exploded=0)
self.assertTrue(test_records[2]["bom_materials"][0]["item_code"] in items_dict)
self.assertTrue(test_records[2]["bom_materials"][1]["item_code"] in items_dict)
self.assertTrue(test_records[2]["items"][0]["item_code"] in items_dict)
self.assertTrue(test_records[2]["items"][1]["item_code"] in items_dict)
self.assertEquals(len(items_dict.values()), 2)
def test_get_items_exploded(self):
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
items_dict = get_bom_items_as_dict(bom="BOM/_Test FG Item 2/001", qty=1, fetch_exploded=1)
self.assertTrue(test_records[2]["bom_materials"][0]["item_code"] in items_dict)
self.assertFalse(test_records[2]["bom_materials"][1]["item_code"] in items_dict)
self.assertTrue(test_records[0]["bom_materials"][0]["item_code"] in items_dict)
self.assertTrue(test_records[0]["bom_materials"][1]["item_code"] in items_dict)
self.assertTrue(test_records[2]["items"][0]["item_code"] in items_dict)
self.assertFalse(test_records[2]["items"][1]["item_code"] in items_dict)
self.assertTrue(test_records[0]["items"][0]["item_code"] in items_dict)
self.assertTrue(test_records[0]["items"][1]["item_code"] in items_dict)
self.assertEquals(len(items_dict.values()), 3)
def test_get_items_list(self):

Some files were not shown because too many files have changed in this diff Show More