Compare commits

...

78 Commits

Author SHA1 Message Date
Nabin Hait
d5d0b36973 Merge branch 'hotfix' 2017-02-16 14:37:49 +05:30
Nabin Hait
7677b56f7c bumped to version 7.2.20 2017-02-16 15:07:48 +06:00
Nabin Hait
b280398626 Merge pull request #7739 from rohitwaghchaure/payment_entry_currency_symbol_issue
[Fix] Payment Entry currency symbol issue
2017-02-16 14:21:24 +05:30
Nabin Hait
99c6c79834 Update payment_entry.js 2017-02-16 14:21:04 +05:30
Nabin Hait
3437a9a123 minor fix 2017-02-16 12:14:30 +05:30
Nabin Hait
6a2e138021 Merge pull request #7731 from nabinhait/hotfix
Check existing SO, PO and MR for enabling / disabling 'Is Stock Item' checkbox
2017-02-15 17:25:56 +05:30
Rohit Waghchaure
ff41c82c2b [Fix] Payment Entry currency symbol issue 2017-02-15 11:44:15 +05:30
Nabin Hait
99dfa3060a Check existing SO, PO and MR for disabling 'Is Stock Item' checkbox 2017-02-13 16:06:02 +05:30
Nabin Hait
89b6c47b2e Merge pull request #7712 from rohitwaghchaure/minor_fix_item_valuation_method
[Fix] Valuation method changing issue in the item
2017-02-13 15:42:22 +05:30
Nabin Hait
ec07d18222 Merge pull request #7716 from KanchanChauhan/apply-now-job
[Fix] Apply Now button redirect fixed for Job Opening
2017-02-13 15:42:02 +05:30
Kanchan Chauhan
1cd5e583ba [Fix] Apply Now button redirect fixed for Job Opening 2017-02-10 17:58:41 +05:30
Nabin Hait
bdd470a6d1 Update item.py 2017-02-10 17:12:48 +05:30
Rohit Waghchaure
2f09dc0e62 [Fix] Valuation method changing issue in the item 2017-02-10 15:29:45 +05:30
Nabin Hait
eee23eaf5c Merge pull request #7702 from mbauskar/hotfix
[minor] payment entry company trigger
2017-02-09 13:48:09 +05:30
mbauskar
d487bf77e1 [minor] payment entry company trigger 2017-02-09 12:57:25 +05:30
Nabin Hait
efd5eadfea Merge branch 'hotfix' 2017-02-08 11:32:47 +05:30
Nabin Hait
57e97c06e6 bumped to version 7.2.19 2017-02-08 12:02:47 +06:00
Nabin Hait
6f93cd5bd0 Merge pull request #7692 from rohitwaghchaure/minor_fixes_v_7_2
Minor fixes
2017-02-08 11:21:54 +05:30
Nabin Hait
533d22e88b Merge pull request #7606 from rohitwaghchaure/data_import_tool_for_cost_center
[Fix] Allow data import tool for cost center
2017-02-08 11:21:25 +05:30
Rohit Waghchaure
b3489548a9 minor fix 2017-02-08 11:20:04 +05:30
Nabin Hait
ccd2e00331 Merge pull request #7676 from nabinhait/missing_val_rate
Get standard/historical valuation rate where missing, if item is not a sample item
2017-02-08 11:05:06 +05:30
Nabin Hait
0a6aaf4257 Get standard/historical valuation rate where missing: some minor fixes 2017-02-07 12:50:22 +05:30
Nabin Hait
ea8fab52c6 Get standard/historical valuation rate where missing, if item is not a sample item 2017-02-07 01:24:32 +05:30
Nabin Hait
8200485baa Merge pull request #7675 from mbauskar/hotfix
[minor] index out of range fixes for JE
2017-02-06 19:23:33 +05:30
mbauskar
c874a82559 [minor] index out of range fixes for JE 2017-02-06 15:41:34 +05:30
Nabin Hait
101aaed643 Merge pull request #7614 from KanchanChauhan/account-filters-payroll
[Fix] Account filter in Process Payroll and Salary Component
2017-02-06 11:36:48 +05:30
Nabin Hait
20d2d7548a Update salary_component.js 2017-02-06 11:36:38 +05:30
Kanchan Chauhan
3e2ecc3423 [Fix] Account filter in Process Payroll and Salary Component 2017-02-02 14:41:48 +05:30
Nabin Hait
6b9902627d Merge pull request #7638 from rohitwaghchaure/gross_profit_report_issue
[Fix] Buying rate in gross profit report
2017-02-02 13:41:32 +05:30
Rohit Waghchaure
38f808cfae [Fix] Buying rate in gross profit report 2017-02-01 13:34:06 +05:30
Rohit Waghchaure
b327429db7 [Fix] Allow data import tool for cost center 2017-01-30 11:34:29 +05:30
Rohit Waghchaure
bf667a6540 Merge branch 'hotfix' 2017-01-28 14:14:32 +05:30
Rohit Waghchaure
ce4a0b20ab bumped to version 7.2.18 2017-01-28 14:44:32 +06:00
Nabin Hait
68fd31ca0e Merge pull request #7599 from KanchanChauhan/stock-controller-urgent-fix
[URGENT][FIX]Stock Controller fix
2017-01-28 14:11:14 +05:30
Kanchan Chauhan
b77eaf7053 [URGENT][FIX]Stock Controller fix 2017-01-28 13:26:46 +05:30
Rushabh Mehta
245c2e885a Merge branch 'hotfix' 2017-01-27 16:18:26 +05:30
Rushabh Mehta
098bd34f00 bumped to version 7.2.17 2017-01-27 16:48:25 +06:00
Rushabh Mehta
063e86a1bf [fix] remove on_update in Item 2017-01-27 16:16:08 +05:30
Rushabh Mehta
73bf1bc4b0 Merge branch 'hotfix' 2017-01-27 16:03:29 +05:30
Rushabh Mehta
5f0027a2d0 bumped to version 7.2.16 2017-01-27 16:33:29 +06:00
Rushabh Mehta
fd82f4b0d4 [minor] fix for item_group.py 2017-01-27 16:00:47 +05:30
Rushabh Mehta
83cc7c9382 Merge branch 'hotfix' 2017-01-27 15:46:07 +05:30
Rushabh Mehta
149c033c8f bumped to version 7.2.15 2017-01-27 16:16:07 +06:00
Nabin Hait
355b4110c9 Merge pull request #7583 from rohitwaghchaure/valuation_rate_issue
[Fix] Get valuation rate from item master and update stock value difference
2017-01-25 19:21:04 +05:30
Nabin Hait
cb19f52985 Update stock_controller.py 2017-01-25 19:20:35 +05:30
Rohit Waghchaure
3899d74f15 [Fix] Get valuation rate from item master and update stock value difference 2017-01-25 18:47:53 +05:30
Nabin Hait
d288909310 Merge pull request #7561 from KanchanChauhan/salary-slip-fix-abbr
Patch to update Salary Detail where Salary Component Abbr is null
2017-01-25 17:23:43 +05:30
Kanchan Chauhan
c948a4fc92 Patch to update Salary Detail where Salary Component Abbr is null 2017-01-23 16:12:45 +05:30
Makarand Bauskar
01eefafad5 [minor] minor fixes in opportunity form (#7549) 2017-01-23 12:15:36 +05:30
Nabin Hait
b736aafb8b Merge branch 'hotfix' 2017-01-20 15:40:35 +05:30
Nabin Hait
a1d3d84415 bumped to version 7.2.14 2017-01-20 16:10:35 +06:00
Nabin Hait
c1cc7b68c4 Merge pull request #7522 from nabinhait/hotfix
Get valuation rate from Item while not found based on SLE
2017-01-20 15:39:24 +05:30
Nabin Hait
4c952f48f8 Some minor fixes 2017-01-20 15:15:31 +05:30
Nabin Hait
bd1a628c55 Merge pull request #7545 from rohitwaghchaure/minor_issue
[Fix] Account user not able to access the report Payment Period Based On Invoice Date
2017-01-20 14:36:48 +05:30
Rohit Waghchaure
93c001455f [Fix] Account user not able to access the report 2017-01-20 14:18:17 +05:30
Nabin Hait
548cf183ea Merge pull request #7543 from RobertSchouten/leave_allocation_fix
[fix] remove invalid parameter from leave allocation
2017-01-20 12:54:55 +05:30
Nabin Hait
153156e31a Merge pull request #7529 from rohitwaghchaure/budget_issue
[Fix] Budget not working properly
2017-01-20 12:54:29 +05:30
Nabin Hait
a0b967f2cd Get valuation rate from Item while not found based on SLE 2017-01-20 12:50:40 +05:30
Nabin Hait
f356e539bb Update set_null_value_to_fields.py 2017-01-20 12:35:22 +05:30
Rohit Waghchaure
84b827efcd [Fix] Budget not working properly 2017-01-20 12:33:50 +05:30
robert schouten
e14e042f2f [fix] remove invalid parameter from leave allocation 2017-01-20 15:02:00 +08:00
Nabin Hait
bfcacbf2ca Merge pull request #7535 from rohitwaghchaure/landed_cost_voucher_issue
[Fix] Minor issue in landed cost voucher
2017-01-20 12:12:17 +05:30
Nabin Hait
78966fe03b Merge pull request #7524 from KanchanChauhan/date-fixes
Date fixes in Production Order
2017-01-20 12:09:46 +05:30
Rohit Waghchaure
a3a977d02a [Fix] Minor issue in landed cost voucher 2017-01-19 18:38:53 +05:30
Kanchan Chauhan
45c14ed41c [Minor] Date fix in Production Order 2017-01-19 12:22:04 +05:30
Nabin Hait
e2f4b35b11 Merge pull request #7521 from rohitwaghchaure/discount_issue
[Fix] Sales return discount issue
2017-01-18 17:05:01 +05:30
Rohit Waghchaure
56cc542eb7 [Fix] sales return discount issue 2017-01-18 14:50:24 +05:30
Nabin Hait
461e9c1e09 Merge pull request #7519 from rohitwaghchaure/print_issue
[Fix] POS print issue
2017-01-18 13:24:16 +05:30
Rohit Waghchaure
2b97cee32c [Fix] POS print issue 2017-01-18 13:21:27 +05:30
Nabin Hait
b70767b08e Merge branch 'hotfix' 2017-01-17 15:52:25 +05:30
Nabin Hait
aff2b9479d bumped to version 7.2.13 2017-01-17 16:22:25 +06:00
Nabin Hait
a987b35b72 Merge pull request #7514 from KanchanChauhan/fix-payroll
[Minor] Payroll Fix
2017-01-17 14:59:59 +05:30
Kanchan Chauhan
653303180a [Minor] Payroll Fix 2017-01-17 13:54:55 +05:30
Nabin Hait
d9e216878f Merge pull request #7513 from rohitwaghchaure/paid_amount_copy_issue
[Fix] Calculate paid amount when is pos is enabled
2017-01-17 12:38:09 +05:30
Rohit Waghchaure
f58cad6b13 [Fix] Calculate paid amount when is pos is enabled 2017-01-17 12:11:57 +05:30
Nabin Hait
0681c77f6a Merge pull request #7506 from mntechnique/hotfix
[Fix] Project: Enabled autocomplete for project users
2017-01-17 11:27:37 +05:30
Dhaifallah Alwadani
9eb830ac4f fix string translation 2017-01-17 11:13:57 +05:30
Gaurav Naik
d9b4c52046 [Fix] Project: Enabled autocomplete for project users 2017-01-16 16:01:25 +05:30
41 changed files with 576 additions and 156 deletions

View File

@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
__version__ = '7.2.12'
__version__ = '7.2.20'
def get_default_company(user=None):
'''Get default company for user'''

View File

@@ -74,6 +74,9 @@ class BankReconciliation(Document):
clearance_date_updated = False
for d in self.get('payment_entries'):
if d.clearance_date:
if not d.payment_document:
frappe.throw(_("Row #{0}: Payment document is required to complete the trasaction"))
if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date):
frappe.throw(_("Row #{0}: Clearance date {1} cannot be before Cheque Date {2}")
.format(d.idx, d.clearance_date, d.cheque_date))

View File

@@ -43,9 +43,18 @@ frappe.ui.form.on('Budget', {
},
budget_against: function(frm) {
frm.trigger("set_null_value")
frm.trigger("toggle_reqd_fields")
},
set_null_value: function(frm) {
if(frm.doc.budget_against == 'Cost Center') {
frm.set_value('project', null)
} else {
frm.set_value('cost_center', null)
}
},
toggle_reqd_fields: function(frm) {
frm.toggle_reqd("cost_center", frm.doc.budget_against=="Cost Center");
frm.toggle_reqd("project", frm.doc.budget_against=="Project");

View File

@@ -22,6 +22,7 @@ class Budget(Document):
frappe.throw(_("{0} is mandatory").format(self.budget_against))
self.validate_duplicate()
self.validate_accounts()
self.set_null_value()
def validate_duplicate(self):
budget_against_field = frappe.scrub(self.budget_against)
@@ -54,25 +55,31 @@ class Budget(Document):
else:
account_list.append(d.account)
def set_null_value(self):
if self.budget_against == 'Cost Center':
self.project = None
else:
self.cost_center = None
def validate_expense_against_budget(args):
args = frappe._dict(args)
if not args.cost_center and not args.project:
return
for budget_against in [args.project, args.cost_center]:
if budget_against \
for budget_against in ['project', 'cost_center']:
if args.get(budget_against) \
and frappe.db.get_value("Account", {"name": args.account, "root_type": "Expense"}):
if args.project:
if args.project and budget_against == 'project':
condition = "and b.project='%s'" % frappe.db.escape(args.project)
args.budget_against_field = "Project"
elif args.cost_center:
elif args.cost_center and budget_against == 'cost_center':
cc_lft, cc_rgt = frappe.db.get_value("Cost Center", args.cost_center, ["lft", "rgt"])
condition = """and exists(select name from `tabCost Center`
where lft<=%s and rgt>=%s and name=b.cost_center)""" % (cc_lft, cc_rgt)
args.budget_against_field = "Cost Center"
args.budget_against = budget_against
args.budget_against = args.get(budget_against)
budget_records = frappe.db.sql("""
select

View File

@@ -278,14 +278,14 @@
"icon": "fa fa-money",
"idx": 1,
"image_view": 0,
"in_create": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-11-07 05:20:40.282432",
"modified": "2017-01-30 11:27:36.615323",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Cost Center",

View File

@@ -45,6 +45,9 @@ class JournalEntry(AccountsController):
self.accounts = [account for account in self.accounts
if not (account.debit_in_account_currency==0.0 and account.credit_in_account_currency==0.0)]
if not self.accounts:
frappe.throw("Debit or Credit amount is not found in account table")
def on_submit(self):
self.check_credit_limit()
self.make_gl_entries()

View File

@@ -79,8 +79,13 @@ frappe.ui.form.on('Payment Entry', {
frm.events.show_general_ledger(frm);
},
company: function(frm) {
frm.events.hide_unhide_fields(frm);
frm.events.set_dynamic_labels(frm);
},
hide_unhide_fields: function(frm) {
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: "";
frm.toggle_display("source_exchange_rate",
(frm.doc.paid_amount && frm.doc.paid_from_account_currency != company_currency));
@@ -118,7 +123,7 @@ frappe.ui.form.on('Payment Entry', {
},
set_dynamic_labels: function(frm) {
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: "";
frm.set_currency_labels(["base_paid_amount", "base_received_amount", "base_total_allocated_amount",
"difference_amount"], company_currency);
@@ -131,6 +136,10 @@ frappe.ui.form.on('Payment Entry', {
frm.set_currency_labels(["total_allocated_amount", "unallocated_amount"], party_account_currency);
var currency_field = (frm.doc.payment_type=="Receive") ? "paid_from_account_currency" : "paid_to_account_currency"
frm.set_df_property("total_allocated_amount", "options", currency_field);
frm.set_df_property("unallocated_amount", "options", currency_field);
frm.set_currency_labels(["total_amount", "outstanding_amount", "allocated_amount"],
party_account_currency, "references");
@@ -741,4 +750,4 @@ frappe.ui.form.on('Payment Entry Deduction', {
deductions_remove: function(frm) {
frm.events.set_difference_amount(frm);
}
})
})

View File

@@ -1315,6 +1315,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -1788,7 +1816,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-11-16 16:04:52.465169",
"modified": "2017-02-07 01:21:03.737800",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",

View File

@@ -82,8 +82,7 @@ def update_pos_profile_data(doc, pos_profile, company_data):
doc.apply_discount_on = pos_profile.get('apply_discount_on') if pos_profile.get('apply_discount') else ''
doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group')
doc.territory = pos_profile.get('territory') or get_root('Territory')
if pos_profile.get('tc_name'):
doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms')
doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms') or doc.terms or ''
def get_root(table):
root = frappe.db.sql(""" select name from `tab%(table)s` having

View File

@@ -3188,6 +3188,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 1,
@@ -4182,7 +4183,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-11-09 14:18:24.760263",
"modified": "2017-01-18 13:21:13.226318",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@@ -1381,6 +1381,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -1882,7 +1910,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-11-16 16:04:02.438952",
"modified": "2017-02-07 01:21:47.142162",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _, scrub
from erpnext.stock.utils import get_incoming_rate
from frappe.utils import flt
@@ -208,21 +209,18 @@ class GrossProfitGenerator(object):
flt(my_sle[i+1].stock_value) or 0.0
return previous_stock_value - flt(sle.stock_value)
else:
return flt(row.qty) * self.get_average_buying_rate(item_code)
return flt(row.qty) * self.get_average_buying_rate(row, item_code)
return 0.0
def get_average_buying_rate(self, item_code):
def get_average_buying_rate(self, row, item_code):
if not item_code in self.average_buying_rate:
if item_code in self.non_stock_items:
self.average_buying_rate[item_code] = flt(frappe.db.sql("""select sum(base_net_amount) / sum(qty * conversion_factor)
from `tabPurchase Invoice Item`
where item_code = %s and docstatus=1""", item_code)[0][0])
else:
self.average_buying_rate[item_code] = flt(frappe.db.sql("""select avg(valuation_rate)
from `tabStock Ledger Entry`
where item_code = %s and qty_after_transaction > 0""", item_code)[0][0])
self.average_buying_rate[item_code] = get_incoming_rate(row)
return self.average_buying_rate[item_code]

View File

@@ -46,7 +46,7 @@ def validate_filters(filters):
def get_columns(filters):
return [
_("Payment Document") + ":Link/DocType: 100",
_("Payment Document") + ":: 100",
_("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":140",
_("Party Type") + "::100",
_("Party") + ":Dynamic Link/Party Type:140",

View File

@@ -11,9 +11,11 @@ from erpnext.accounts.report.trial_balance.trial_balance import validate_filters
value_fields = ("income", "expense", "gross_profit_loss")
def execute(filters=None):
if not filters.get('based_on'): filters["based_on"] = 'Cost Center'
based_on = filters.based_on.replace(' ', '_').lower()
validate_filters(filters)
accounts = get_accounts_data(based_on, filters.company)
accounts = get_accounts_data(based_on, filters.get("company"))
data = get_data(accounts, filters, based_on)
columns = get_columns(filters)
return columns, data
@@ -27,14 +29,14 @@ def get_accounts_data(based_on, company):
def get_data(accounts, filters, based_on):
if not accounts:
return None
return []
accounts, accounts_by_name, parent_children_map = filter_accounts(accounts)
gl_entries_by_account = {}
set_gl_entries_by_account(filters.company, filters.from_date,
filters.to_date, based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry))
set_gl_entries_by_account(filters.get("company"), filters.get("from_date"),
filters.get("to_date"), based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.get("with_period_closing_entry")))
total_row = calculate_values(accounts, gl_entries_by_account, filters)
accumulate_values_into_parents(accounts, accounts_by_name)
@@ -90,7 +92,7 @@ def accumulate_values_into_parents(accounts, accounts_by_name):
def prepare_data(accounts, filters, total_row, parent_children_map, based_on):
data = []
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
for d in accounts:
has_value = False
@@ -99,7 +101,7 @@ def prepare_data(accounts, filters, total_row, parent_children_map, based_on):
"account": d.name,
"parent_account": d.parent_account,
"indent": d.indent,
"fiscal_year": filters.fiscal_year,
"fiscal_year": filters.get("fiscal_year"),
"currency": company_currency,
"based_on": based_on
}
@@ -122,9 +124,9 @@ def get_columns(filters):
return [
{
"fieldname": "account",
"label": _(filters.based_on),
"label": _(filters.get("based_on")),
"fieldtype": "Link",
"options": filters.based_on,
"options": filters.get("based_on"),
"width": 300
},
{

View File

@@ -44,7 +44,7 @@ def get_data():
},
{
"type": "help",
"label": _("Setting up Email"),
"label": _("Setting up Email Account"),
"youtube_id": "YFYe0DrB95o"
},
{
@@ -62,11 +62,6 @@ def get_data():
"label": _("Workflow"),
"youtube_id": "yObJUg9FxFs"
},
{
"type": "help",
"label": _("Email Account"),
"youtube_id": "YFYe0DrB95o"
},
{
"type": "help",
"label": _("File Manager"),

View File

@@ -223,7 +223,8 @@ class BuyingController(StockController):
})
if not rm.rate:
from erpnext.stock.stock_ledger import get_valuation_rate
rm.rate = get_valuation_rate(bom_item.item_code, self.supplier_warehouse)
rm.rate = get_valuation_rate(bom_item.item_code, self.supplier_warehouse,
self.doctype, self.name)
else:
rm.rate = bom_item.rate

View File

@@ -198,6 +198,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
if tax.charge_type == "Actual":
tax.tax_amount = -1 * tax.tax_amount
doc.discount_amount = -1 * source.discount_amount
doc.run_method("calculate_taxes_and_totals")
def update_item(source_doc, target_doc, source_parent):

View File

@@ -9,6 +9,7 @@ import frappe.defaults
from erpnext.accounts.utils import get_fiscal_year
from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries, process_gl_map
from erpnext.controllers.accounts_controller import AccountsController
from erpnext.stock.stock_ledger import get_valuation_rate
class StockController(AccountsController):
def validate(self):
@@ -42,7 +43,7 @@ class StockController(AccountsController):
gl_list = []
warehouse_with_no_account = []
for item_row in voucher_details:
sle_list = sle_map.get(item_row.name)
if sle_list:
@@ -51,9 +52,17 @@ class StockController(AccountsController):
# from warehouse account
self.check_expense_account(item_row)
if not sle.stock_value_difference:
self.validate_negative_stock(sle)
# If item is not a sample item
# and ( valuation rate not mentioned in an incoming entry
# or incoming entry not found while delivering the item),
# try to pick valuation rate from previous sle or Item master and update in SLE
# Otherwise, throw an exception
if not sle.stock_value_difference and self.doctype != "Stock Reconciliation" \
and not item_row.get("is_sample_item"):
sle = self.update_stock_ledger_entries(sle)
gl_list.append(self.get_gl_dict({
"account": warehouse_account[sle.warehouse]["name"],
@@ -84,13 +93,27 @@ class StockController(AccountsController):
"\n".join(warehouse_with_no_account))
return process_gl_map(gl_list)
def validate_negative_stock(self, sle):
if sle.qty_after_transaction < 0 and sle.actual_qty < 0:
frappe.throw(_("For the Item {0}, valuation rate not found for warehouse {1}. To be able to do accounting entries (for booking expenses), we need valuation rate for item {2}. Please create an incoming stock transaction, on or before {3} {4}, and then try submiting {5}")
.format(sle.item_code, sle.warehouse,
sle.item_code, sle.posting_date, sle.posting_time, self.name))
def update_stock_ledger_entries(self, sle):
sle.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse,
self.doctype, self.name)
sle.stock_value = flt(sle.qty_after_transaction) * flt(sle.valuation_rate)
sle.stock_value_difference = flt(sle.actual_qty) * flt(sle.valuation_rate)
if sle.name:
frappe.db.sql("""
update
`tabStock Ledger Entry`
set
stock_value = %(stock_value)s,
valuation_rate = %(valuation_rate)s,
stock_value_difference = %(stock_value_difference)s
where
name = %(name)s""", (sle))
return sle
def get_voucher_details(self, default_expense_account, default_cost_center, sle_map):
if self.doctype == "Stock Reconciliation":
return [frappe._dict({ "name": voucher_detail_no, "expense_account": default_expense_account,
@@ -138,10 +161,18 @@ class StockController(AccountsController):
def get_stock_ledger_details(self):
stock_ledger = {}
for sle in frappe.db.sql("""select warehouse, stock_value_difference,
voucher_detail_no, item_code, posting_date, posting_time, actual_qty, qty_after_transaction
from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s""",
(self.doctype, self.name), as_dict=True):
stock_ledger_entries = frappe.db.sql("""
select
name, warehouse, stock_value_difference, valuation_rate,
voucher_detail_no, item_code, posting_date, posting_time,
actual_qty, qty_after_transaction
from
`tabStock Ledger Entry`
where
voucher_type=%s and voucher_no=%s
""", (self.doctype, self.name), as_dict=True)
for sle in stock_ledger_entries:
stock_ledger.setdefault(sle.voucher_detail_no, []).append(sle)
return stock_ledger

View File

@@ -455,10 +455,12 @@ class calculate_taxes_and_totals(object):
def calculate_paid_amount(self):
paid_amount = base_paid_amount = 0.0
for payment in self.doc.get('payments'):
payment.base_amount = flt(payment.amount * self.doc.conversion_rate)
paid_amount += payment.amount
base_paid_amount += payment.base_amount
if self.doc.is_pos:
for payment in self.doc.get('payments'):
payment.base_amount = flt(payment.amount * self.doc.conversion_rate)
paid_amount += payment.amount
base_paid_amount += payment.base_amount
self.doc.paid_amount = flt(paid_amount, self.doc.precision("paid_amount"))
self.doc.base_paid_amount = flt(base_paid_amount, self.doc.precision("base_paid_amount"))

View File

@@ -23,7 +23,7 @@ frappe.ui.form.on("Opportunity", {
refresh: function(frm) {
var doc = frm.doc;
frm.events.enquiry_from(frm);
if(doc.status!=="Lost") {
if(!doc.__islocal && doc.status!=="Lost") {
if(doc.with_items){
frm.add_custom_button(__('Supplier Quotation'),
function() {
@@ -109,7 +109,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
erpnext.toggle_naming_series();
var frm = cur_frm;
if(frm.perm[0].write && doc.docstatus==0) {
if(!doc.__islocal && frm.perm[0].write && doc.docstatus==0) {
if(frm.doc.status==="Open") {
frm.add_custom_button(__("Close"), function() {
frm.set_value("status", "Closed");

View File

@@ -93,7 +93,7 @@ class LeaveAllocation(Document):
if flt(leaves_taken) > flt(self.total_leaves_allocated):
if frappe.db.get_value("Leave Type", self.leave_type, "allow_negative"):
frappe.msgprint(_("Note: Total allocated leaves {0} shouldn't be less than already approved leaves {1} for the period").format(self.total_leaves_allocated, leaves_taken), LessAllocationError)
frappe.msgprint(_("Note: Total allocated leaves {0} shouldn't be less than already approved leaves {1} for the period").format(self.total_leaves_allocated, leaves_taken))
else:
frappe.throw(_("Total allocated leaves {0} cannot be less than already approved leaves {1} for the period").format(self.total_leaves_allocated, leaves_taken), LessAllocationError)

View File

@@ -10,6 +10,19 @@ frappe.ui.form.on("Process Payroll", {
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
},
setup: function(frm) {
frm.set_query("payment_account", function() {
var account_types = ["Bank", "Cash"];
return {
filters: {
"account_type": ["in", account_types],
"is_group": 0,
"company": frm.doc.company
}
}
})
},
refresh: function(frm) {
frm.disable_save();
},
@@ -50,16 +63,6 @@ frappe.ui.form.on("Process Payroll", {
}
})
}
},
account: function(frm) {
var account_types = ["Bank", "Cash"];
return {
filters: {
"account_type": ["in", account_types],
"is_group": 0,
"company": frm.doc.company
}
}
}
})

View File

@@ -290,10 +290,8 @@ class ProcessPayroll(Document):
@frappe.whitelist()
def get_start_end_dates(payroll_frequency, start_date=None):
'''Returns dict of start and end dates for given payroll frequency based on start_date'''
if not payroll_frequency:
frappe.throw(_("Please set Payroll Frequency first"))
if payroll_frequency == "Monthly" or payroll_frequency == "Bimonthly":
if payroll_frequency == "Monthly" or payroll_frequency == "Bimonthly" or payroll_frequency == "":
fiscal_year = get_fiscal_year(start_date)[0]
month = "%02d" % getdate(start_date).month
m = get_month_details(fiscal_year, month)

View File

@@ -2,7 +2,16 @@
// For license information, please see license.txt
frappe.ui.form.on('Salary Component', {
refresh: function(frm) {
setup: function(frm) {
frm.set_query("default_account", "accounts", function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
filters: {
"root_type": "Expense",
"is_group": 0,
"company": d.company
}
}
})
}
});

View File

@@ -304,9 +304,9 @@ class ProductionOrder(Document):
def get_operations_data(self, data):
return {
'from_time': data.planned_start_time,
'from_time': get_datetime(data.planned_start_time),
'hours': data.time_in_mins / 60.0,
'to_time': data.planned_end_time,
'to_time': get_datetime(data.planned_end_time),
'project': self.project,
'operation': data.operation,
'operation_id': data.name,

View File

@@ -362,3 +362,5 @@ execute:frappe.delete_doc('Desktop Icon', {'module_name': 'Profit and Loss Statm
erpnext.patches.v7_2.update_website_for_variant
erpnext.patches.v7_2.update_doctype_status
erpnext.patches.v7_2.update_salary_slips
erpnext.patches.v7_2.set_null_value_to_fields
erpnext.patches.v7_2.update_abbr_in_salary_slips

View File

@@ -0,0 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
fields = {"Cost Center": "project", "Project": "cost_center"}
for budget_against, field in fields.items():
frappe.db.sql(""" update `tabBudget` set {field} = null
where budget_against = %s """.format(field = field), budget_against)

View File

@@ -0,0 +1,13 @@
import frappe
def execute():
frappe.reload_doctype('Salary Slip')
if not frappe.db.has_column('Salary Detail', 'abbr'):
return
salary_details = frappe.db.sql("""select abbr, salary_component, name from `tabSalary Detail`
where abbr is null or abbr = ''""", as_dict=True)
for salary_detail in salary_details:
salary_component_abbr = frappe.get_value("Salary Component", salary_detail.salary_component, "salary_component_abbr")
frappe.db.sql("""update `tabSalary Detail` set abbr = %s where name = %s""",(salary_component_abbr, salary_detail.name))

View File

@@ -8,6 +8,8 @@ from frappe.utils import flt, getdate, get_url
from frappe import _
from frappe.model.document import Document
from erpnext.controllers.queries import get_filters_cond
from frappe.desk.reportview import get_match_cond
class Project(Document):
def get_feed(self):
@@ -215,12 +217,29 @@ def get_list_context(context=None):
}
def get_users_for_project(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select name, concat_ws(' ', first_name, middle_name, last_name)
conditions = []
return frappe.db.sql("""select name, concat_ws(' ', first_name, middle_name, last_name)
from `tabUser`
where enabled=1
and name not in ("Guest", "Administrator")
and name not in ("Guest", "Administrator")
and ({key} like %(txt)s
or full_name like %(txt)s)
{fcond} {mcond}
order by
name asc""")
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
if(locate(%(_txt)s, full_name), locate(%(_txt)s, full_name), 99999),
idx desc,
name, full_name
limit %(start)s, %(page_len)s""".format(**{
'key': searchfield,
'fcond': get_filters_cond(doctype, filters, conditions),
'mcond': get_match_cond(doctype)
}), {
'txt': "%%%s%%" % txt,
'_txt': txt.replace("%", ""),
'start': start,
'page_len': page_len
})
@frappe.whitelist()
def get_cost_center_name(project):

View File

@@ -588,11 +588,13 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
calculate_paid_amount: function(){
var me = this;
var paid_amount = base_paid_amount = 0.0;
$.each(this.frm.doc['payments'] || [], function(index, data){
data.base_amount = flt(data.amount * me.frm.doc.conversion_rate, precision("base_amount"));
paid_amount += data.amount;
base_paid_amount += data.base_amount;
})
if(this.frm.doc.is_pos) {
$.each(this.frm.doc['payments'] || [], function(index, data){
data.base_amount = flt(data.amount * me.frm.doc.conversion_rate, precision("base_amount"));
paid_amount += data.amount;
base_paid_amount += data.base_amount;
})
}
this.frm.doc.paid_amount = flt(paid_amount, precision("paid_amount"));
this.frm.doc.base_paid_amount = flt(base_paid_amount, precision("base_paid_amount"));

View File

@@ -28,7 +28,6 @@ class ItemGroup(NestedSet, WebsiteGenerator):
def on_update(self):
NestedSet.on_update(self)
WebsiteGenerator.on_update(self)
invalidate_cache_for(self)
self.validate_name_with_item()
self.validate_one_root()

View File

@@ -1476,6 +1476,34 @@
"unique": 0,
"width": "120px"
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -1691,7 +1719,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-12-24 12:33:37.728117",
"modified": "2017-02-07 01:22:03.047137",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",

View File

@@ -26,6 +26,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "",
"length": 0,
"no_copy": 0,
@@ -54,6 +55,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Series",
"length": 0,
"no_copy": 0,
@@ -82,6 +84,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Code",
"length": 0,
"no_copy": 1,
@@ -112,6 +115,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 1,
"label": "Variant Of",
"length": 0,
"no_copy": 0,
@@ -140,6 +144,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
@@ -168,6 +173,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Barcode",
"length": 0,
"no_copy": 1,
@@ -195,6 +201,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Item Group",
"length": 0,
"no_copy": 0,
@@ -225,6 +232,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Unit of Measure",
"length": 0,
"no_copy": 0,
@@ -254,6 +262,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -279,6 +288,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Disabled",
"length": 0,
"no_copy": 0,
@@ -308,6 +318,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Maintain Stock",
"length": 0,
"no_copy": 0,
@@ -338,6 +349,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Opening Stock",
"length": 0,
"no_copy": 0,
@@ -353,39 +365,40 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(doc.__islocal && doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no && doc.opening_stock)",
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Valuation Rate",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)",
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Valuation Rate",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "standard_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -393,6 +406,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Standard Selling Rate",
"length": 0,
"no_copy": 0,
@@ -420,6 +434,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Fixed Asset",
"length": 0,
"no_copy": 0,
@@ -448,6 +463,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Asset Category",
"length": 0,
"no_copy": 0,
@@ -476,6 +492,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
"length": 0,
"no_copy": 0,
@@ -504,6 +521,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -531,6 +549,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Brand",
"length": 0,
"no_copy": 0,
@@ -560,6 +579,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -590,6 +610,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Inventory",
"length": 0,
"no_copy": 0,
@@ -620,6 +641,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Warehouse",
"length": 0,
"no_copy": 0,
@@ -651,6 +673,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "End of Life",
"length": 0,
"no_copy": 0,
@@ -681,6 +704,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Has Batch No",
"length": 0,
"no_copy": 0,
@@ -713,6 +737,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Has Serial No",
"length": 0,
"no_copy": 0,
@@ -744,6 +769,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Serial Number Series",
"length": 0,
"no_copy": 0,
@@ -771,6 +797,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Material Request Type",
"length": 0,
"no_copy": 0,
@@ -800,6 +827,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
@@ -829,6 +857,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow over delivery or receipt upto this percent",
"length": 0,
"no_copy": 0,
@@ -858,6 +887,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Valuation Method",
"length": 0,
"no_copy": 0,
@@ -886,6 +916,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Warranty Period (in days)",
"length": 0,
"no_copy": 0,
@@ -916,6 +947,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Net Weight",
"length": 0,
"no_copy": 0,
@@ -943,6 +975,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Weight UOM",
"length": 0,
"no_copy": 0,
@@ -972,6 +1005,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Auto re-order",
"length": 0,
"no_copy": 0,
@@ -1001,6 +1035,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reorder level based on Warehouse",
"length": 0,
"no_copy": 0,
@@ -1030,6 +1065,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Variants",
"length": 0,
"no_copy": 0,
@@ -1060,6 +1096,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Has Variants",
"length": 0,
"no_copy": 1,
@@ -1089,6 +1126,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Attributes",
"length": 0,
"no_copy": 1,
@@ -1117,6 +1155,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Purchase Details",
"length": 0,
"no_copy": 0,
@@ -1146,6 +1185,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Purchase Item",
"length": 0,
"no_copy": 0,
@@ -1176,6 +1216,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Minimum Order Qty",
"length": 0,
"no_copy": 0,
@@ -1204,6 +1245,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Safety Stock",
"length": 0,
"no_copy": 0,
@@ -1233,6 +1275,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Lead Time in days",
"length": 0,
"no_copy": 0,
@@ -1263,6 +1306,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Buying Cost Center",
"length": 0,
"no_copy": 0,
@@ -1294,6 +1338,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Expense Account",
"length": 0,
"no_copy": 0,
@@ -1324,6 +1369,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Unit of Measure Conversion",
"length": 0,
"no_copy": 0,
@@ -1353,6 +1399,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "UOMs",
"length": 0,
"no_copy": 1,
@@ -1383,6 +1430,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Last Purchase Rate",
"length": 0,
"no_copy": 1,
@@ -1412,6 +1460,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Details",
"length": 0,
"no_copy": 0,
@@ -1440,6 +1489,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Supplier",
"length": 0,
"no_copy": 0,
@@ -1467,6 +1517,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Delivered by Supplier (Drop Ship)",
"length": 0,
"no_copy": 0,
@@ -1495,6 +1546,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Manufacturer",
"length": 0,
"no_copy": 0,
@@ -1523,6 +1575,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Manufacturer Part Number",
"length": 0,
"no_copy": 0,
@@ -1550,6 +1603,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Code for Suppliers",
"length": 0,
"no_copy": 0,
@@ -1579,6 +1633,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Items",
"length": 0,
"no_copy": 0,
@@ -1606,6 +1661,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Sales Details",
"length": 0,
"no_copy": 0,
@@ -1635,6 +1691,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sales Item",
"length": 0,
"no_copy": 0,
@@ -1664,6 +1721,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Publish in Hub",
"length": 0,
"no_copy": 0,
@@ -1692,6 +1750,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Synced With Hub",
"length": 0,
"no_copy": 0,
@@ -1720,6 +1779,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Income Account",
"length": 0,
"no_copy": 0,
@@ -1748,6 +1808,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Selling Cost Center",
"length": 0,
"no_copy": 0,
@@ -1776,6 +1837,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer Item Codes",
"length": 0,
"no_copy": 0,
@@ -1806,6 +1868,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer Items",
"length": 0,
"no_copy": 0,
@@ -1834,6 +1897,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Max Discount (%)",
"length": 0,
"no_copy": 0,
@@ -1862,6 +1926,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Tax",
"length": 0,
"no_copy": 0,
@@ -1891,6 +1956,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Taxes",
"length": 0,
"no_copy": 0,
@@ -1920,6 +1986,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Inspection Criteria",
"length": 0,
"no_copy": 0,
@@ -1949,6 +2016,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Inspection Required before Purchase",
"length": 0,
"no_copy": 0,
@@ -1978,6 +2046,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Inspection Required before Delivery",
"length": 0,
"no_copy": 0,
@@ -2007,6 +2076,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Quality Parameters",
"length": 0,
"no_copy": 0,
@@ -2037,6 +2107,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Manufacturing",
"length": 0,
"no_copy": 0,
@@ -2066,6 +2137,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default BOM",
"length": 0,
"no_copy": 1,
@@ -2097,6 +2169,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supply Raw Materials for Purchase",
"length": 0,
"no_copy": 0,
@@ -2126,6 +2199,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -2152,6 +2226,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer Code",
"length": 0,
"no_copy": 1,
@@ -2178,6 +2253,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website",
"length": 0,
"no_copy": 0,
@@ -2206,6 +2282,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show in Website",
"length": 0,
"no_copy": 0,
@@ -2233,6 +2310,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show in Website (Variant)",
"length": 0,
"no_copy": 0,
@@ -2261,6 +2339,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Route",
"length": 0,
"no_copy": 0,
@@ -2290,6 +2369,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Weightage",
"length": 0,
"no_copy": 0,
@@ -2318,6 +2398,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Slideshow",
"length": 0,
"no_copy": 0,
@@ -2347,6 +2428,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
"length": 0,
"no_copy": 0,
@@ -2374,6 +2456,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Thumbnail",
"length": 0,
"no_copy": 0,
@@ -2401,6 +2484,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -2428,6 +2512,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Warehouse",
"length": 0,
"no_copy": 0,
@@ -2457,6 +2542,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Item Groups",
"length": 0,
"no_copy": 0,
@@ -2486,6 +2572,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Specifications",
"length": 0,
"no_copy": 0,
@@ -2513,6 +2600,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Copy From Item Group",
"length": 0,
"no_copy": 0,
@@ -2540,6 +2628,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Specifications",
"length": 0,
"no_copy": 0,
@@ -2568,6 +2657,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Description",
"length": 0,
"no_copy": 0,
@@ -2594,6 +2684,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Projected Qty",
"length": 0,
"no_copy": 0,
@@ -2622,7 +2713,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
"modified": "2017-01-10 12:02:51.807965",
"modified": "2017-01-18 17:43:20.262925",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

View File

@@ -93,7 +93,6 @@ class Item(WebsiteGenerator):
where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name)
def on_update(self):
super(Item, self).on_update()
invalidate_cache_for_item(self)
self.validate_name_with_item_group()
self.update_item_price()
@@ -452,24 +451,32 @@ class Item(WebsiteGenerator):
"valuation_method", "has_batch_no", "is_fixed_asset")
vals = frappe.db.get_value("Item", self.name, to_check, as_dict=True)
if not vals.get('valuation_method') and self.get('valuation_method'):
vals['valuation_method'] = frappe.db.get_single_value("Stock Settings", "valuation_method") or "FIFO"
if vals:
for key in to_check:
if self.get(key) != vals.get(key):
if not self.check_if_linked_document_exists():
if cstr(self.get(key)) != cstr(vals.get(key)):
if not self.check_if_linked_document_exists(key):
break # no linked document, allowed
else:
frappe.throw(_("As there are existing transactions for this item, you can not change the value of {0}").format(frappe.bold(self.meta.get_label(key))))
frappe.throw(_("As there are existing transactions against item {0}, you can not change the value of {1}").format(self.name, frappe.bold(self.meta.get_label(key))))
if vals and not self.is_fixed_asset and self.is_fixed_asset != vals.is_fixed_asset:
asset = frappe.db.get_all("Asset", filters={"item_code": self.name, "docstatus": 1}, limit=1)
if asset:
frappe.throw(_('"Is Fixed Asset" cannot be unchecked, as Asset record exists against the item'))
def check_if_linked_document_exists(self):
for doctype in ("Sales Order Item", "Delivery Note Item", "Sales Invoice Item",
"Material Request Item", "Purchase Order Item", "Purchase Receipt Item",
"Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"):
def check_if_linked_document_exists(self, key):
linked_doctypes = ["Delivery Note Item", "Sales Invoice Item", "Purchase Receipt Item",
"Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"]
# For "Is Stock Item", following doctypes is important
# because reserved_qty, ordered_qty and requested_qty updated from these doctypes
if key == "is_stock_item":
linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item"]
for doctype in linked_doctypes:
if frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}) or \
frappe.db.get_value("Production Order",
filters={"production_item": self.name, "docstatus": 1}):

View File

@@ -15,6 +15,7 @@
"item_group": "_Test Item Group",
"item_name": "_Test Item",
"apply_warehouse_wise_reorder_level": 1,
"valuation_rate": 100,
"reorder_levels": [
{
"material_request_type": "Purchase",
@@ -61,6 +62,7 @@
"item_code": "_Test Item Home Desktop 100",
"item_group": "_Test Item Group Desktops",
"item_name": "_Test Item Home Desktop 100",
"valuation_rate": 100,
"taxes": [
{
"doctype": "Item Tax",

View File

@@ -12,22 +12,23 @@ class LandedCostVoucher(Document):
def get_items_from_purchase_receipts(self):
self.set("items", [])
for pr in self.get("purchase_receipts"):
pr_items = frappe.db.sql("""select pr_item.item_code, pr_item.description,
pr_item.qty, pr_item.base_rate, pr_item.base_amount, pr_item.name
from `tab{doctype} Item` pr_item where parent = %s
and exists(select name from tabItem where name = pr_item.item_code and is_stock_item = 1)
""".format(doctype=pr.receipt_document_type), pr.receipt_document, as_dict=True)
if pr.receipt_document_type and pr.receipt_document:
pr_items = frappe.db.sql("""select pr_item.item_code, pr_item.description,
pr_item.qty, pr_item.base_rate, pr_item.base_amount, pr_item.name
from `tab{doctype} Item` pr_item where parent = %s
and exists(select name from tabItem where name = pr_item.item_code and is_stock_item = 1)
""".format(doctype=pr.receipt_document_type), pr.receipt_document, as_dict=True)
for d in pr_items:
item = self.append("items")
item.item_code = d.item_code
item.description = d.description
item.qty = d.qty
item.rate = d.base_rate
item.amount = d.base_amount
item.receipt_document_type = pr.receipt_document_type
item.receipt_document = pr.receipt_document
item.purchase_receipt_item = d.name
for d in pr_items:
item = self.append("items")
item.item_code = d.item_code
item.description = d.description
item.qty = d.qty
item.rate = d.base_rate
item.amount = d.base_amount
item.receipt_document_type = pr.receipt_document_type
item.receipt_document = pr.receipt_document
item.purchase_receipt_item = d.name
if self.get("taxes"):
self.set_applicable_charges_for_item()

View File

@@ -1574,6 +1574,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -1885,7 +1913,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-11-16 16:04:21.778869",
"modified": "2017-02-07 01:21:36.348032",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",

View File

@@ -219,9 +219,9 @@ class StockEntry(StockController):
# validate qty during submit
if d.docstatus==1 and d.s_warehouse and not allow_negative_stock and d.actual_qty < d.transfer_qty:
frappe.throw(_("Row {0}: Qty not available for {4} in warehouse {1} at posting time of the entry ({2} {3})".format(d.idx,
frappe.throw(_("Row {0}: Qty not available for {4} in warehouse {1} at posting time of the entry ({2} {3})").format(d.idx,
frappe.bold(d.s_warehouse), formatdate(self.posting_date),
format_time(self.posting_time), frappe.bold(d.item_code)))
format_time(self.posting_time), frappe.bold(d.item_code))
+ '<br><br>' + _("Available qty is {0}, you need {1}").format(frappe.bold(d.actual_qty),
frappe.bold(d.transfer_qty)),
NegativeStockError, title=_('Insufficient Stock'))
@@ -867,4 +867,4 @@ def get_warehouse_details(args):
"basic_rate" : get_incoming_rate(args)
}
return ret
return ret

View File

@@ -10,6 +10,7 @@
"doctype": "DocType",
"document_type": "Other",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
@@ -23,6 +24,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Barcode",
"length": 0,
"no_copy": 0,
@@ -50,6 +52,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -76,6 +79,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Source Warehouse",
"length": 0,
"no_copy": 0,
@@ -105,6 +109,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -130,6 +135,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Target Warehouse",
"length": 0,
"no_copy": 0,
@@ -159,6 +165,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -184,6 +191,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Item Code",
"length": 0,
"no_copy": 0,
@@ -213,6 +221,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -238,6 +247,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
@@ -264,6 +274,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -291,6 +302,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -321,6 +333,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -347,6 +360,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
"length": 0,
"no_copy": 0,
@@ -374,6 +388,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image View",
"length": 0,
"no_copy": 0,
@@ -402,6 +417,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Quantity and Rate",
"length": 0,
"no_copy": 0,
@@ -420,7 +436,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 1,
"columns": 3,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -428,6 +444,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Qty",
"length": 0,
"no_copy": 0,
@@ -448,14 +465,15 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 2,
"columns": 0,
"fieldname": "basic_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Basic Rate (as per Stock UOM)",
"length": 0,
"no_copy": 0,
@@ -485,6 +503,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Basic Amount",
"length": 0,
"no_copy": 0,
@@ -513,6 +532,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Additional Cost",
"length": 0,
"no_copy": 0,
@@ -541,6 +561,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Amount",
"length": 0,
"no_copy": 0,
@@ -570,6 +591,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Valuation Rate",
"length": 0,
"no_copy": 0,
@@ -598,6 +620,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -623,6 +646,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "UOM",
"length": 0,
"no_copy": 0,
@@ -652,6 +676,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Conversion Factor",
"length": 0,
"no_copy": 0,
@@ -680,6 +705,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Stock UOM",
"length": 0,
"no_copy": 0,
@@ -709,6 +735,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Qty as per Stock UOM",
"length": 0,
"no_copy": 0,
@@ -737,6 +764,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Serial No / Batch",
"length": 0,
"no_copy": 0,
@@ -763,6 +791,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Serial No",
"length": 0,
"no_copy": 1,
@@ -791,6 +820,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -816,6 +846,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Batch No",
"length": 0,
"no_copy": 0,
@@ -845,6 +876,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Accounting",
"length": 0,
"no_copy": 0,
@@ -872,6 +904,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Difference Account",
"length": 0,
"no_copy": 0,
@@ -899,6 +932,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -926,6 +960,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Cost Center",
"length": 0,
"no_copy": 0,
@@ -953,6 +988,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "More Information",
"length": 0,
"no_copy": 0,
@@ -967,6 +1003,34 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_sample_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sample Item",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
@@ -979,6 +1043,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Actual Qty (at source/target)",
"length": 0,
"no_copy": 1,
@@ -1008,6 +1073,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "BOM No",
"length": 0,
"no_copy": 0,
@@ -1035,6 +1101,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -1061,6 +1128,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Material Request",
"length": 0,
"no_copy": 1,
@@ -1088,6 +1156,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Material Request Item",
"length": 0,
"no_copy": 1,
@@ -1114,7 +1183,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-11-27 15:19:26.597414",
"modified": "2017-02-07 01:21:14.367586",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",

View File

@@ -258,7 +258,14 @@ class update_entries_after(object):
if not self.valuation_rate and actual_qty > 0:
self.valuation_rate = sle.incoming_rate
# Get valuation rate from previous SLE or Item master, if item is not a sample item
if not self.valuation_rate and sle.voucher_detail_no:
is_sample_item = self.check_if_sample_item(sle.voucher_type, sle.voucher_detail_no)
if not is_sample_item:
self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse,
sle.voucher_type, sle.voucher_no, self.allow_zero_rate)
def get_fifo_values(self, sle):
incoming_rate = flt(sle.incoming_rate)
actual_qty = flt(sle.actual_qty)
@@ -281,10 +288,14 @@ class update_entries_after(object):
qty_to_pop = abs(actual_qty)
while qty_to_pop:
if not self.stock_queue:
if self.qty_after_transaction > 0:
_rate = get_valuation_rate(sle.item_code, sle.warehouse, self.allow_zero_rate)
# Get valuation rate from last sle if exists or from valuation rate field in item master
is_sample_item = self.check_if_sample_item(sle.voucher_type, sle.voucher_detail_no)
if not is_sample_item:
_rate = get_valuation_rate(sle.item_code, sle.warehouse,
sle.voucher_type, sle.voucher_no, self.allow_zero_rate)
else:
_rate = 0
self.stock_queue.append([0, _rate])
index = None
@@ -330,7 +341,11 @@ class update_entries_after(object):
if not self.stock_queue:
self.stock_queue.append([0, sle.incoming_rate or sle.outgoing_rate or self.valuation_rate])
def check_if_sample_item(self, voucher_type, voucher_detail_no):
ref_item_dt = voucher_type + (" Detail" if voucher_type == "Stock Entry" else " Item")
return frappe.db.get_value(ref_item_dt, voucher_detail_no, "is_sample_item")
def get_sle_before_datetime(self):
"""get previous stock ledger entry before current time-bucket"""
return get_stock_ledger_entries(self.args, "<", "desc", "limit 1", for_update=False)
@@ -404,7 +419,8 @@ def get_stock_ledger_entries(previous_sle, operator=None, order="desc", limit=No
"order": order
}, previous_sle, as_dict=1, debug=debug)
def get_valuation_rate(item_code, warehouse, allow_zero_rate=False):
def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no, allow_zero_rate=False):
# Get valuation rate from last sle for the same item and warehouse
last_valuation_rate = frappe.db.sql("""select valuation_rate
from `tabStock Ledger Entry`
where item_code = %s and warehouse = %s
@@ -412,6 +428,7 @@ def get_valuation_rate(item_code, warehouse, allow_zero_rate=False):
order by posting_date desc, posting_time desc, name desc limit 1""", (item_code, warehouse))
if not last_valuation_rate:
# Get valuation rate from last sle for the item against any warehouse
last_valuation_rate = frappe.db.sql("""select valuation_rate
from `tabStock Ledger Entry`
where item_code = %s and valuation_rate > 0
@@ -420,9 +437,13 @@ def get_valuation_rate(item_code, warehouse, allow_zero_rate=False):
valuation_rate = flt(last_valuation_rate[0][0]) if last_valuation_rate else 0
if not valuation_rate:
valuation_rate = frappe.db.get_value("Item Price", {"item_code": item_code, "buying": 1}, "price_list_rate")
# If negative stock allowed, and item delivered without any incoming entry,
# syste does not found any SLE, then take valuation rate from Item
valuation_rate = frappe.db.get_value("Item", item_code, "valuation_rate")
if not allow_zero_rate and not valuation_rate and cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
frappe.throw(_("Purchase rate for item: {0} not found, which is required to book accounting entry (expense). Please mention item price against a buying price list.").format(item_code))
if not allow_zero_rate and not valuation_rate \
and cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries for {1} {2}. If the item is transacting as a sample item in the {1}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting/cancelling this entry").format(item_code, voucher_type, voucher_no))
return valuation_rate

View File

@@ -15,7 +15,7 @@
{% endif %}
<p style='margin-top: 30px'>
<a class='btn btn-primary'
href='/job_application?job_title={{ doc.name }}'>
href='/job_application?new=1&job_title={{ doc.name }}'>
{{ _("Apply Now") }}</a>
</p>