Merge branch 'develop' of https://github.com/frappe/erpnext into develop
This commit is contained in:
commit
eabd09da40
@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '12.1.6'
|
__version__ = '12.1.8'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, json
|
import frappe, json
|
||||||
|
from frappe import _
|
||||||
from frappe.utils import add_to_date, date_diff, getdate, nowdate, get_last_day, formatdate
|
from frappe.utils import add_to_date, date_diff, getdate, nowdate, get_last_day, formatdate
|
||||||
from erpnext.accounts.report.general_ledger.general_ledger import execute
|
from erpnext.accounts.report.general_ledger.general_ledger import execute
|
||||||
from frappe.core.page.dashboard.dashboard import cache_source, get_from_date_from_timespan
|
from frappe.core.page.dashboard.dashboard import cache_source, get_from_date_from_timespan
|
||||||
@ -24,6 +25,9 @@ def get(chart_name = None, chart = None, no_cache = None, from_date = None, to_d
|
|||||||
account = filters.get("account")
|
account = filters.get("account")
|
||||||
company = filters.get("company")
|
company = filters.get("company")
|
||||||
|
|
||||||
|
if not account and chart:
|
||||||
|
frappe.throw(_("Account is not set for the dashboard chart {0}").format(chart))
|
||||||
|
|
||||||
if not to_date:
|
if not to_date:
|
||||||
to_date = nowdate()
|
to_date = nowdate()
|
||||||
if not from_date:
|
if not from_date:
|
||||||
|
@ -69,7 +69,7 @@ def get_columns(filters):
|
|||||||
for year in fiscal_year:
|
for year in fiscal_year:
|
||||||
for from_date, to_date in get_period_date_ranges(filters["period"], year[0]):
|
for from_date, to_date in get_period_date_ranges(filters["period"], year[0]):
|
||||||
if filters["period"] == "Yearly":
|
if filters["period"] == "Yearly":
|
||||||
labels = [_("Budget") + " " + str(year[0]), _("Actual ") + " " + str(year[0]), _("Varaiance ") + " " + str(year[0])]
|
labels = [_("Budget") + " " + str(year[0]), _("Actual ") + " " + str(year[0]), _("Variance ") + " " + str(year[0])]
|
||||||
for label in labels:
|
for label in labels:
|
||||||
columns.append(label+":Float:150")
|
columns.append(label+":Float:150")
|
||||||
else:
|
else:
|
||||||
|
@ -39,7 +39,7 @@ def get_message(exception):
|
|||||||
if hasattr(exception, 'message'):
|
if hasattr(exception, 'message'):
|
||||||
message = exception.message
|
message = exception.message
|
||||||
elif hasattr(exception, '__str__'):
|
elif hasattr(exception, '__str__'):
|
||||||
message = e.__str__()
|
message = exception.__str__()
|
||||||
else:
|
else:
|
||||||
message = "Something went wrong while syncing"
|
message = "Something went wrong while syncing"
|
||||||
return message
|
return message
|
||||||
|
@ -43,7 +43,7 @@ class ShopifySettings(Document):
|
|||||||
d.raise_for_status()
|
d.raise_for_status()
|
||||||
self.update_webhook_table(method, d.json())
|
self.update_webhook_table(method, d.json())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
make_shopify_log(status="Warning", message=e, exception=False)
|
make_shopify_log(status="Warning", exception=e, rollback=True)
|
||||||
|
|
||||||
def unregister_webhooks(self):
|
def unregister_webhooks(self):
|
||||||
session = get_request_session()
|
session = get_request_session()
|
||||||
|
@ -640,3 +640,4 @@ erpnext.patches.v12_0.create_default_energy_point_rules
|
|||||||
erpnext.patches.v12_0.set_produced_qty_field_in_sales_order_for_work_order
|
erpnext.patches.v12_0.set_produced_qty_field_in_sales_order_for_work_order
|
||||||
erpnext.patches.v12_0.generate_leave_ledger_entries
|
erpnext.patches.v12_0.generate_leave_ledger_entries
|
||||||
erpnext.patches.v12_0.set_default_shopify_app_type
|
erpnext.patches.v12_0.set_default_shopify_app_type
|
||||||
|
erpnext.patches.v12_0.replace_accounting_with_accounts_in_home_settings
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.db.sql("""UPDATE `tabUser` SET `home_settings` = REPLACE(`home_settings`, 'Accounting', 'Accounts')""")
|
||||||
|
frappe.cache().delete_key('home_settings')
|
@ -205,7 +205,7 @@ class SalesOrder(SellingController):
|
|||||||
if self.coupon_code:
|
if self.coupon_code:
|
||||||
from erpnext.accounts.doctype.pricing_rule.utils import update_coupon_code_count
|
from erpnext.accounts.doctype.pricing_rule.utils import update_coupon_code_count
|
||||||
update_coupon_code_count(self.coupon_code,'cancelled')
|
update_coupon_code_count(self.coupon_code,'cancelled')
|
||||||
|
|
||||||
def update_project(self):
|
def update_project(self):
|
||||||
if frappe.db.get_single_value('Selling Settings', 'sales_update_frequency') != "Each Transaction":
|
if frappe.db.get_single_value('Selling Settings', 'sales_update_frequency') != "Each Transaction":
|
||||||
return
|
return
|
||||||
@ -661,12 +661,15 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
|
|||||||
|
|
||||||
if source_parent.project:
|
if source_parent.project:
|
||||||
target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center")
|
target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center")
|
||||||
if not target.cost_center and target.item_code:
|
if target.item_code:
|
||||||
item = get_item_defaults(target.item_code, source_parent.company)
|
item = get_item_defaults(target.item_code, source_parent.company)
|
||||||
item_group = get_item_group_defaults(target.item_code, source_parent.company)
|
item_group = get_item_group_defaults(target.item_code, source_parent.company)
|
||||||
target.cost_center = item.get("selling_cost_center") \
|
cost_center = item.get("selling_cost_center") \
|
||||||
or item_group.get("selling_cost_center")
|
or item_group.get("selling_cost_center")
|
||||||
|
|
||||||
|
if cost_center:
|
||||||
|
target.cost_center = cost_center
|
||||||
|
|
||||||
doclist = get_mapped_doc("Sales Order", source_name, {
|
doclist = get_mapped_doc("Sales Order", source_name, {
|
||||||
"Sales Order": {
|
"Sales Order": {
|
||||||
"doctype": "Sales Invoice",
|
"doctype": "Sales Invoice",
|
||||||
|
@ -33,6 +33,10 @@ class Company(NestedSet):
|
|||||||
return exists
|
return exists
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
self.update_default_account = False
|
||||||
|
if self.is_new():
|
||||||
|
self.update_default_account = True
|
||||||
|
|
||||||
self.validate_abbr()
|
self.validate_abbr()
|
||||||
self.validate_default_accounts()
|
self.validate_default_accounts()
|
||||||
self.validate_currency()
|
self.validate_currency()
|
||||||
@ -203,8 +207,8 @@ class Company(NestedSet):
|
|||||||
"default_expense_account": "Cost of Goods Sold"
|
"default_expense_account": "Cost of Goods Sold"
|
||||||
})
|
})
|
||||||
|
|
||||||
for default_account in default_accounts:
|
if self.update_default_account or frappe.flags.in_test:
|
||||||
if self.is_new() or frappe.flags.in_test or frappe.flags.in_demo:
|
for default_account in default_accounts:
|
||||||
self._set_default_account(default_account, default_accounts.get(default_account))
|
self._set_default_account(default_account, default_accounts.get(default_account))
|
||||||
|
|
||||||
if not self.default_income_account:
|
if not self.default_income_account:
|
||||||
|
@ -6,9 +6,9 @@ frappe.listview_settings['Delivery Note'] = {
|
|||||||
return [__("Return"), "darkgrey", "is_return,=,Yes"];
|
return [__("Return"), "darkgrey", "is_return,=,Yes"];
|
||||||
} else if (doc.status === "Closed") {
|
} else if (doc.status === "Closed") {
|
||||||
return [__("Closed"), "green", "status,=,Closed"];
|
return [__("Closed"), "green", "status,=,Closed"];
|
||||||
} else if (doc.grand_total !== 0 && flt(doc.per_billed, 2) < 100) {
|
} else if (flt(doc.per_billed, 2) < 100) {
|
||||||
return [__("To Bill"), "orange", "per_billed,<,100"];
|
return [__("To Bill"), "orange", "per_billed,<,100"];
|
||||||
} else if (doc.grand_total === 0 || flt(doc.per_billed, 2) == 100) {
|
} else if (flt(doc.per_billed, 2) == 100) {
|
||||||
return [__("Completed"), "green", "per_billed,=,100"];
|
return [__("Completed"), "green", "per_billed,=,100"];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -241,7 +241,9 @@ class StockEntry(StockController):
|
|||||||
|
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
if not d.expense_account:
|
if not d.expense_account:
|
||||||
frappe.throw(_("Please enter Difference Account"))
|
frappe.throw(_("Please enter <b>Difference Account</b> or set default <b>Stock Adjustment Account</b> for company {0}")
|
||||||
|
.format(frappe.bold(self.company)))
|
||||||
|
|
||||||
elif self.is_opening == "Yes" and frappe.db.get_value("Account", d.expense_account, "report_type") == "Profit and Loss":
|
elif self.is_opening == "Yes" and frappe.db.get_value("Account", d.expense_account, "report_type") == "Profit and Loss":
|
||||||
frappe.throw(_("Difference Account must be a Asset/Liability type account, since this Stock Entry is an Opening Entry"), OpeningEntryAccountError)
|
frappe.throw(_("Difference Account must be a Asset/Liability type account, since this Stock Entry is an Opening Entry"), OpeningEntryAccountError)
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ class Issue(Document):
|
|||||||
return "{0}: {1}".format(_(self.status), self.subject)
|
return "{0}: {1}".format(_(self.status), self.subject)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.flags.ignore_disabled = 1
|
|
||||||
if self.is_new() and self.via_customer_portal:
|
if self.is_new() and self.via_customer_portal:
|
||||||
self.flags.create_communication = True
|
self.flags.create_communication = True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user