Merge branch 'develop'

This commit is contained in:
Pratik Vyas 2015-05-21 15:34:34 +05:30
commit 1686876b23
39 changed files with 1532 additions and 1469 deletions

View File

@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = '5.0.6'
__version__ = '5.0.7'

View File

@ -1,13 +1,13 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on("POS Setting", "onload", function(frm) {
frappe.ui.form.on("POS Profile", "onload", function(frm) {
frm.set_query("selling_price_list", function() {
return { filter: { selling: 1 } };
});
frm.call({
method: "erpnext.accounts.doctype.pos_setting.pos_setting.get_series",
method: "erpnext.accounts.doctype.pos_profile.pos_profile.get_series",
callback: function(r) {
if(!r.exc) {
set_field_options("naming_series", r.message);

View File

@ -0,0 +1,263 @@
{
"allow_rename": 0,
"autoname": "hash",
"creation": "2013-05-24 12:15:51",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"fieldname": "user",
"fieldtype": "Link",
"in_list_view": 1,
"label": "User",
"oldfieldname": "user",
"oldfieldtype": "Link",
"options": "User",
"permlevel": 0,
"read_only": 0
},
{
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Territory",
"oldfieldname": "territory",
"oldfieldtype": "Link",
"options": "Territory",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "naming_series",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",
"options": "[Select]",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "currency",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Currency",
"oldfieldname": "currency",
"oldfieldtype": "Select",
"options": "Currency",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Price List",
"oldfieldname": "price_list_name",
"oldfieldtype": "Select",
"options": "Price List",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
{
"default": "1",
"description": "Create Stock Ledger Entries when you submit a Sales Invoice",
"fieldname": "update_stock",
"fieldtype": "Check",
"label": "Update Stock",
"permlevel": 0,
"reqd": 0
},
{
"fieldname": "customer",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Customer",
"oldfieldname": "customer_account",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "cash_bank_account",
"fieldtype": "Link",
"label": "Cash/Bank Account",
"oldfieldname": "cash_bank_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "income_account",
"fieldtype": "Link",
"label": "Income Account",
"oldfieldname": "income_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)",
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
"label": "Expense Account",
"options": "Account",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "warehouse",
"fieldtype": "Link",
"label": "Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "taxes_and_charges",
"fieldtype": "Link",
"label": "Taxes and Charges",
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Template",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "write_off_account",
"fieldtype": "Link",
"label": "Write Off Account",
"options": "Account",
"permlevel": 0,
"precision": "",
"reqd": 1
},
{
"fieldname": "write_off_cost_center",
"fieldtype": "Link",
"label": "Write Off Cost Center",
"options": "Cost Center",
"permlevel": 0,
"precision": "",
"reqd": 1
},
{
"allow_on_submit": 1,
"fieldname": "letter_head",
"fieldtype": "Link",
"label": "Letter Head",
"oldfieldname": "letter_head",
"oldfieldtype": "Select",
"options": "Letter Head",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"fieldname": "tc_name",
"fieldtype": "Link",
"label": "Terms and Conditions",
"oldfieldname": "tc_name",
"oldfieldtype": "Link",
"options": "Terms and Conditions",
"permlevel": 0,
"read_only": 0
},
{
"allow_on_submit": 1,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"in_filter": 0,
"label": "Print Heading",
"oldfieldname": "select_print_heading",
"oldfieldtype": "Select",
"options": "Print Heading",
"permlevel": 0,
"read_only": 0
}
],
"icon": "icon-cog",
"idx": 1,
"modified": "2015-05-20 05:38:44.482696",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"share": 1,
"submit": 0,
"write": 1
},
{
"apply_user_permissions": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"submit": 0
}
],
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "user"
}

View File

@ -8,22 +8,22 @@ from frappe.utils import cint
from frappe.model.document import Document
class POSSetting(Document):
class POSProfile(Document):
def validate(self):
self.check_for_duplicate()
self.validate_expense_account()
self.validate_all_link_fields()
def check_for_duplicate(self):
res = frappe.db.sql("""select name, user from `tabPOS Setting`
res = frappe.db.sql("""select name, user from `tabPOS Profile`
where ifnull(user, '') = %s and name != %s and company = %s""",
(self.user, self.name, self.company))
if res:
if res[0][1]:
msgprint(_("POS Setting {0} already created for user: {1} and company {2}").format(res[0][0],
msgprint(_("POS Profile {0} already created for user: {1} and company {2}").format(res[0][0],
res[0][1], self.company), raise_exception=1)
else:
msgprint(_("Global POS Setting {0} already created for company {1}").format(res[0][0],
msgprint(_("Global POS Profile {0} already created for company {1}").format(res[0][0],
self.company), raise_exception=1)
def validate_expense_account(self):
@ -57,7 +57,7 @@ class POSSetting(Document):
condition = ""
pos_view_users = frappe.db.sql_list("""select user
from `tabPOS Setting` {0}""".format(condition))
from `tabPOS Profile` {0}""".format(condition))
for user in pos_view_users:
if user:

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals
@ -5,7 +6,7 @@ from __future__ import unicode_literals
import frappe
import unittest
test_records = frappe.get_test_records('POS Setting')
# test_records = frappe.get_test_records('POS Profile')
class TestPOSSetting(unittest.TestCase):
class TestPOSProfile(unittest.TestCase):
pass

View File

@ -1 +0,0 @@
Standard settings for Point of Sales (POS) type of Sales Invoice.

View File

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

View File

@ -1,263 +0,0 @@
{
"allow_rename": 0,
"autoname": "hash",
"creation": "2013-05-24 12:15:51",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"fieldname": "user",
"fieldtype": "Link",
"in_list_view": 1,
"label": "User",
"oldfieldname": "user",
"oldfieldtype": "Link",
"options": "User",
"permlevel": 0,
"read_only": 0
},
{
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Territory",
"oldfieldname": "territory",
"oldfieldtype": "Link",
"options": "Territory",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "naming_series",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",
"options": "[Select]",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "currency",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Currency",
"oldfieldname": "currency",
"oldfieldtype": "Select",
"options": "Currency",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Price List",
"oldfieldname": "price_list_name",
"oldfieldtype": "Select",
"options": "Price List",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
{
"default": "1",
"description": "Create Stock Ledger Entries when you submit a Sales Invoice",
"fieldname": "update_stock",
"fieldtype": "Check",
"label": "Update Stock",
"permlevel": 0,
"reqd": 0
},
{
"fieldname": "customer",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Customer",
"oldfieldname": "customer_account",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "cash_bank_account",
"fieldtype": "Link",
"label": "Cash/Bank Account",
"oldfieldname": "cash_bank_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "income_account",
"fieldtype": "Link",
"label": "Income Account",
"oldfieldname": "income_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)",
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
"label": "Expense Account",
"options": "Account",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "warehouse",
"fieldtype": "Link",
"label": "Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "taxes_and_charges",
"fieldtype": "Link",
"label": "Taxes and Charges",
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Template",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "write_off_account",
"fieldtype": "Link",
"label": "Write Off Account",
"options": "Account",
"permlevel": 0,
"precision": "",
"reqd": 1
},
{
"fieldname": "write_off_cost_center",
"fieldtype": "Link",
"label": "Write Off Cost Center",
"options": "Cost Center",
"permlevel": 0,
"precision": "",
"reqd": 1
},
{
"allow_on_submit": 1,
"fieldname": "letter_head",
"fieldtype": "Link",
"label": "Letter Head",
"oldfieldname": "letter_head",
"oldfieldtype": "Select",
"options": "Letter Head",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"fieldname": "tc_name",
"fieldtype": "Link",
"label": "Terms and Conditions",
"oldfieldname": "tc_name",
"oldfieldtype": "Link",
"options": "Terms and Conditions",
"permlevel": 0,
"read_only": 0
},
{
"allow_on_submit": 1,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"in_filter": 0,
"label": "Print Heading",
"oldfieldname": "select_print_heading",
"oldfieldtype": "Select",
"options": "Print Heading",
"permlevel": 0,
"read_only": 0
}
],
"icon": "icon-cog",
"idx": 1,
"modified": "2015-02-05 05:11:42.344181",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Setting",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"share": 1,
"submit": 0,
"write": 1
},
{
"apply_user_permissions": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"submit": 0
}
],
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "user"
}

View File

@ -611,7 +611,7 @@
{
"fieldname": "advances_section",
"fieldtype": "Section Break",
"label": "Advances",
"label": "",
"oldfieldtype": "Section Break",
"options": "icon-money",
"permlevel": 0,
@ -665,7 +665,7 @@
"depends_on": "supplier",
"fieldname": "contact_section",
"fieldtype": "Section Break",
"label": "Contact Info",
"label": "",
"options": "icon-bullhorn",
"permlevel": 0,
"read_only": 0
@ -939,7 +939,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2015-05-15 14:20:47.718194",
"modified": "2015-05-21 05:34:42.436924",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

File diff suppressed because it is too large Load Diff

View File

@ -160,12 +160,12 @@ class SalesInvoice(SellingController):
frappe.throw(_("Time Log Batch {0} must be 'Submitted'").format(d.time_log_batch))
def set_pos_fields(self, for_validate=False):
"""Set retail related fields from pos settings"""
"""Set retail related fields from POS Profiles"""
if cint(self.is_pos) != 1:
return
from erpnext.stock.get_item_details import get_pos_settings_item_details, get_pos_settings
pos = get_pos_settings(self.company)
from erpnext.stock.get_item_details import get_pos_profiles_item_details, get_pos_profiles
pos = get_pos_profiles(self.company)
if pos:
if not for_validate and not self.customer:
@ -184,7 +184,7 @@ class SalesInvoice(SellingController):
# set pos values in items
for item in self.get("items"):
if item.get('item_code'):
for fname, val in get_pos_settings_item_details(pos,
for fname, val in get_pos_profiles_item_details(pos,
frappe._dict(item.as_dict()), pos).items():
if (not for_validate) or (for_validate and not item.get(fname)):
@ -371,24 +371,24 @@ class SalesInvoice(SellingController):
def get_warehouse(self):
user_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
user_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile`
where ifnull(user,'') = %s and company = %s""", (frappe.session['user'], self.company))
warehouse = user_pos_setting[0][1] if user_pos_setting else None
warehouse = user_pos_profile[0][1] if user_pos_profile else None
if not warehouse:
global_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
global_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile`
where ifnull(user,'') = '' and company = %s""", self.company)
if global_pos_setting:
warehouse = global_pos_setting[0][1]
elif not user_pos_setting:
msgprint(_("POS Setting required to make POS Entry"), raise_exception=True)
if global_pos_profile:
warehouse = global_pos_profile[0][1]
elif not user_pos_profile:
msgprint(_("POS Profile required to make POS Entry"), raise_exception=True)
return warehouse
def on_update(self):
if cint(self.update_stock) == 1:
# Set default warehouse from pos setting
# Set default warehouse from POS Profile
if cint(self.is_pos) == 1:
w = self.get_warehouse()
if w:

View File

@ -462,7 +462,7 @@ class TestSalesInvoice(unittest.TestCase):
def test_pos_gl_entry_with_aii(self):
set_perpetual_inventory()
self.make_pos_setting()
self.make_pos_profile()
self._insert_purchase_receipt()
@ -517,19 +517,19 @@ class TestSalesInvoice(unittest.TestCase):
set_perpetual_inventory(0)
frappe.db.sql("delete from `tabPOS Setting`")
frappe.db.sql("delete from `tabPOS Profile`")
def make_pos_setting(self):
pos_setting = frappe.get_doc({
def make_pos_profile(self):
pos_profile = frappe.get_doc({
"cash_bank_account": "_Test Account Bank Account - _TC",
"company": "_Test Company",
"cost_center": "_Test Cost Center - _TC",
"currency": "INR",
"doctype": "POS Setting",
"doctype": "POS Profile",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"income_account": "Sales - _TC",
"name": "_Test POS Setting",
"naming_series": "_T-POS Setting-",
"name": "_Test POS Profile",
"naming_series": "_T-POS Profile-",
"selling_price_list": "_Test Price List",
"territory": "_Test Territory",
"warehouse": "_Test Warehouse - _TC",
@ -537,8 +537,8 @@ class TestSalesInvoice(unittest.TestCase):
"write_off_cost_center": "_Test Write Off Cost Center - _TC"
})
if not frappe.db.exists("POS Setting", "_Test POS Setting"):
pos_setting.insert()
if not frappe.db.exists("POS Profile", "_Test POS Profile"):
pos_profile.insert()
def test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self):
set_perpetual_inventory()

View File

@ -35,7 +35,7 @@ frappe.pages['pos'].on_page_load = function(wrapper) {
});
$.ajax({
url: "/api/resource/POS Setting",
url: "/api/resource/POS Profile",
success: function(data) {
if(!data.data.length) {
page.main.find(".pos-setting-message").removeClass('hide');

View File

@ -29,7 +29,7 @@ def execute(filters=None):
def get_provisional_profit_loss(asset, liability, equity, period_list):
if asset and (liability or equity):
provisional_profit_loss = {
"account_name": _("Provisional Profit / Loss (Credit)"),
"account_name": "'" + _("Provisional Profit / Loss (Credit)") + "'",
"account": None,
"warn_if_negative": True
}

View File

@ -38,7 +38,7 @@ def execute(filters=None):
data += [
get_balance_row(_("System Balance"), balance_as_per_system),
[""]*len(columns),
["", _("Amounts not reflected in bank"), total_debit, total_credit, "", "", "", ""],
["", '"' + _("Amounts not reflected in bank") + '"', total_debit, total_credit, "", "", "", ""],
get_balance_row(_("Amounts not reflected in system"), amounts_not_reflected_in_system),
[""]*len(columns),
get_balance_row(_("Expected balance as per bank"), bank_bal)
@ -68,6 +68,6 @@ def get_entries(filters):
def get_balance_row(label, amount):
if amount > 0:
return ["", label, amount, 0, "", "", "", ""]
return ["", '"' + label + '"', amount, 0, "", "", "", ""]
else:
return ["", label, 0, abs(amount), "", "", "", ""]
return ["", '"' + label + '"', 0, abs(amount), "", "", "", ""]

View File

@ -146,7 +146,7 @@ def prepare_data(accounts, balance_must_be, period_list):
def add_total_row(out, balance_must_be, period_list):
row = {
"account_name": _("Total ({0})").format(balance_must_be),
"account_name": "'" + _("Total ({0})").format(balance_must_be) + "'",
"account": None
}
for period in period_list:
@ -207,7 +207,7 @@ def filter_accounts(accounts, depth=10):
add_to_list(None, 0)
return filtered_accounts, accounts_by_name
def sort_root_accounts(roots):
"""Sort root types as Asset, Liability, Equity, Income, Expense"""

View File

@ -108,30 +108,30 @@ def get_data_with_opening_closing(filters, account_details, gl_entries):
# Opening for filtered account
if filters.get("account"):
data += [get_balance_row("Opening", opening), {}]
data += [get_balance_row(_("Opening"), opening), {}]
for acc, acc_dict in gle_map.items():
if acc_dict.entries:
# Opening for individual ledger, if grouped by account
if filters.get("group_by_account"):
data.append(get_balance_row("Opening", acc_dict.opening))
data.append(get_balance_row(_("Opening"), acc_dict.opening))
data += acc_dict.entries
# Totals and closing for individual ledger, if grouped by account
if filters.get("group_by_account"):
data += [{"account": "Totals", "debit": acc_dict.total_debit,
data += [{"account": "'" + _("Totals") + "'", "debit": acc_dict.total_debit,
"credit": acc_dict.total_credit},
get_balance_row("Closing (Opening + Totals)",
get_balance_row(_("Closing (Opening + Totals)"),
(acc_dict.opening + acc_dict.total_debit - acc_dict.total_credit)), {}]
# Total debit and credit between from and to date
if total_debit or total_credit:
data.append({"account": "Totals", "debit": total_debit, "credit": total_credit})
data.append({"account": "'" + _("Totals") + "'", "debit": total_debit, "credit": total_credit})
# Closing for filtered account
if filters.get("account"):
data.append(get_balance_row("Closing (Opening + Totals)",
data.append(get_balance_row(_("Closing (Opening + Totals)"),
(opening + total_debit - total_credit)))
return data
@ -168,7 +168,7 @@ def get_accountwise_gle(filters, gl_entries, gle_map):
def get_balance_row(label, balance):
return {
"account": label,
"account": "'" + label + "'",
"debit": balance if balance > 0 else 0,
"credit": -1*balance if balance < 0 else 0,
}

View File

@ -27,7 +27,7 @@ def execute(filters=None):
def get_net_profit_loss(income, expense, period_list):
if income and expense:
net_profit_loss = {
"account_name": _("Net Profit / Loss"),
"account_name": "'" + _("Net Profit / Loss") + "'",
"account": None,
"warn_if_negative": True
}

View File

@ -0,0 +1 @@
- POS Setting is renamed to POS Profile

View File

@ -113,7 +113,7 @@ def get_data():
},
{
"type": "doctype",
"name": "POS Setting",
"name": "POS Profile",
"label": _("Point-of-Sale Setting"),
"description": _("Rules to calculate shipping amount for a sale")
},

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_icon = "icon-th"
app_color = "#e74c3c"
app_version = "5.0.6"
app_version = "5.0.7"
error_report_email = "support@erpnext.com"

View File

@ -35,7 +35,6 @@ cur_frm.cscript.hour_rate = function(doc, dt, dn) {
}
cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate;
cur_frm.cscript.fixed_cycle_cost = cur_frm.cscript.hour_rate;
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
get_bom_material_detail(doc, cdt, cdn);

View File

@ -35,18 +35,20 @@ frappe.ui.form.on("Production Order", "additional_operating_cost", function(frm)
frappe.ui.form.on("Production Order Operation", "workstation", function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.call({
"method": "frappe.client.get",
args: {
doctype: "Workstation",
name: d.workstation
},
callback: function (data) {
frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate);
erpnext.production_order.calculate_cost(frm.doc);
erpnext.production_order.calculate_total_cost(frm);
}
})
if (d.workstation) {
frappe.call({
"method": "frappe.client.get",
args: {
doctype: "Workstation",
name: d.workstation
},
callback: function (data) {
frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate);
erpnext.production_order.calculate_cost(frm.doc);
erpnext.production_order.calculate_total_cost(frm);
}
})
}
});
frappe.ui.form.on("Production Order Operation", "time_in_mins", function(frm, cdt, cdn) {

View File

@ -33,7 +33,7 @@
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@ -293,7 +293,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-04-22 03:25:18.542350",
"modified": "2015-05-21 13:46:27.730392",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order Operation",

View File

@ -155,3 +155,5 @@ erpnext.patches.v5_0.reclculate_planned_operating_cost_in_production_order
erpnext.patches.v5_0.repost_requested_qty
erpnext.patches.v5_0.fix_taxes_and_totals_in_party_currency
erpnext.patches.v5_0.update_tax_amount_after_discount_in_purchase_cycle
erpnext.patches.v5_0.rename_pos_setting
erpnext.patches.v5_0.update_operation_description

View File

@ -0,0 +1,5 @@
import frappe
def execute():
if frappe.db.table_exists("POS Setting"):
frappe.rename_doc("DocType", "POS Setting", "POS Profile")

View File

@ -0,0 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import frappe.permissions
def execute():
if "opn_description" in frappe.db.get_table_columns("BOM Operation"):
frappe.db.sql("""update `tabBOM Operation` set description = opn_description
where ifnull(description, '') = ''""")

View File

@ -66,18 +66,22 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
apply_default_taxes: function() {
var me = this;
return frappe.call({
method: "erpnext.controllers.accounts_controller.get_default_taxes_and_charges",
args: {
"master_doctype": frappe.meta.get_docfield(me.frm.doc.doctype, "taxes_and_charges",
me.frm.doc.name).options
},
callback: function(r) {
if(!r.exc) {
me.frm.set_value("taxes", r.message);
var taxes_and_charges_field = frappe.meta.get_docfield(me.frm.doc.doctype, "taxes_and_charges",
me.frm.doc.name);
if(taxes_and_charges_field) {
frappe.call({
method: "erpnext.controllers.accounts_controller.get_default_taxes_and_charges",
args: {
"master_doctype": taxes_and_charges_field.options
},
callback: function(r) {
if(!r.exc) {
me.frm.set_value("taxes", r.message);
}
}
}
});
});
}
},
setup_sms: function() {

View File

@ -117,7 +117,7 @@ erpnext.feature_setup.feature_dict = {
'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
},
'POS Setting': {'fields':['conversion_rate','currency']},
'POS Profile': {'fields':['conversion_rate','currency']},
'Quotation': {
'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],

View File

@ -34,8 +34,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
source_doctype: "Opportunity",
get_query_filters: {
docstatus: 1,
status: "Submitted",
status: ["not in", ["Lost", "Closed"]],
enquiry_type: cur_frm.doc.order_type,
customer: cur_frm.doc.customer || undefined,
lead: cur_frm.doc.lead || undefined,

View File

@ -21,6 +21,7 @@ class NamingSeries(Document):
prefixes = ""
for d in doctypes:
options = ""
try:
options = self.get_options(d)
except frappe.DoesNotExistError:

View File

@ -154,13 +154,19 @@ class Item(WebsiteGenerator):
if self.variant_of:
frappe.throw(_("Item cannot be a variant of a variant"))
variants = []
variants, attributes = [], {}
for d in self.variants:
key = (d.item_attribute, d.item_attribute_value)
if key in variants:
frappe.throw(_("{0} {1} is entered more than once in Item Variants table")
.format(d.item_attribute, d.item_attribute_value), DuplicateVariant)
variants.append(key)
attributes.setdefault(d.item_attribute, [t.attribute_value for t in frappe.db.get_all("Item Attribute Value",
fields=["attribute_value"], filters={"parent": d.item_attribute })])
if d.item_attribute_value not in attributes.get(d.item_attribute):
frappe.throw(_("Attribute value {0} does not exist in Item Attribute Master.").format(d.item_attribute_value))
else:
frappe.throw(_("Please enter atleast one attribute row in Item Variants table"))

View File

@ -43,7 +43,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
return erpnext.queries.item({is_stock_item: "Yes"});
}
};
this.frm.set_query("purchase_order", function() {
return {
"filters": {
@ -68,8 +68,13 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
onload_post_render: function() {
var me = this;
cur_frm.get_field("items").grid.set_multiple_add("item_code", "qty");
this.set_default_account();
this.set_default_account(function() {
if(me.frm.doc.__islocal && me.frm.doc.company && !me.frm.doc.amended_from) {
cur_frm.script_manager.trigger("company");
}
});
},
refresh: function() {
@ -102,7 +107,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
this.clean_up();
},
set_default_account: function() {
set_default_account: function(callback) {
var me = this;
if(cint(frappe.defaults.get_default("auto_accounting_for_stock")) && this.frm.doc.company) {
@ -122,6 +127,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
$.each(me.frm.doc.items || [], function(i, d) {
if(!d.expense_account) d.expense_account = r.message;
});
if(callback) callback();
}
}
});
@ -440,9 +446,9 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
callback: function(r) {
if(r.message) {
$.each(r.message, function(k, v) {
frappe.model.set_value(cdt, cdn, k, v);
d[k] = v;
});
refresh_field('image_view', d.name, 'items');
refresh_field('items');
}
}
});
@ -521,7 +527,14 @@ cur_frm.fields_dict.supplier.get_query = function(doc, cdt, cdn) {
}
cur_frm.cscript.company = function(doc, cdt, cdn) {
erpnext.get_fiscal_year(doc.company, doc.posting_date);
if(doc.company) {
erpnext.get_fiscal_year(doc.company, doc.posting_date, function() {
var company_doc = frappe.get_doc(":Company", doc.company);
if(company_doc.default_letter_head) {
cur_frm.set_value("letter_head", company_doc.default_letter_head);
}
});
}
}
cur_frm.cscript.posting_date = function(doc, cdt, cdn){

View File

@ -632,6 +632,14 @@
"reqd": 0,
"search_index": 0
},
{
"fieldname": "letter_head",
"fieldtype": "Link",
"label": "Letter Head",
"options": "Letter Head",
"permlevel": 0,
"precision": ""
},
{
"allow_on_submit": 0,
"fieldname": "amended_from",
@ -670,7 +678,7 @@
"is_submittable": 1,
"issingle": 0,
"max_attachments": 0,
"modified": "2015-03-03 18:09:12.035606",
"modified": "2015-05-20 07:58:59.025553",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",

View File

@ -51,7 +51,7 @@ def get_item_details(args):
get_price_list_rate(args, item_doc, out)
if args.transaction_type == "selling" and cint(args.is_pos):
out.update(get_pos_settings_item_details(args.company, args))
out.update(get_pos_profiles_item_details(args.company, args))
# update args with out, if key or value not exists
for key, value in out.iteritems():
@ -267,16 +267,16 @@ def get_party_item_code(args, item_doc, out):
item_supplier = item_doc.get("supplier_items", {"supplier": args.supplier})
out.supplier_part_no = item_supplier[0].supplier_part_no if item_supplier else None
def get_pos_settings_item_details(company, args, pos_settings=None):
def get_pos_profiles_item_details(company, args, pos_profiles=None):
res = frappe._dict()
if not pos_settings:
pos_settings = get_pos_settings(company)
if not pos_profiles:
pos_profiles = get_pos_profiles(company)
if pos_settings:
if pos_profiles:
for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"):
if not args.get(fieldname) and pos_settings.get(fieldname):
res[fieldname] = pos_settings.get(fieldname)
if not args.get(fieldname) and pos_profiles.get(fieldname):
res[fieldname] = pos_profiles.get(fieldname)
if res.get("warehouse"):
res.actual_qty = get_available_qty(args.item_code,
@ -284,15 +284,15 @@ def get_pos_settings_item_details(company, args, pos_settings=None):
return res
def get_pos_settings(company):
pos_settings = frappe.db.sql("""select * from `tabPOS Setting` where user = %s
def get_pos_profiles(company):
pos_profiles = frappe.db.sql("""select * from `tabPOS Profile` where user = %s
and company = %s""", (frappe.session['user'], company), as_dict=1)
if not pos_settings:
pos_settings = frappe.db.sql("""select * from `tabPOS Setting`
if not pos_profiles:
pos_profiles = frappe.db.sql("""select * from `tabPOS Profile`
where ifnull(user,'') = '' and company = %s""", company, as_dict=1)
return pos_settings and pos_settings[0] or None
return pos_profiles and pos_profiles[0] or None
def get_serial_nos_by_fifo(args, item_doc):

View File

@ -69,7 +69,18 @@
"reqd": 1
},
{
"depends_on": "eval:doc.__islocal",
"fieldname": "fold",
"fieldtype": "Fold",
"permlevel": 0
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
{
"depends_on": "",
"fieldname": "description",
"fieldtype": "Text",
"label": "Description",
@ -79,27 +90,38 @@
"reqd": 0
},
{
"fieldname": "fold",
"fieldtype": "Fold",
"fieldname": "column_break_9",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "resolution_date",
"fieldtype": "Datetime",
"in_filter": 0,
"label": "Resolution Date",
"no_copy": 1,
"oldfieldname": "resolution_date",
"oldfieldtype": "Date",
"permlevel": 0,
"read_only": 1,
"search_index": 0
},
{
"fieldname": "first_responded_on",
"fieldtype": "Datetime",
"label": "First Responded On",
"permlevel": 0
},
{
"fieldname": "additional_info",
"fieldtype": "Section Break",
"label": "Reference",
"label": "",
"options": "icon-pushpin",
"permlevel": 0,
"read_only": 1
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 1,
"width": "50%"
},
{
"fieldname": "lead",
"fieldtype": "Link",
@ -114,6 +136,12 @@
"options": "Contact",
"permlevel": 0
},
{
"fieldname": "column_break_16",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "customer",
"fieldtype": "Link",
@ -140,6 +168,31 @@
"reqd": 0,
"search_index": 0
},
{
"fieldname": "section_break_19",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "resolution_details",
"fieldtype": "Small Text",
"label": "Resolution Details",
"no_copy": 1,
"oldfieldname": "resolution_details",
"oldfieldtype": "Text",
"permlevel": 0,
"read_only": 0
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 1
},
{
"default": "Today",
"fieldname": "opening_date",
@ -170,44 +223,6 @@
"print_hide": 1,
"reqd": 0
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "first_responded_on",
"fieldtype": "Datetime",
"label": "First Responded On",
"permlevel": 0
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "resolution_date",
"fieldtype": "Datetime",
"in_filter": 0,
"label": "Resolution Date",
"no_copy": 1,
"oldfieldname": "resolution_date",
"oldfieldtype": "Date",
"permlevel": 0,
"read_only": 1,
"search_index": 0
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "resolution_details",
"fieldtype": "Small Text",
"label": "Resolution Details",
"no_copy": 1,
"oldfieldname": "resolution_details",
"oldfieldtype": "Text",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "content_type",
"fieldtype": "Data",
@ -218,7 +233,7 @@
],
"icon": "icon-ticket",
"idx": 1,
"modified": "2015-04-02 22:06:02.684820",
"modified": "2015-05-20 07:16:53.673114",
"modified_by": "Administrator",
"module": "Support",
"name": "Issue",

View File

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