Merge branch 'develop' into new-subscription

This commit is contained in:
tundebabzy 2018-03-12 02:00:34 +01:00
commit 2970630ed2
56 changed files with 864 additions and 364 deletions

View File

@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '10.1.6'
__version__ = '10.1.7'
def get_default_company(user=None):
'''Get default company for user'''

View File

@ -159,6 +159,36 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "include_pos_transactions",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Include POS Transactions",
"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_bulk_edit": 0,
"allow_on_submit": 0,
@ -292,7 +322,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2017-04-21 16:58:26.902732",
"modified": "2018-03-07 18:58:48.658687",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Reconciliation",

View File

@ -53,10 +53,26 @@ class BankReconciliation(Document):
posting_date ASC, name DESC
""".format(condition),
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
entries = sorted(list(payment_entries)+list(journal_entries),
pos_entries = []
if self.include_pos_transactions:
pos_entries = frappe.db.sql("""
select
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
si.posting_date, si.debit_to as against_account, sip.clearance_date,
account.account_currency, 0 as credit
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
where
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
and account.name = sip.account and si.posting_date >= %(from)s and si.posting_date <= %(to)s {0}
order by
si.posting_date ASC, si.name DESC
""".format(condition),
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
entries = sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
key=lambda k: k['posting_date'] or getdate(nowdate()))
self.set('payment_entries', [])
self.total_amount = 0.0

View File

@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
class TestBankReconciliation(unittest.TestCase):
pass

View File

@ -685,6 +685,24 @@ def get_company_defaults(company):
return ret
def get_outstanding_on_journal_entry(name):
res = frappe.db.sql(
'SELECT '
'CASE WHEN party_type IN ("Customer", "Student") '
'THEN ifnull(sum(debit_in_account_currency - credit_in_account_currency), 0) '
'ELSE ifnull(sum(credit_in_account_currency - debit_in_account_currency), 0) '
'END as outstanding_amount '
'FROM `tabGL Entry` WHERE (voucher_no=%s OR against_voucher=%s) '
'AND party_type IS NOT NULL '
'AND party_type != ""',
(name, name), as_dict=1
)
outstanding_amount = res[0].get('outstanding_amount', 0) if res else 0
return outstanding_amount
@frappe.whitelist()
def get_reference_details(reference_doctype, reference_name, party_account_currency):
total_amount = outstanding_amount = exchange_rate = None
@ -695,6 +713,13 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
total_amount = ref_doc.get("grand_total")
exchange_rate = 1
outstanding_amount = ref_doc.get("outstanding_amount")
elif reference_doctype == "Journal Entry" and ref_doc.docstatus == 1:
total_amount = ref_doc.get("total_amount")
if ref_doc.multi_currency:
exchange_rate = get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date)
else:
exchange_rate = 1
outstanding_amount = get_outstanding_on_journal_entry(reference_name)
elif reference_doctype != "Journal Entry":
if party_account_currency == company_currency:
if ref_doc.doctype == "Expense Claim":

View File

@ -42,6 +42,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -73,6 +74,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -104,6 +106,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -135,6 +138,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -166,6 +170,39 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "mode_of_payment",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Mode of Payment",
"length": 0,
"no_copy": 0,
"options": "Mode of Payment",
"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,
"translatable": 0,
"unique": 0
}
],
@ -179,8 +216,8 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-12-19 16:20:33.546984",
"modified_by": "nabinhait@gmail.com",
"modified": "2018-03-08 11:26:18.266987",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Schedule",
"name_case": "",

View File

@ -41,6 +41,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -71,6 +72,39 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "mode_of_payment",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Mode of Payment",
"length": 0,
"no_copy": 0,
"options": "Mode of Payment",
"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,
"translatable": 0,
"unique": 0
},
{
@ -100,6 +134,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -131,6 +166,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -162,6 +198,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -193,6 +230,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -222,6 +260,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -252,6 +291,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
@ -265,7 +305,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-24 11:13:42.800048",
"modified": "2018-03-08 10:47:32.830478",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Term",

View File

@ -42,6 +42,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -73,6 +74,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -105,6 +107,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -136,6 +139,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -169,6 +173,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -201,6 +206,39 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "mode_of_payment",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Mode of Payment",
"length": 0,
"no_copy": 0,
"options": "Mode of Payment",
"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,
"translatable": 0,
"unique": 0
}
],
@ -214,7 +252,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-09-26 05:21:51.738319",
"modified": "2018-03-08 11:07:09.014151",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Terms Template Detail",

View File

@ -227,6 +227,36 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "clearance_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Clearance Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"has_web_view": 0,
@ -239,7 +269,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-07-24 17:25:03.765856",
"modified": "2018-03-07 18:34:39.552769",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Payment",

View File

@ -394,7 +394,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.frm = {}
this.frm.doc = this.doc
this.set_transaction_defaults("Customer");
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false;
this.frm.doc["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
this.wrapper.html(frappe.render_template("pos", this.frm.doc));
this.make_search();
this.make_customer();
@ -1257,6 +1258,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
$(this.wrapper).find('.selected-item').empty();
if(this.child_doc.length) {
this.child_doc[0]["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
this.child_doc[0]["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0]))
$(this.wrapper).find('.selected-item').html(this.selected_row)
}
@ -1692,7 +1694,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
setInterval(function () {
me.freeze_screen = false;
me.sync_sales_invoice()
}, 60000)
}, 180000)
},
sync_sales_invoice: function () {

View File

@ -28,5 +28,10 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
"default": frappe.datetime.get_today(),
"reqd": 1
},
{
"fieldname":"include_pos_transactions",
"label": __("Include POS Transactions"),
"fieldtype": "Check"
},
]
}
}

View File

@ -138,7 +138,23 @@ def get_entries(filters):
and ifnull(clearance_date, '4000-01-01') > %(report_date)s
""", filters, as_dict=1)
return sorted(list(payment_entries)+list(journal_entries),
pos_entries = []
if filters.include_pos_transactions:
pos_entries = frappe.db.sql("""
select
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
si.posting_date, si.debit_to as against_account, sip.clearance_date,
account.account_currency, 0 as credit
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
where
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
and account.name = sip.account and si.posting_date <= %(report_date)s and
ifnull(sip.clearance_date, '4000-01-01') > %(report_date)s
order by
si.posting_date ASC, si.name DESC
""", filters, as_dict=1)
return sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
key=lambda k: k['posting_date'] or getdate(nowdate()))
def get_amounts_not_reflected_in_system(filters):

View File

@ -179,7 +179,7 @@ def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
invoice_tax_map = {}
for d in tax_details:
if d.account_head in expense_accounts:
if invoice_expense_map[d.parent].has_key(d.account_head):
if d.account_head in invoice_expense_map[d.parent]:
invoice_expense_map[d.parent][d.account_head] += flt(d.tax_amount)
else:
invoice_expense_map[d.parent][d.account_head] = flt(d.tax_amount)

View File

@ -189,7 +189,7 @@ def get_invoice_tax_map(invoice_list, invoice_income_map, income_accounts):
invoice_tax_map = {}
for d in tax_details:
if d.account_head in income_accounts:
if invoice_income_map[d.parent].has_key(d.account_head):
if d.account_head in invoice_income_map[d.parent]:
invoice_income_map[d.parent][d.account_head] += flt(d.tax_amount)
else:
invoice_income_map[d.parent][d.account_head] = flt(d.tax_amount)

View File

@ -175,7 +175,7 @@ def accumulate_values_into_parents(accounts, accounts_by_name):
def prepare_data(accounts, filters, total_row, parent_children_map, company_currency):
data = []
tmpaccnt = sorted(accounts)
tmpaccnt = sorted(accounts, key = lambda account: account.name)
if not (accounts[0].account_number is None):
accounts = tmpaccnt

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe
import frappe.defaults
from frappe import msgprint, _
from frappe.model.naming import make_autoname
from frappe.model.naming import set_name_by_naming_series
from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
from erpnext.utilities.transaction_base import TransactionBase
from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this
@ -28,7 +28,7 @@ class Supplier(TransactionBase):
if supp_master_name == 'Supplier Name':
self.name = self.supplier_name
else:
self.name = make_autoname(self.naming_series + '.#####')
set_name_by_naming_series(self)
def on_update(self):
if not self.naming_series:

View File

@ -126,6 +126,11 @@ def get_data():
"link": "Tree/Sales Person",
"description": _("Manage Sales Person Tree."),
},
{
"type": "doctype",
"name": "Lead Source",
"description": _("Track Leads by Lead Source.")
},
]
},
{

View File

@ -173,6 +173,11 @@ def get_data():
"name": "Industry Type",
"description": _("Track Leads by Industry Type.")
},
{
"type": "doctype",
"name": "Lead Source",
"description": _("Track Leads by Lead Source.")
},
]
},
{

View File

@ -947,6 +947,7 @@ def get_payment_term_details(term, posting_date=None, grand_total=None, bill_dat
if getdate(term_details.due_date) < getdate(posting_date):
term_details.due_date = posting_date
term_details.mode_of_payment = term.mode_of_payment
return term_details

View File

@ -94,7 +94,10 @@ def validate_is_incremental(numeric_attribute, attribute, value, item):
InvalidItemAttributeValueError, title=_('Invalid Attribute'))
def validate_item_attribute_value(attributes_list, attribute, attribute_value, item):
if attribute_value not in attributes_list:
allow_rename_attribute_value = frappe.db.get_single_value('Item Variant Settings', 'allow_rename_attribute_value')
if allow_rename_attribute_value:
pass
elif attribute_value not in attributes_list:
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values for Item {2}").format(
attribute_value, attribute, item), InvalidItemAttributeValueError, title=_('Invalid Attribute'))

View File

@ -6,7 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model.naming import make_autoname
from frappe.model.naming import set_name_by_naming_series
class Instructor(Document):
def autoname(self):
@ -15,7 +15,7 @@ class Instructor(Document):
frappe.throw(_("Please setup Instructor Naming System in Education > Education Settings"))
else:
if naming_method == 'Naming Series':
self.name = make_autoname(self.naming_series + '.####')
set_name_by_naming_series(self)
elif naming_method == 'Employee Number':
if not self.employee:
frappe.throw(_("Please select Employee"))

View File

@ -1,12 +1,12 @@
[
{
"naming_series": "_T-Instructor-",
"employee": "_T-Employee-0001",
"employee": "_T-Employee-00001",
"instructor_name": "_Test Instructor"
},
{
"naming_series": "_T-Instructor-",
"employee": "_T-Employee-0002",
"employee": "_T-Employee-00002",
"instructor_name": "_Test Instructor 2"
}
]

View File

@ -27,26 +27,27 @@ def execute(filters=None):
course_dict = values.get("course_dict")
for student in args.students:
student_row = {}
student_row["student"] = student
student_row["student_name"] = student_details[student]
for course in course_dict:
scrub_course = frappe.scrub(course)
if assessment_group in assessment_result[student][course]:
student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
if student_details.get(student):
student_row = {}
student_row["student"] = student
student_row["student_name"] = student_details[student]
for course in course_dict:
scrub_course = frappe.scrub(course)
if assessment_group in assessment_result[student][course]:
student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
# create the list of possible grades
if student_row["grade_" + scrub_course] not in grades:
grades.append(student_row["grade_" + scrub_course])
# create the list of possible grades
if student_row["grade_" + scrub_course] not in grades:
grades.append(student_row["grade_" + scrub_course])
# create the dict of for gradewise analysis
if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
else:
course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
# create the dict of for gradewise analysis
if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
else:
course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
data.append(student_row)
data.append(student_row)
course_list = [d for d in course_dict]
columns = get_column(course_dict)

View File

@ -15,23 +15,7 @@ frappe.ui.form.on('Consultation', {
{fieldname: 'test_comment', columns: 4}
];
},
onload: function(frm){
if(frm.doc.patient){
frappe.call({
"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
args: {
patient: frm.doc.patient
},
callback: function (data) {
var age = null;
if(data.message.dob){
age = calculate_age(data.message.dob);
}
frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
}
});
}
},
refresh: function(frm) {
refresh_field('drug_prescription');
refresh_field('test_prescription');

View File

@ -8,7 +8,7 @@ from frappe import _
from frappe.model.document import Document
from frappe.utils import cint, cstr, getdate
import dateutil
from frappe.model.naming import make_autoname
from frappe.model.naming import set_name_by_naming_series
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account,send_registration_sms
class Patient(Document):
@ -42,10 +42,7 @@ class Patient(Document):
if patient_master_name == 'Patient Name':
self.name = self.get_patient_name()
else:
if not self.naming_series:
frappe.throw(_("Series is mandatory"), frappe.MandatoryError)
self.name = make_autoname(self.naming_series+'.#####')
set_name_by_naming_series(self)
def get_patient_name(self):
name = self.patient_name

View File

@ -750,7 +750,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-19 15:25:43.166877",
"modified": "2018-03-09 15:25:43.166877",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Physician",

View File

@ -201,11 +201,11 @@ doc_events = {
"Sales Invoice": {
'validate': 'erpnext.regional.india.utils.set_place_of_supply',
"on_submit": "erpnext.regional.france.utils.create_transaction_log",
"on_trash": "erpnext.regional.france.utils.check_deletion_permission"
"on_trash": "erpnext.regional.check_deletion_permission"
},
"Payment Entry": {
"on_submit": ["erpnext.regional.france.utils.create_transaction_log", "erpnext.accounts.doctype.payment_request.payment_request.make_status_as_paid"],
"on_trash": "erpnext.regional.france.utils.check_deletion_permission"
"on_trash": "erpnext.regional.check_deletion_permission"
},
'Address': {
'validate': 'erpnext.regional.india.utils.validate_gstin_for_india'
@ -278,4 +278,4 @@ regional_overrides = {
'Saudi Arabia': {
'erpnext.controllers.taxes_and_totals.update_itemised_tax_data': 'erpnext.regional.united_arab_emirates.utils.update_itemised_tax_data'
}
}
}

View File

@ -2,7 +2,7 @@
{
"doctype": "Attendance",
"name": "_Test Attendance 1",
"employee": "_T-Employee-0001",
"employee": "_T-Employee-00001",
"status": "Present",
"attendance_date": "2014-02-01",
"company": "_Test Company"

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe
from frappe.utils import getdate, validate_email_add, today, add_years
from frappe.model.naming import make_autoname
from frappe.model.naming import set_name_by_naming_series
from frappe import throw, _, scrub
import frappe.permissions
from frappe.model.document import Document
@ -24,7 +24,7 @@ class Employee(NestedSet):
throw(_("Please setup Employee Naming System in Human Resource > HR Settings"))
else:
if naming_method == 'Naming Series':
self.name = make_autoname(self.naming_series + '.####')
set_name_by_naming_series(self)
elif naming_method == 'Employee Number':
self.name = self.employee_number
elif naming_method == 'Full Name':

View File

@ -35,7 +35,7 @@ def make_payment_entry(advance):
def make_employee_advance():
doc = frappe.new_doc("Employee Advance")
doc.employee = "_T-Employee-0001"
doc.employee = "_T-Employee-00001"
doc.company = "_Test company"
doc.purpose = "For site visit"
doc.advance_amount = 1000
@ -43,5 +43,5 @@ def make_employee_advance():
doc.advance_account = "_Test Employee Advance - _TC"
doc.insert()
doc.submit()
return doc

View File

@ -87,7 +87,7 @@ def get_payable_account(company):
def make_expense_claim(payable_account,claim_amount, sanctioned_amount, company, account, project=None, task_name=None):
expense_claim = frappe.get_doc({
"doctype": "Expense Claim",
"employee": "_T-Employee-0001",
"employee": "_T-Employee-00001",
"payable_account": payable_account,
"company": company,
"expenses":

View File

@ -2,7 +2,7 @@
{
"docstatus": 1,
"doctype": "Leave Allocation",
"employee": "_T-Employee-0001",
"employee": "_T-Employee-00001",
"from_date": "2013-01-01",
"to_date": "2013-12-31",
"leave_type": "_Test Leave Type",
@ -11,7 +11,7 @@
{
"docstatus": 1,
"doctype": "Leave Allocation",
"employee": "_T-Employee-0002",
"employee": "_T-Employee-00002",
"from_date": "2013-01-01",
"to_date": "2013-12-31",
"leave_type": "_Test Leave Type",

View File

@ -14,7 +14,7 @@ _test_records = [
{
"company": "_Test Company",
"doctype": "Leave Application",
"employee": "_T-Employee-0001",
"employee": "_T-Employee-00001",
"from_date": "2013-05-01",
"leave_type": "_Test Leave Type",
"posting_date": "2013-01-02",
@ -23,7 +23,7 @@ _test_records = [
{
"company": "_Test Company",
"doctype": "Leave Application",
"employee": "_T-Employee-0002",
"employee": "_T-Employee-00002",
"from_date": "2013-05-01",
"leave_type": "_Test Leave Type",
"posting_date": "2013-01-02",
@ -32,7 +32,7 @@ _test_records = [
{
"company": "_Test Company",
"doctype": "Leave Application",
"employee": "_T-Employee-0001",
"employee": "_T-Employee-00001",
"from_date": "2013-01-15",
"leave_type": "_Test Leave Type LWP",
"posting_date": "2013-01-02",
@ -188,7 +188,7 @@ class TestLeaveApplication(unittest.TestCase):
application.half_day_date = application.from_date
self.assertRaises(OverlapError, application.insert)
def test_overlap_with_half_day_3(self):
self._clear_roles()
self._clear_applications()
@ -206,14 +206,14 @@ class TestLeaveApplication(unittest.TestCase):
application.half_day = 1
application.half_day_date = "2013-01-05"
application.insert()
# Apply leave from 4-7, half day on 5th
application = self.get_application(_test_records[0])
application.from_date = "2013-01-04"
application.to_date = "2013-01-07"
application.half_day = 1
application.half_day_date = "2013-01-05"
self.assertRaises(OverlapError, application.insert)
# Apply leave from 5-7, half day on 5th
@ -230,15 +230,15 @@ class TestLeaveApplication(unittest.TestCase):
from frappe.utils.user import add_role
add_role("test1@example.com", "Employee")
add_role("test@example.com", "Leave Approver")
self._add_employee_leave_approver("_T-Employee-0002", "test@example.com")
self._add_employee_leave_approver("_T-Employee-00002", "test@example.com")
make_allocation_record(employee="_T-Employee-0002")
make_allocation_record(employee="_T-Employee-00002")
application = self.get_application(_test_records[1])
frappe.db.set_value("Leave Block List", "_Test Leave Block List",
"applies_to_all_departments", 1)
frappe.db.set_value("Employee", "_T-Employee-0002", "department",
frappe.db.set_value("Employee", "_T-Employee-00002", "department",
"_Test Department")
frappe.set_user("test1@example.com")
@ -255,7 +255,7 @@ def make_allocation_record(employee=None, leave_type=None):
allocation = frappe.get_doc({
"doctype": "Leave Allocation",
"employee": employee or "_T-Employee-0001",
"employee": employee or "_T-Employee-00001",
"leave_type": leave_type or "_Test Leave Type",
"from_date": "2013-01-01",
"to_date": "2015-12-31",

View File

@ -573,7 +573,7 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
for item in items:
if item_dict.has_key(item.item_code):
if item.item_code in item_dict:
item_dict[item.item_code]["qty"] += flt(item.qty)
else:
item_dict[item.item_code] = item
@ -653,4 +653,4 @@ def get_boms_in_bottom_up_order(bom_no=None):
bom_list.append(child_bom)
count += 1
return bom_list
return bom_list

View File

@ -1,12 +1,13 @@
import frappe
def execute():
if frappe.db.exists("DocType", "Physician"):
frappe.reload_doc("healthcare", "doctype", "physician")
frappe.reload_doc("healthcare", "doctype", "physician_service_unit_schedule")
if frappe.db.has_column('Physician', 'physician_schedule'):
for doc in frappe.get_all('Physician'):
_doc = frappe.get_doc('Physician', doc.name)
if _doc.physician_schedule:
_doc.append('physician_schedules', {'schedule': _doc.physician_schedule})
_doc.save()
if frappe.db.exists("DocType", "Physician"):
frappe.reload_doc("healthcare", "doctype", "physician")
frappe.reload_doc("healthcare", "doctype", "physician_service_unit_schedule")
if frappe.db.has_column('Physician', 'physician_schedule'):
for doc in frappe.get_all('Physician'):
_doc = frappe.get_doc('Physician', doc.name)
if _doc.physician_schedule:
_doc.append('physician_schedules', {'schedule': _doc.physician_schedule})
_doc.save()

View File

@ -13,7 +13,7 @@ class TestActivityCost(unittest.TestCase):
frappe.db.sql("delete from `tabActivity Cost`")
activity_cost1 = frappe.new_doc('Activity Cost')
activity_cost1.update({
"employee": "_T-Employee-0001",
"employee": "_T-Employee-00001",
"employee_name": "_Test Employee",
"activity_type": "_Test Activity Type 1",
"billing_rate": 100,

View File

@ -14,8 +14,8 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal
class TestTimesheet(unittest.TestCase):
def test_timesheet_billing_amount(self):
make_salary_structure("_T-Employee-0001")
timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1)
make_salary_structure("_T-Employee-00001")
timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1)
self.assertEqual(timesheet.total_hours, 2)
self.assertEqual(timesheet.total_billable_hours, 2)
@ -24,8 +24,8 @@ class TestTimesheet(unittest.TestCase):
self.assertEqual(timesheet.total_billable_amount, 100)
def test_timesheet_billing_amount_not_billable(self):
make_salary_structure("_T-Employee-0001")
timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=0)
make_salary_structure("_T-Employee-00001")
timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=0)
self.assertEqual(timesheet.total_hours, 2)
self.assertEqual(timesheet.total_billable_hours, 0)
@ -34,8 +34,8 @@ class TestTimesheet(unittest.TestCase):
self.assertEqual(timesheet.total_billable_amount, 0)
def test_salary_slip_from_timesheet(self):
salary_structure = make_salary_structure("_T-Employee-0001")
timesheet = make_timesheet("_T-Employee-0001", simulate = True, billable=1)
salary_structure = make_salary_structure("_T-Employee-00001")
timesheet = make_timesheet("_T-Employee-00001", simulate = True, billable=1)
salary_slip = make_salary_slip(timesheet.name)
salary_slip.submit()
@ -44,7 +44,7 @@ class TestTimesheet(unittest.TestCase):
self.assertEqual(salary_slip.net_pay, 150)
self.assertEqual(salary_slip.timesheets[0].time_sheet, timesheet.name)
self.assertEqual(salary_slip.timesheets[0].working_hours, 2)
timesheet = frappe.get_doc('Timesheet', timesheet.name)
self.assertEqual(timesheet.status, 'Payslip')
salary_slip.cancel()
@ -53,7 +53,7 @@ class TestTimesheet(unittest.TestCase):
self.assertEqual(timesheet.status, 'Submitted')
def test_sales_invoice_from_timesheet(self):
timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1)
timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1)
sales_invoice = make_sales_invoice(timesheet.name, '_Test Item', '_Test Customer')
sales_invoice.due_date = nowdate()
sales_invoice.submit()
@ -68,7 +68,7 @@ class TestTimesheet(unittest.TestCase):
self.assertEqual(item.rate, 50.00)
def test_timesheet_billing_based_on_project(self):
timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1, project = '_Test Project', company='_Test Company')
timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1, project = '_Test Project', company='_Test Company')
sales_invoice = create_sales_invoice(do_not_save=True)
sales_invoice.project = '_Test Project'
sales_invoice.submit()
@ -85,7 +85,7 @@ class TestTimesheet(unittest.TestCase):
update_activity_type("_Test Activity Type")
timesheet = frappe.new_doc("Timesheet")
timesheet.employee = "_T-Employee-0001"
timesheet.employee = "_T-Employee-00001"
timesheet.append(
'time_logs',
{
@ -140,11 +140,11 @@ def make_salary_structure(employee):
"base": 1200,
"from_date": add_months(nowdate(),-1)
})
es = salary_structure.append('earnings', {
"salary_component": "_Test Allowance",
"amount": 100
"amount": 100
})
ds = salary_structure.append('deductions', {

View File

@ -37,20 +37,22 @@
<div class="cell price-cell text-right tax-table">
</div>
</div>
<div class="pos-list-row discount-amount-area">
<div class="cell"></div>
<div class="cell text-right">{%= __("Discount") %}</div>
<div class="cell price-cell discount-field-col">
<div class="input-group input-group-sm">
<span class="input-group-addon">%</span>
<input type="text" class="form-control discount-percentage text-right">
</div>
<div class="input-group input-group-sm">
<span class="input-group-addon">{%= get_currency_symbol(currency) %}</span>
<input type="text" class="form-control discount-amount text-right" placeholder="{%= 0.00 %}">
{% if(allow_user_to_edit_discount) { %}
<div class="pos-list-row discount-amount-area">
<div class="cell"></div>
<div class="cell text-right">{%= __("Discount") %}</div>
<div class="cell price-cell discount-field-col">
<div class="input-group input-group-sm">
<span class="input-group-addon">%</span>
<input type="text" class="form-control discount-percentage text-right">
</div>
<div class="input-group input-group-sm">
<span class="input-group-addon">{%= get_currency_symbol(currency) %}</span>
<input type="text" class="form-control discount-amount text-right" placeholder="{%= 0.00 %}">
</div>
</div>
</div>
</div>
{% } %}
<div class="pos-list-row grand-total-area collapse-btn" style="border-bottom:1px solid #d1d8dd;">
<div class="cell">
<a class="">
@ -71,7 +73,7 @@
{% for(var j=i*3; j
<(i+1)*3; j++) { %} <button type="button" class="btn btn-default numeric-keypad" val="{{j+1}}">{{j+1}}</button>
{% } %}
<button type="button" {% if(!allow_user_to_edit_rate && chartData[i] == __("Price")) { %} disabled {% } %} id="pos-item-{{ chartData[i].toLowerCase() }}" class="btn text-center btn-default numeric-keypad pos-operation">{{ __(chartData[i]) }}</button>
<button type="button" {% if((!allow_user_to_edit_rate && chartData[i] == __("Price")) || (!allow_user_to_edit_discount && chartData[i] == __("Disc"))) { %} disabled {% } %} id="pos-item-{{ chartData[i].toLowerCase() }}" class="btn text-center btn-default numeric-keypad pos-operation">{{ __(chartData[i]) }}</button>
</div>
{% } %}
<div class="row text-right">

View File

@ -9,7 +9,7 @@
</div>
<div class="pos-list-row">
<div class="cell">{{ __("Discount") }}: %</div>
<input type="tel" class="form-control cell pos-item-disc" value="{%= discount_percentage %}">
<input type="tel" class="form-control cell pos-item-disc" {% if !allow_user_to_edit_discount %} disabled {% endif %} value="{%= discount_percentage %}">
</div>
<div class="pos-list-row">
<div class="cell">{{ __("Price") }}:</div>

View File

@ -0,0 +1,11 @@
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
import frappe
from frappe import _
from erpnext import get_region
def check_deletion_permission(doc, method):
region = get_region()
if region in ["Nepal", "France"]:
frappe.throw(_("Deletion is not permitted for country {0}".format(region)))

View File

@ -9,9 +9,7 @@ def create_transaction_log(doc, method):
region = get_region()
if region not in ["France"]:
return
else:
data = str(doc.as_dict())
frappe.get_doc({
@ -21,14 +19,6 @@ def create_transaction_log(doc, method):
"data": data
}).insert(ignore_permissions=True)
def check_deletion_permission(doc, method):
region = get_region()
if region not in ["France"]:
return
else:
frappe.throw(_("Deletion is not permitted for country {0}".format(region)))
# don't remove this function it is used in tests
def test_method():
'''test function'''

View File

@ -5,11 +5,11 @@ from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.model.naming import make_autoname
from frappe.model.naming import set_name_by_naming_series
class Campaign(Document):
def autoname(self):
if frappe.defaults.get_global_default('campaign_naming_by') != 'Naming Series':
self.name = self.campaign_name
else:
self.name = make_autoname(self.naming_series+'.#####')
set_name_by_naming_series(self)

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.naming import make_autoname
from frappe.model.naming import set_name_by_naming_series
from frappe import _, msgprint, throw
import frappe.defaults
from frappe.utils import flt, cint, cstr
@ -31,10 +31,7 @@ class Customer(TransactionBase):
if cust_master_name == 'Customer Name':
self.name = self.get_customer_name()
else:
if not self.naming_series:
frappe.throw(_("Series is mandatory"), frappe.MandatoryError)
self.name = make_autoname(self.naming_series+'.#####')
set_name_by_naming_series(self)
def get_customer_name(self):
if frappe.db.get_value("Customer", self.customer_name):

View File

@ -48,6 +48,15 @@ frappe.ui.form.on("Sales Order", {
});
frappe.ui.form.on("Sales Order Item", {
item_code: function(frm,cdt,cdn) {
var row = locals[cdt][cdn];
if (frm.doc.delivery_date) {
row.delivery_date = frm.doc.delivery_date;
refresh_field("delivery_date", cdn, "items");
} else {
this.frm.script_manager.copy_from_first_row("items", row, ["delivery_date"]);
}
},
delivery_date: function(frm, cdt, cdn) {
if(!frm.doc.delivery_date) {
erpnext.utils.copy_value_in_all_row(frm.doc, cdt, cdn, "items", "delivery_date");
@ -433,17 +442,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
if(cint(frappe.boot.notification_settings.sales_order)) {
this.frm.email_doc(frappe.boot.notification_settings.sales_order_message);
}
},
items_add: function(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
if(doc.delivery_date) {
row.delivery_date = doc.delivery_date;
refresh_field("delivery_date", cdn, "items");
} else {
this.frm.script_manager.copy_from_first_row("items", row, ["delivery_date"]);
}
}
});
$.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));

View File

@ -2,13 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
test_ignore = ["Account", "Cost Center"]
import frappe
import unittest
from frappe.utils import random_string
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import get_charts_for_country
test_ignore = ["Account", "Cost Center", "Payment Terms Template"]
test_records = frappe.get_test_records('Company')
class TestCompany(unittest.TestCase):

View File

@ -1,23 +1,23 @@
[
{
"doctype": "Sales Person",
"employee": "_T-Employee-0001",
"is_group": 0,
"parent_sales_person": "Sales Team",
"doctype": "Sales Person",
"employee": "_T-Employee-00001",
"is_group": 0,
"parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person"
},
},
{
"doctype": "Sales Person",
"employee": "_T-Employee-0002",
"is_group": 0,
"parent_sales_person": "Sales Team",
"doctype": "Sales Person",
"employee": "_T-Employee-00002",
"is_group": 0,
"parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person 1"
},
},
{
"doctype": "Sales Person",
"employee": "_T-Employee-0003",
"is_group": 0,
"parent_sales_person": "Sales Team",
"doctype": "Sales Person",
"employee": "_T-Employee-00003",
"is_group": 0,
"parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person 2"
}
]

View File

@ -170,6 +170,35 @@ frappe.ui.form.on('Item Reorder', {
}
})
frappe.ui.form.on('Item Customer Detail', {
customer_items_add: function(frm, cdt, cdn) {
frappe.model.set_value(cdt, cdn, 'customer_group', "");
},
customer_name: function(frm, cdt, cdn) {
set_customer_group(frm, cdt, cdn);
},
customer_group: function(frm, cdt, cdn) {
if(set_customer_group(frm, cdt, cdn)){
frappe.msgprint(__("Changing Customer Group for the selected Customer is not allowed."));
}
}
});
var set_customer_group = function(frm, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
if (!row.customer_name) {
return false;
}
frappe.model.with_doc("Customer", row.customer_name, function() {
var customer = frappe.model.get_doc("Customer", row.customer_name);
row.customer_group = customer.customer_group;
refresh_field("customer_group", cdn, "customer_items");
});
return true;
}
$.extend(erpnext.item, {
setup_queries: function(frm) {
frm.fields_dict['expense_account'].get_query = function(doc) {

File diff suppressed because it is too large Load Diff

View File

@ -53,8 +53,8 @@ class Item(WebsiteGenerator):
template_item_name = frappe.db.get_value("Item", self.variant_of, "item_name")
self.item_code = make_variant_item_code(self.variant_of, template_item_name, self)
else:
from frappe.model.naming import make_autoname
self.item_code = make_autoname(self.naming_series + '.#####')
from frappe.model.naming import set_name_by_naming_series
set_name_by_naming_series(self)
elif not self.item_code:
msgprint(_("Item Code is mandatory because Item is not automatically numbered"), raise_exception=1)

View File

@ -1,5 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
@ -12,16 +13,20 @@
"editable_grid": 1,
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "customer_name",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Customer Name",
"length": 0,
"no_copy": 0,
@ -33,24 +38,62 @@
"print_hide_if_no_value": 0,
"print_width": "180px",
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"translatable": 0,
"unique": 0,
"width": "180px"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "customer_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Customer Group",
"length": 0,
"no_copy": 0,
"options": "Customer Group",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "ref_code",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Ref Code",
"length": 0,
"no_copy": 0,
@ -61,25 +104,27 @@
"print_hide_if_no_value": 0,
"print_width": "120px",
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"translatable": 0,
"unique": 0,
"width": "120px"
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:28:00.992064",
"modified": "2018-03-08 14:22:38.019369",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Customer Detail",
@ -88,5 +133,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"track_changes": 0,
"track_seen": 0
}

View File

@ -72,6 +72,38 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"description": "Rename Attribute Value in Item Attribute.",
"fieldname": "allow_rename_attribute_value",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow Rename Attribute Value",
"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_bulk_edit": 0,
"allow_on_submit": 0,
@ -144,7 +176,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2017-11-14 15:54:12.190518",
"modified": "2018-02-19 11:39:54.401128",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Variant Settings",

View File

@ -32,10 +32,10 @@ class MaterialRequest(BuyingController):
so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
for d in self.get('items'):
if d.sales_order:
if not so_items.has_key(d.sales_order):
if not d.sales_order in so_items:
so_items[d.sales_order] = {d.item_code: flt(d.qty)}
else:
if not so_items[d.sales_order].has_key(d.item_code):
if not d.item_code in so_items[d.sales_order]:
so_items[d.sales_order][d.item_code] = flt(d.qty)
else:
so_items[d.sales_order][d.item_code] += flt(d.qty)

View File

@ -396,8 +396,16 @@ def validate_conversion_rate(args, meta):
def get_party_item_code(args, item_doc, out):
if args.transaction_type=="selling" and args.customer:
out.customer_item_code = None
customer_item_code = item_doc.get("customer_items", {"customer_name": args.customer})
out.customer_item_code = customer_item_code[0].ref_code if customer_item_code else None
if customer_item_code:
out.customer_item_code = customer_item_code[0].ref_code
else:
customer_group = frappe.db.get_value("Customer", args.customer, "customer_group")
customer_group_item_code = item_doc.get("customer_items", {"customer_group": customer_group})
if customer_group_item_code and not customer_group_item_code[0].customer_name:
out.customer_item_code = customer_group_item_code[0].ref_code
if args.transaction_type=="buying" and args.supplier:
item_supplier = item_doc.get("supplier_items", {"supplier": args.supplier})

View File

@ -51,7 +51,7 @@ def get_consumed_items(condition):
sum(se_item.transfer_qty) as 'consume_qty'
from `tabStock Entry` se, `tabStock Entry Detail` se_item
where se.name = se_item.parent and se.docstatus = 1
and ifnull(se_item.t_warehouse, '') = '' %s
and (ifnull(se_item.t_warehouse, '') = '' or se.purpose = 'Subcontract') %s
group by se_item.item_code""" % (condition), as_dict=1)
cn_items_map = {}

View File

@ -43,7 +43,7 @@ def get_stock_value_on(warehouse=None, posting_date=None, item_code=None):
sle_map = {}
for sle in stock_ledger_entries:
if not sle_map.has_key((sle.item_code, sle.warehouse)):
if not (sle.item_code, sle.warehouse) in sle_map:
sle_map[(sle.item_code, sle.warehouse)] = flt(sle.stock_value)
return sum(sle_map.values())

View File

@ -9,8 +9,8 @@ class TestInit(unittest.TestCase):
frappe.flags.country = 'India'
self.assertEqual(test_method(), 'overridden')
frappe.flags.country = 'Nepal'
frappe.flags.country = 'Maldives'
self.assertEqual(test_method(), 'original')
frappe.flags.country = 'France'
self.assertEqual(test_method(), 'overridden')
self.assertEqual(test_method(), 'overridden')