Compare commits

..

28 Commits

Author SHA1 Message Date
Pratik Vyas
815cb8959a Merge branch 'develop' 2015-05-20 16:35:40 +05:30
Pratik Vyas
38937ecd3c bumped to version 5.0.6 2015-05-20 17:05:40 +06:00
Nabin Hait
521aa2e94a Update party_model.py 2015-05-20 14:39:39 +05:30
Nabin Hait
390df6626b Merge pull request #3298 from nabinhait/develop
party model patch fix
2015-05-20 14:34:42 +05:30
Nabin Hait
a2d8585b07 party model patch fix 2015-05-20 14:32:54 +05:30
Pratik Vyas
84e658058b Merge branch 'develop' 2015-05-20 12:54:52 +05:30
Pratik Vyas
10e813b010 bumped to version 5.0.5 2015-05-20 13:24:52 +06:00
Nabin Hait
a7bd8ee34b Update utils.py 2015-05-20 12:53:04 +05:30
Pratik Vyas
90a51225a4 Merge branch 'develop' 2015-05-20 12:27:47 +05:30
Pratik Vyas
8980ce6052 bumped to version 5.0.4 2015-05-20 12:57:47 +06:00
Nabin Hait
c0f56de971 Merge pull request #3297 from nabinhait/develop
validate diabled fiscal year
2015-05-20 12:26:44 +05:30
Nabin Hait
8d50eb32c1 validate diabled fiscal year 2015-05-20 12:26:21 +05:30
Nabin Hait
50bbc99889 Merge pull request #3296 from nabinhait/develop
validate disabled fiscal year
2015-05-20 12:21:51 +05:30
Nabin Hait
0cf9469f86 validate disabled fiscal year 2015-05-19 18:44:02 +05:30
Pratik Vyas
d13db9cd84 Merge branch 'develop' 2015-05-19 17:33:00 +05:30
Pratik Vyas
07b3bf6417 bumped to version 5.0.3 2015-05-19 18:03:00 +06:00
Nabin Hait
25ea307b9f Merge pull request #3289 from nabinhait/develop
Multiple fixes
2015-05-19 17:10:54 +05:30
Nabin Hait
8252117fe5 set tax amount also in base currency after manipulation 2015-05-19 16:30:17 +05:30
Nabin Hait
c602396366 validation message improved 2015-05-19 16:30:16 +05:30
Nabin Hait
f59d3a4e07 conversion rate fixes 2015-05-19 16:30:16 +05:30
Pratik Vyas
1a1ba38e95 Merge branch 'develop' 2015-05-19 15:45:57 +05:30
Pratik Vyas
80a116ab19 bumped to version 5.0.2 2015-05-19 16:15:57 +06:00
Nabin Hait
6684c470c5 Merge pull request #3287 from rmehta/customer-fix
Customer fix
2015-05-19 15:33:06 +05:30
Pratik Vyas
b8252bca00 bumped to version 5.0.1 2015-05-19 13:47:43 +06:00
Pratik Vyas
129a0a4cae Fix merge mistakes 2015-05-19 13:12:00 +05:30
Pratik Vyas
803e998e9d Fix merge mistakes 2015-05-19 13:08:54 +05:30
Rushabh Mehta
476019a930 [fix] throw name error for duplicate group 2015-05-19 13:03:01 +05:30
Rushabh Mehta
5495bc54a5 [enhancement] default terms in company, fixes #3231 2015-05-19 13:03:01 +05:30
18 changed files with 78 additions and 118 deletions

View File

@@ -1,2 +1,2 @@
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = 'v5.0.0' __version__ = '5.0.6'

View File

@@ -71,12 +71,11 @@ def save_entries(gl_map, adv_adj, update_outstanding):
# check against budget # check against budget
validate_expense_against_budget(entry) validate_expense_against_budget(entry)
# update total debit / credit # update total debit / credit
total_debit += flt(entry.debit) total_debit += flt(entry.debit)
total_credit += flt(entry.credit) total_credit += flt(entry.credit)
validate_total_debit_credit(total_debit, total_credit) validate_total_debit_credit(total_debit, total_credit, gl_map)
def make_entry(args, adv_adj, update_outstanding): def make_entry(args, adv_adj, update_outstanding):
args.update({"doctype": "GL Entry"}) args.update({"doctype": "GL Entry"})
@@ -86,9 +85,9 @@ def make_entry(args, adv_adj, update_outstanding):
gle.run_method("on_update_with_args", adv_adj, update_outstanding) gle.run_method("on_update_with_args", adv_adj, update_outstanding)
gle.submit() gle.submit()
def validate_total_debit_credit(total_debit, total_credit): def validate_total_debit_credit(total_debit, total_credit, gl_map):
if abs(total_debit - total_credit) > 0.005: if abs(total_debit - total_credit) > 0.005:
frappe.throw(_("Debit and Credit not equal for this voucher. Difference is {0}.").format(total_debit - total_credit)) frappe.throw(_("Debit and Credit not equal for {0} #{1}. Difference is {2}.").format(gl_map[0].voucher_type, gl_map[0].voucher_no, total_debit - total_credit))
def validate_account_for_auto_accounting_for_stock(gl_map): def validate_account_for_auto_accounting_for_stock(gl_map):
if gl_map[0].voucher_type=="Journal Entry": if gl_map[0].voucher_type=="Journal Entry":

View File

@@ -224,20 +224,6 @@ def sort_root_accounts(roots):
roots.sort(compare_roots) roots.sort(compare_roots)
def sort_root_accounts(roots):
"""Sort root types as Asset, Liability, Equity, Income, Expense"""
def compare_roots(a, b):
if a.report_type != b.report_type and a.report_type == "Balance Sheet":
return -1
if a.root_type != b.root_type and a.root_type == "Asset":
return -1
if a.root_type == "Liability" and b.root_type == "Equity":
return -1
return 1
roots.sort(compare_roots)
def get_gl_entries(company, from_date, to_date, root_lft, root_rgt, ignore_closing_entries=False): def get_gl_entries(company, from_date, to_date, root_lft, root_rgt, ignore_closing_entries=False):
"""Returns a dict like { "account": [gl entries], ... }""" """Returns a dict like { "account": [gl entries], ... }"""
additional_conditions = [] additional_conditions = []

View File

@@ -18,11 +18,11 @@ def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, compan
def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verbose=1, company=None): def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verbose=1, company=None):
# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate) # if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
cond = "" cond = " ifnull(disabled, 0) = 0"
if fiscal_year: if fiscal_year:
cond = "fy.name = %(fiscal_year)s" cond += " and fy.name = %(fiscal_year)s"
else: else:
cond = "%(transaction_date)s >= fy.year_start_date and %(transaction_date)s <= fy.year_end_date" cond += " and %(transaction_date)s >= fy.year_start_date and %(transaction_date)s <= fy.year_end_date"
if company: if company:
cond += """ and (not exists(select name from `tabFiscal Year Company` fyc where fyc.parent = fy.name) cond += """ and (not exists(select name from `tabFiscal Year Company` fyc where fyc.parent = fy.name)
@@ -36,7 +36,7 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb
}) })
if not fy: if not fy:
error_msg = _("""{0} {1} not in any Fiscal Year. For more details check {2}.""").format(label, formatdate(transaction_date), "https://erpnext.com/kb/accounts/fiscal-year-error") error_msg = _("""{0} {1} not in any active Fiscal Year. For more details check {2}.""").format(label, formatdate(transaction_date), "https://erpnext.com/kb/accounts/fiscal-year-error")
if verbose==1: frappe.msgprint(error_msg) if verbose==1: frappe.msgprint(error_msg)
raise FiscalYearError, error_msg raise FiscalYearError, error_msg
return fy return fy
@@ -421,8 +421,3 @@ def get_outstanding_invoices(amount_query, account, party_type, party):
}) })
return all_outstanding_vouchers return all_outstanding_vouchers
@frappe.whitelist()
def get_letter_head(company):
return frappe.db.get_value("Company",company,"default_letter_head")

View File

@@ -283,6 +283,9 @@ class calculate_taxes_and_totals(object):
last_tax.tax_amount_after_discount_amount += diff last_tax.tax_amount_after_discount_amount += diff
last_tax.total += diff last_tax.total += diff
self._set_in_company_currency(last_tax,
["total", "tax_amount", "tax_amount_after_discount_amount"])
def calculate_totals(self): def calculate_totals(self):
self.doc.grand_total = flt(self.doc.get("taxes")[-1].total self.doc.grand_total = flt(self.doc.get("taxes")[-1].total
if self.doc.get("taxes") else self.doc.net_total) if self.doc.get("taxes") else self.doc.net_total)

View File

@@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd. and Contributors"
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
app_icon = "icon-th" app_icon = "icon-th"
app_color = "#e74c3c" app_color = "#e74c3c"
app_version = "v5.0.0" app_version = "5.0.6"
error_report_email = "support@erpnext.com" error_report_email = "support@erpnext.com"

View File

@@ -96,15 +96,16 @@ def set_party_in_jv_and_gl_entry(receivable_payable_accounts):
frappe.db.commit() frappe.db.commit()
def delete_individual_party_account(): def delete_individual_party_account():
frappe.db.sql("""delete from `tabAccount` acc frappe.db.sql("""delete from `tabAccount`
where ifnull(acc.master_type, '') in ('Customer', 'Supplier') where ifnull(master_type, '') in ('Customer', 'Supplier')
and ifnull(acc.master_name, '') != '' and ifnull(master_name, '') != ''
and not exists(select gle.name from `tabGL Entry` gle where gle.account = acc.name)""") and not exists(select gle.name from `tabGL Entry` gle
where gle.account = tabAccount.name)""")
accounts_not_deleted = frappe.db.sql_list("""select name from `tabAccount` acc accounts_not_deleted = frappe.db.sql_list("""select tabAccount.name from `tabAccount`
where ifnull(acc.master_type, '') in ('Customer', 'Supplier') where ifnull(master_type, '') in ('Customer', 'Supplier')
and ifnull(acc.master_name, '') != '' and ifnull(master_name, '') != ''
and exists(select gle.name from `tabGL Entry` gle where gle.account = acc.name)""") and exists(select gle.name from `tabGL Entry` gle where gle.account = tabAccount.name)""")
if accounts_not_deleted: if accounts_not_deleted:
print "Accounts not deleted: " + "\n".join(accounts_not_deleted) print "Accounts not deleted: " + "\n".join(accounts_not_deleted)

View File

@@ -1,21 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
from erpnext.utilities.repost_stock import update_bin_qty, get_indented_qty
count=0
for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse
from `tabMaterial Request Item` where docstatus = 1"""):
try:
count += 1
update_bin_qty(item_code, warehouse, {
"indented_qty": get_indented_qty(item_code, warehouse),
})
if count % 200 == 0:
frappe.db.commit()
except:
frappe.db.rollback()

View File

@@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
for dt in ("Sales Order", "Purchase Order"):
orders_with_advance = frappe.db.sql("""select name from `tab{0}`
where docstatus < 2 and ifnull(advance_paid, 0) != 0""".format(dt), as_dict=1)
for order in orders_with_advance:
frappe.get_doc(dt, order.name).set_total_advance_paid()

View File

@@ -46,6 +46,9 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
var company_currency = this.get_company_currency(); var company_currency = this.get_company_currency();
if(!this.frm.doc.conversion_rate) { if(!this.frm.doc.conversion_rate) {
if(this.frm.doc.currency == company_currency) {
this.frm.set_value("conversion_rate", 1);
} else {
frappe.throw(repl('%(conversion_rate_label)s' + frappe.throw(repl('%(conversion_rate_label)s' +
__(' is mandatory. Maybe Currency Exchange record is not created for ') + __(' is mandatory. Maybe Currency Exchange record is not created for ') +
'%(from_currency)s' + __(" to ") + '%(to_currency)s', '%(from_currency)s' + __(" to ") + '%(to_currency)s',
@@ -55,6 +58,8 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
"to_currency": company_currency "to_currency": company_currency
})); }));
} }
}
}, },
calculate_item_values: function() { calculate_item_values: function() {
@@ -314,6 +319,8 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
discount_amount_loss, precision("tax_amount", tax)); discount_amount_loss, precision("tax_amount", tax));
tax.total = flt(tax.total + discount_amount_loss, precision("total", tax)); tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
this.set_in_company_currency(tax, ["total", "tax_amount_after_discount_amount"]);
}, },
manipulate_grand_total_for_inclusive_tax: function() { manipulate_grand_total_for_inclusive_tax: function() {
@@ -333,6 +340,9 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
last_tax.tax_amount += diff; last_tax.tax_amount += diff;
last_tax.tax_amount_after_discount += diff; last_tax.tax_amount_after_discount += diff;
last_tax.total += diff; last_tax.total += diff;
this.set_in_company_currency(last_tax,
["total", "tax_amount", "tax_amount_after_discount_amount"]);
} }
} }
} }

View File

@@ -75,7 +75,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
callback: function(r) { callback: function(r) {
if(!r.exc) { if(!r.exc) {
me.frm.set_value("taxes", r.message); me.frm.set_value("taxes", r.message);
me.calculate_taxes_and_totals();
} }
} }
}); });
@@ -194,6 +193,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
var fn = function() { var fn = function() {
if(me.frm.doc.company && me.frm.fields_dict.currency) { if(me.frm.doc.company && me.frm.fields_dict.currency) {
var company_currency = me.get_company_currency(); var company_currency = me.get_company_currency();
var company_doc = frappe.get_doc(":Company", me.frm.doc.company);
if (!me.frm.doc.currency) { if (!me.frm.doc.currency) {
me.frm.set_value("currency", company_currency); me.frm.set_value("currency", company_currency);
} }
@@ -204,6 +204,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if (me.frm.doc.price_list_currency == company_currency) { if (me.frm.doc.price_list_currency == company_currency) {
me.frm.set_value('plc_conversion_rate', 1.0); me.frm.set_value('plc_conversion_rate', 1.0);
} }
if (company_doc.default_letter_head) {
me.frm.set_value("letter_head", company_doc.default_letter_head);
}
if (company_doc.default_terms) {
me.frm.set_value("tc_name", company_doc.default_terms);
}
me.frm.script_manager.trigger("currency"); me.frm.script_manager.trigger("currency");
me.apply_pricing_rule(); me.apply_pricing_rule();
@@ -213,7 +219,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
else var date = this.frm.doc.transaction_date; else var date = this.frm.doc.transaction_date;
erpnext.get_fiscal_year(this.frm.doc.company, date, fn); erpnext.get_fiscal_year(this.frm.doc.company, date, fn);
erpnext.get_letter_head(this.frm.doc.company);
if(this.frm.doc.company) { if(this.frm.doc.company) {
erpnext.last_selected_company = this.frm.doc.company; erpnext.last_selected_company = this.frm.doc.company;

View File

@@ -105,21 +105,7 @@ $.extend(erpnext, {
d.show(); d.show();
}); });
},
get_letter_head: function(company) {
frappe.call({
type:"GET",
method: "erpnext.accounts.utils.get_letter_head",
args: {
"company": company
},
callback: function(r) {
if (!r.exe) cur_frm.set_value("letter_head", r.message);
} }
});
},
}); });

View File

@@ -76,7 +76,7 @@ class Customer(TransactionBase):
def validate_name_with_customer_group(self): def validate_name_with_customer_group(self):
if frappe.db.exists("Customer Group", self.name): if frappe.db.exists("Customer Group", self.name):
frappe.throw(_("A Customer Group exists with same name please change the Customer name or rename the Customer Group")) frappe.throw(_("A Customer Group exists with same name please change the Customer name or rename the Customer Group"), frappe.NameError)
def delete_customer_address(self): def delete_customer_address(self):
addresses = frappe.db.sql("""select name, lead from `tabAddress` addresses = frappe.db.sql("""select name, lead from `tabAddress`

View File

@@ -52,14 +52,6 @@
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{
"fieldname": "default_letter_head",
"fieldtype": "Link",
"label": "Default Letter Head",
"options": "Letter Head",
"permlevel": 0,
"precision": ""
},
{ {
"fieldname": "domain", "fieldname": "domain",
"fieldtype": "Select", "fieldtype": "Select",
@@ -72,9 +64,17 @@
"fieldname": "charts_section", "fieldname": "charts_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"label": "Country Settings", "label": "Default Values",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "default_letter_head",
"fieldtype": "Link",
"label": "Default Letter Head",
"options": "Letter Head",
"permlevel": 0,
"precision": ""
},
{ {
"fieldname": "default_holiday_list", "fieldname": "default_holiday_list",
"fieldtype": "Link", "fieldtype": "Link",
@@ -117,10 +117,18 @@
"options": "", "options": "",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "default_terms",
"fieldtype": "Link",
"label": "Default Terms",
"options": "Terms and Conditions",
"permlevel": 0,
"precision": ""
},
{ {
"fieldname": "default_settings", "fieldname": "default_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Default Settings", "label": "Accounts Settings",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
@@ -406,7 +414,7 @@
], ],
"icon": "icon-building", "icon": "icon-building",
"idx": 1, "idx": 1,
"modified": "2015-05-04 11:22:42.116328", "modified": "2015-05-19 02:00:41.055138",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Setup", "module": "Setup",
"name": "Company", "name": "Company",

View File

@@ -63,6 +63,8 @@ class Company(Document):
if self.default_currency: if self.default_currency:
frappe.db.set_value("Currency", self.default_currency, "enabled", 1) frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
frappe.clear_cache()
def install_country_fixtures(self): def install_country_fixtures(self):
if os.path.exists(os.path.join(os.path.dirname(__file__), "fixtures", self.country.lower())): if os.path.exists(os.path.join(os.path.dirname(__file__), "fixtures", self.country.lower())):
frappe.get_attr("erpnext.setup.doctype.company.fixtures.{0}.install".format(self.country.lower()))(self) frappe.get_attr("erpnext.setup.doctype.company.fixtures.{0}.install".format(self.country.lower()))(self)

View File

@@ -29,8 +29,9 @@ def boot_session(bootinfo):
bootinfo.setup_complete = frappe.db.sql("""select name from bootinfo.setup_complete = frappe.db.sql("""select name from
tabCompany limit 1""") and 'Yes' or 'No' tabCompany limit 1""") and 'Yes' or 'No'
bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center,
from `tabCompany`""", as_dict=1, update={"doctype":":Company"}) default_terms, default_letter_head from `tabCompany`""",
as_dict=1, update={"doctype":":Company"})
def load_country_and_currency(bootinfo): def load_country_and_currency(bootinfo):
country = frappe.db.get_default("country") country = frappe.db.get_default("country")

View File

@@ -11,8 +11,6 @@ def execute(filters=None):
float_precision = cint(frappe.db.get_default("float_precision")) or 3 float_precision = cint(frappe.db.get_default("float_precision")) or 3
float_precision = cint(frappe.db.get_default("float_precision")) or 3
columns = get_columns(filters) columns = get_columns(filters)
item_map = get_item_details(filters) item_map = get_item_details(filters)
iwb_map = get_item_warehouse_batch_map(filters, float_precision) iwb_map = get_item_warehouse_batch_map(filters, float_precision)

View File

@@ -1,6 +1,6 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
version = "v5.0.0" version = "5.0.6"
with open("requirements.txt", "r") as f: with open("requirements.txt", "r") as f:
install_requires = f.readlines() install_requires = f.readlines()