Merge branch 'develop' of https://github.com/frappe/erpnext into develop

This commit is contained in:
Achilles Rasquinha 2018-02-14 19:40:43 +05:30
commit 806a18b511
51 changed files with 2366 additions and 2305 deletions

View File

@ -14,7 +14,7 @@ form_grid_templates = {
class BankReconciliation(Document): class BankReconciliation(Document):
def get_payment_entries(self): def get_payment_entries(self):
if not (self.bank_account and self.from_date and self.to_date): if not (self.bank_account and self.from_date and self.to_date):
msgprint("Bank Account, From Date and To Date are Mandatory") msgprint(_("Bank Account, From Date and To Date are Mandatory"))
return return
condition = "" condition = ""

View File

@ -4,8 +4,12 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.model.naming import make_autoname from frappe.model.naming import make_autoname
from frappe.exceptions import ValidationError
class ShareDontExists(ValidationError): pass
class ShareTransfer(Document): class ShareTransfer(Document):
def before_save(self): def before_save(self):
@ -66,39 +70,40 @@ class ShareTransfer(Document):
# validate share doesnt exist in company # validate share doesnt exist in company
ret_val = self.share_exists(self.get_shareholder_doc(self.company).name) ret_val = self.share_exists(self.get_shareholder_doc(self.company).name)
if ret_val != False: if ret_val != False:
frappe.throw('The shares already exist') frappe.throw(_('The shares already exist'), frappe.DuplicateEntryError)
else: else:
# validate share exists with from_shareholder # validate share exists with from_shareholder
ret_val = self.share_exists(self.from_shareholder) ret_val = self.share_exists(self.from_shareholder)
if ret_val != True: if ret_val != True:
frappe.throw('The shares don\'t exist with the {0}'.format(self.from_shareholder)) frappe.throw(_("The shares don't exist with the {0}")
.format(self.from_shareholder), ShareDontExists)
def basic_validations(self): def basic_validations(self):
if self.transfer_type == 'Purchase': if self.transfer_type == 'Purchase':
self.to_shareholder = '' self.to_shareholder = ''
if self.from_shareholder is None or self.from_shareholder is '': if self.from_shareholder is None or self.from_shareholder is '':
frappe.throw('The field \'From Shareholder\' cannot be blank') frappe.throw(_('The field From Shareholder cannot be blank'))
if self.from_folio_no is None or self.from_folio_no is '': if self.from_folio_no is None or self.from_folio_no is '':
self.to_folio_no = self.autoname_folio(self.to_shareholder) self.to_folio_no = self.autoname_folio(self.to_shareholder)
elif (self.transfer_type == 'Issue'): elif (self.transfer_type == 'Issue'):
self.from_shareholder = '' self.from_shareholder = ''
if self.to_shareholder is None or self.to_shareholder == '': if self.to_shareholder is None or self.to_shareholder == '':
frappe.throw('The field \'To Shareholder\' cannot be blank') frappe.throw(_('The field To Shareholder cannot be blank'))
if self.to_folio_no is None or self.to_folio_no is '': if self.to_folio_no is None or self.to_folio_no is '':
self.to_folio_no = self.autoname_folio(self.to_shareholder) self.to_folio_no = self.autoname_folio(self.to_shareholder)
else: else:
if self.from_shareholder is None or self.to_shareholder is None: if self.from_shareholder is None or self.to_shareholder is None:
frappe.throw('The fields \'From Shareholder\' and \'To Shareholder\' cannot be blank') frappe.throw(_('The fields From Shareholder and To Shareholder cannot be blank'))
if self.to_folio_no is None or self.to_folio_no is '': if self.to_folio_no is None or self.to_folio_no is '':
self.to_folio_no = self.autoname_folio(self.to_shareholder) self.to_folio_no = self.autoname_folio(self.to_shareholder)
if self.from_shareholder == self.to_shareholder: if self.from_shareholder == self.to_shareholder:
frappe.throw('The seller and the buyer cannot be the same') frappe.throw(_('The seller and the buyer cannot be the same'))
if self.no_of_shares != self.to_no - self.from_no + 1: if self.no_of_shares != self.to_no - self.from_no + 1:
frappe.throw('The number of shares and the share numbers are inconsistent!') frappe.throw(_('The number of shares and the share numbers are inconsistent'))
if self.amount is None: if self.amount is None:
self.amount = self.rate * self.no_of_shares self.amount = self.rate * self.no_of_shares
if self.amount != self.rate * self.no_of_shares: if self.amount != self.rate * self.no_of_shares:
frappe.throw('There\'s inconsistency between the rate, no of shares and the amount calculated') frappe.throw(_('There are inconsistencies between the rate, no of shares and the amount calculated'))
def share_exists(self, shareholder): def share_exists(self, shareholder):
# return True if exits, # return True if exits,
@ -177,13 +182,14 @@ class ShareTransfer(Document):
for shareholder in shareholders: for shareholder in shareholders:
doc = frappe.get_doc('Shareholder', self.get(shareholder)) doc = frappe.get_doc('Shareholder', self.get(shareholder))
if doc.company != self.company: if doc.company != self.company:
frappe.throw('The shareholder doesn\'t belong to this company') frappe.throw(_('The shareholder does not belong to this company'))
if doc.folio_no is '' or doc.folio_no is None: if doc.folio_no is '' or doc.folio_no is None:
doc.folio_no = self.from_folio_no if (shareholder == 'from_shareholder') else self.to_folio_no; doc.folio_no = self.from_folio_no \
if (shareholder == 'from_shareholder') else self.to_folio_no;
doc.save() doc.save()
else: else:
if doc.folio_no != (self.from_folio_no if (shareholder == 'from_shareholder') else self.to_folio_no): if doc.folio_no != (self.from_folio_no if (shareholder == 'from_shareholder') else self.to_folio_no):
frappe.throw('The folio numbers are not matching') frappe.throw(_('The folio numbers are not matching'))
def autoname_folio(self, shareholder, is_company=False): def autoname_folio(self, shareholder, is_company=False):
if is_company: if is_company:

View File

@ -1,76 +0,0 @@
[
{
"doctype" : "Company",
"company_name" : "Stark Tower",
"abbr" : "ST",
"default_currency" : "INR"
},
{
"doctype" : "Share Type",
"title" : "Class A"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Issue",
"date" : "2018-01-01",
"to_shareholder" : "SH-00001",
"share_type" : "Equity",
"from_no" : 1,
"to_no" : 500,
"no_of_shares" : 500,
"rate" : 10,
"company" : "Stark Tower"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Transfer",
"date" : "2018-01-02",
"from_shareholder" : "SH-00001",
"to_shareholder" : "SH-00002",
"share_type" : "Equity",
"from_no" : 101,
"to_no" : 200,
"no_of_shares" : 100,
"rate" : 15,
"company" : "Stark Tower"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Transfer",
"date" : "2018-01-03",
"from_shareholder" : "SH-00001",
"to_shareholder" : "SH-00003",
"share_type" : "Equity",
"from_no" : 201,
"to_no" : 500,
"no_of_shares" : 300,
"rate" : 20,
"company" : "Stark Tower"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Transfer",
"date" : "2018-01-04",
"from_shareholder" : "SH-00001",
"to_shareholder" : "SH-00002",
"share_type" : "Equity",
"from_no" : 201,
"to_no" : 400,
"no_of_shares" : 200,
"rate" : 15,
"company" : "Stark Tower"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Purchase",
"date" : "2018-01-05",
"from_shareholder" : "SH-00003",
"share_type" : "Equity",
"from_no" : 401,
"to_no" : 500,
"no_of_shares" : 100,
"rate" : 25,
"company" : "Stark Tower"
}
]

View File

@ -5,11 +5,82 @@ from __future__ import unicode_literals
import frappe import frappe
import unittest import unittest
from frappe import ValidationError from erpnext.accounts.doctype.share_transfer.share_transfer import ShareDontExists
test_dependencies = ["Share Type", "Shareholder"] test_dependencies = ["Share Type", "Shareholder"]
class TestShareTransfer(unittest.TestCase): class TestShareTransfer(unittest.TestCase):
def setUp(self):
frappe.db.sql("delete from `tabShare Transfer`")
frappe.db.sql("delete from `tabShare Balance`")
share_transfers = [
{
"doctype" : "Share Transfer",
"transfer_type" : "Issue",
"date" : "2018-01-01",
"to_shareholder" : "SH-00001",
"share_type" : "Equity",
"from_no" : 1,
"to_no" : 500,
"no_of_shares" : 500,
"rate" : 10,
"company" : "_Test Company"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Transfer",
"date" : "2018-01-02",
"from_shareholder" : "SH-00001",
"to_shareholder" : "SH-00002",
"share_type" : "Equity",
"from_no" : 101,
"to_no" : 200,
"no_of_shares" : 100,
"rate" : 15,
"company" : "_Test Company"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Transfer",
"date" : "2018-01-03",
"from_shareholder" : "SH-00001",
"to_shareholder" : "SH-00003",
"share_type" : "Equity",
"from_no" : 201,
"to_no" : 500,
"no_of_shares" : 300,
"rate" : 20,
"company" : "_Test Company"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Transfer",
"date" : "2018-01-04",
"from_shareholder" : "SH-00003",
"to_shareholder" : "SH-00002",
"share_type" : "Equity",
"from_no" : 201,
"to_no" : 400,
"no_of_shares" : 200,
"rate" : 15,
"company" : "_Test Company"
},
{
"doctype" : "Share Transfer",
"transfer_type" : "Purchase",
"date" : "2018-01-05",
"from_shareholder" : "SH-00003",
"share_type" : "Equity",
"from_no" : 401,
"to_no" : 500,
"no_of_shares" : 100,
"rate" : 25,
"company" : "_Test Company"
}
]
for d in share_transfers:
frappe.get_doc(d).insert()
def test_invalid_share_transfer(self): def test_invalid_share_transfer(self):
doc = frappe.get_doc({ doc = frappe.get_doc({
"doctype" : "Share Transfer", "doctype" : "Share Transfer",
@ -22,11 +93,10 @@ class TestShareTransfer(unittest.TestCase):
"to_no" : 100, "to_no" : 100,
"no_of_shares" : 100, "no_of_shares" : 100,
"rate" : 15, "rate" : 15,
"company" : "Stark Tower" "company" : "_Test Company"
}) })
self.assertRaises(ValidationError, doc.insert) self.assertRaises(ShareDontExists, doc.insert)
def test_invalid_share_purchase(self):
doc = frappe.get_doc({ doc = frappe.get_doc({
"doctype" : "Share Transfer", "doctype" : "Share Transfer",
"transfer_type" : "Purchase", "transfer_type" : "Purchase",
@ -37,6 +107,6 @@ class TestShareTransfer(unittest.TestCase):
"to_no" : 200, "to_no" : 200,
"no_of_shares" : 200, "no_of_shares" : 200,
"rate" : 15, "rate" : 15,
"company" : "Stark Tower" "company" : "_Test Company"
}) })
self.assertRaises(ValidationError, doc.insert) self.assertRaises(ShareDontExists, doc.insert)

View File

@ -42,7 +42,7 @@
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 1 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
@ -79,6 +79,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"default": "SH-",
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -477,7 +478,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-01-23 17:49:02.941363", "modified": "2018-02-13 06:43:36.319549",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Shareholder", "name": "Shareholder",

View File

@ -1,17 +1,20 @@
[ [
{ {
"doctype": "Shareholder", "doctype": "Shareholder",
"series": "SH-", "naming_series": "SH-",
"title": "Iron Man" "title": "Iron Man",
"company": "_Test Company"
}, },
{ {
"doctype": "Shareholder", "doctype": "Shareholder",
"series": "SH-", "naming_series": "SH-",
"title": "Thor" "title": "Thor",
"company": "_Test Company"
}, },
{ {
"doctype": "Shareholder", "doctype": "Shareholder",
"series": "SH-", "naming_series": "SH-",
"title": "Hulk" "title": "Hulk",
"company": "_Test Company"
} }
] ]

View File

@ -11,6 +11,8 @@ from frappe.contacts.doctype.address.address import get_default_address
from frappe.utils.nestedset import get_root_of from frappe.utils.nestedset import get_root_of
from erpnext.setup.doctype.customer_group.customer_group import get_parent_customer_groups from erpnext.setup.doctype.customer_group.customer_group import get_parent_customer_groups
from six import iteritems
class IncorrectCustomerGroup(frappe.ValidationError): pass class IncorrectCustomerGroup(frappe.ValidationError): pass
class IncorrectSupplierType(frappe.ValidationError): pass class IncorrectSupplierType(frappe.ValidationError): pass
class ConflictingTaxRule(frappe.ValidationError): pass class ConflictingTaxRule(frappe.ValidationError): pass
@ -133,7 +135,7 @@ def get_tax_template(posting_date, args):
conditions = ["""(from_date is null or from_date <= '{0}') conditions = ["""(from_date is null or from_date <= '{0}')
and (to_date is null or to_date >= '{0}')""".format(posting_date)] and (to_date is null or to_date >= '{0}')""".format(posting_date)]
for key, value in args.iteritems(): for key, value in iteritems(args):
if key=="use_for_shopping_cart": if key=="use_for_shopping_cart":
conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0)) conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0))
if key == 'customer_group': if key == 'customer_group':

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
class Crop(Document): class Crop(Document):
@ -12,7 +13,7 @@ class Crop(Document):
for task in self.agriculture_task: for task in self.agriculture_task:
# validate start_day is not > end_day # validate start_day is not > end_day
if task.start_day > task.end_day: if task.start_day > task.end_day:
frappe.throw("Start day is greater than end day in task '{0}'".format(task.subject)) frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.subject))
# to calculate the period of the Crop Cycle # to calculate the period of the Crop Cycle
if task.end_day > max_period: max_period = task.end_day if task.end_day > max_period: max_period = task.end_day
if max_period > self.period: self.period = max_period if max_period > self.period: self.period = max_period

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
import ast import ast
@ -31,7 +32,7 @@ class CropCycle(Document):
old_disease.append(detected_disease.name) old_disease.append(detected_disease.name)
if list(set(new_disease)-set(old_disease)) != []: if list(set(new_disease)-set(old_disease)) != []:
self.update_disease(list(set(new_disease)-set(old_disease))) self.update_disease(list(set(new_disease)-set(old_disease)))
frappe.msgprint("All tasks for the detected diseases were imported") frappe.msgprint(_("All tasks for the detected diseases were imported"))
def update_disease(self, disease_hashes): def update_disease(self, disease_hashes):
new_disease = [] new_disease = []

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
class Disease(Document): class Disease(Document):
@ -12,7 +13,7 @@ class Disease(Document):
for task in self.treatment_task: for task in self.treatment_task:
# validate start_day is not > end_day # validate start_day is not > end_day
if task.start_day > task.end_day: if task.start_day > task.end_day:
frappe.throw("Start day is greater than end day in task '{0}'".format(task.task_name)) frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name))
# to calculate the period of the Crop Cycle # to calculate the period of the Crop Cycle
if task.end_day > max_period: max_period = task.end_day if task.end_day > max_period: max_period = task.end_day
self.treatment_period = max_period self.treatment_period = max_period

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import flt, cint from frappe.utils import flt, cint
@ -20,9 +21,9 @@ class SoilTexture(Document):
self.update_soil_edit('sand_composition') self.update_soil_edit('sand_composition')
for soil_type in self.soil_types: for soil_type in self.soil_types:
if self.get(soil_type) > 100 or self.get(soil_type) < 0: if self.get(soil_type) > 100 or self.get(soil_type) < 0:
frappe.throw("{0} should be a value between 0 and 100".format(soil_type)) frappe.throw(_("{0} should be a value between 0 and 100").format(soil_type))
if sum(self.get(soil_type) for soil_type in self.soil_types) != 100: if sum(self.get(soil_type) for soil_type in self.soil_types) != 100:
frappe.throw('Soil compositions do not add up to 100') frappe.throw(_('Soil compositions do not add up to 100'))
def update_soil_edit(self, soil_type): def update_soil_edit(self, soil_type):
self.soil_edit_order[self.soil_types.index(soil_type)] = max(self.soil_edit_order)+1 self.soil_edit_order[self.soil_types.index(soil_type)] = max(self.soil_edit_order)+1

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
class WaterAnalysis(Document): class WaterAnalysis(Document):
@ -18,6 +19,6 @@ class WaterAnalysis(Document):
def validate(self): def validate(self):
if self.collection_datetime > self.laboratory_testing_datetime: if self.collection_datetime > self.laboratory_testing_datetime:
frappe.throw('Lab testing datetime cannot be before collection datetime') frappe.throw(_('Lab testing datetime cannot be before collection datetime'))
if self.laboratory_testing_datetime > self.result_datetime: if self.laboratory_testing_datetime > self.result_datetime:
frappe.throw('Lab result datetime cannot be before testing datetime') frappe.throw(_('Lab result datetime cannot be before testing datetime'))

View File

@ -94,7 +94,7 @@ frappe.query_reports["Quoted Item Comparison"] = {
}, },
freeze: true, freeze: true,
callback: (r) => { callback: (r) => {
frappe.msgprint("Successfully Set Supplier"); frappe.msgprint(__("Successfully Set Supplier"));
dialog.hide(); dialog.hide();
} }
}); });

View File

@ -194,7 +194,7 @@ class Opportunity(TransactionBase):
self.customer = None self.customer = None
elif self.enquiry_from == 'Customer': elif self.enquiry_from == 'Customer':
if not self.customer: if not self.customer:
msgprint("Customer is mandatory if 'Opportunity From' is selected as Customer", raise_exception=1) msgprint(_("Customer is mandatory if 'Opportunity From' is selected as Customer"), raise_exception=1)
else: else:
self.lead = None self.lead = None

View File

@ -335,7 +335,7 @@ def get_assessment_result_doc(student, assessment_plan):
if doc.docstatus == 0: if doc.docstatus == 0:
return doc return doc
elif doc.docstatus == 1: elif doc.docstatus == 1:
frappe.msgprint("Result already Submitted") frappe.msgprint(_("Result already Submitted"))
return None return None
else: else:
return frappe.new_doc("Assessment Result") return frappe.new_doc("Assessment Result")

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
STD_CRITERIA = ["total", "total score", "total grade", "maximum score", "score", "grade"] STD_CRITERIA = ["total", "total score", "total grade", "maximum score", "score", "grade"]
@ -11,4 +12,4 @@ STD_CRITERIA = ["total", "total score", "total grade", "maximum score", "score",
class AssessmentCriteria(Document): class AssessmentCriteria(Document):
def validate(self): def validate(self):
if self.assessment_criteria.lower() in STD_CRITERIA: if self.assessment_criteria.lower() in STD_CRITERIA:
frappe.throw("Can't create standard criteria. Please rename the criteria") frappe.throw(_("Can't create standard criteria. Please rename the criteria"))

View File

@ -18,7 +18,7 @@ class Instructor(Document):
self.name = make_autoname(self.naming_series + '.####') self.name = make_autoname(self.naming_series + '.####')
elif naming_method == 'Employee Number': elif naming_method == 'Employee Number':
if not self.employee: if not self.employee:
frappe.throw("Please select Employee") frappe.throw(_("Please select Employee"))
self.name = self.employee self.name = self.employee
elif naming_method == 'Full Name': elif naming_method == 'Full Name':
self.name = self.instructor_name self.name = self.instructor_name

View File

@ -63,4 +63,4 @@ class ProgramEnrollmentTool(Document):
prog_enrollment.academic_term = self.academic_term prog_enrollment.academic_term = self.academic_term
prog_enrollment.student_batch_name = stud.student_batch_name if stud.student_batch_name else self.new_student_batch prog_enrollment.student_batch_name = stud.student_batch_name if stud.student_batch_name else self.new_student_batch
prog_enrollment.save() prog_enrollment.save()
frappe.msgprint("{0} Students have been enrolled.".format(total)) frappe.msgprint(_("{0} Students have been enrolled").format(total))

View File

@ -41,7 +41,7 @@ frappe.ui.form.on('Consultation', {
frappe.route_options = {"patient": frm.doc.patient}; frappe.route_options = {"patient": frm.doc.patient};
frappe.set_route("medical_record"); frappe.set_route("medical_record");
} else { } else {
frappe.msgprint("Please select Patient"); frappe.msgprint(__("Please select Patient"));
} }
},"View"); },"View");
frm.add_custom_button(__('Vital Signs'), function() { frm.add_custom_button(__('Vital Signs'), function() {
@ -121,7 +121,7 @@ var btn_invoice_consultation = function(frm){
var create_medical_record = function (frm) { var create_medical_record = function (frm) {
if(!frm.doc.patient){ if(!frm.doc.patient){
frappe.throw("Please select patient"); frappe.throw(__("Please select patient"));
} }
frappe.route_options = { frappe.route_options = {
"patient": frm.doc.patient, "patient": frm.doc.patient,
@ -134,7 +134,7 @@ var create_medical_record = function (frm) {
var btn_create_vital_signs = function (frm) { var btn_create_vital_signs = function (frm) {
if(!frm.doc.patient){ if(!frm.doc.patient){
frappe.throw("Please select patient"); frappe.throw(__("Please select patient"));
} }
frappe.route_options = { frappe.route_options = {
"patient": frm.doc.patient, "patient": frm.doc.patient,

View File

@ -21,7 +21,7 @@ class Consultation(Document):
def on_submit(self): def on_submit(self):
if not self.diagnosis or not self.symptoms: if not self.diagnosis or not self.symptoms:
frappe.throw("Diagnosis and Complaints cannot be left blank") frappe.throw(_("Diagnosis and Complaints cannot be left blank"))
def on_cancel(self): def on_cancel(self):
if(self.appointment): if(self.appointment):

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.core.doctype.sms_settings.sms_settings import send_sms from frappe.core.doctype.sms_settings.sms_settings import send_sms
import json import json
@ -15,7 +16,7 @@ class HealthcareSettings(Document):
frappe.db.set_default(key, self.get(key, "")) frappe.db.set_default(key, self.get(key, ""))
if(self.collect_registration_fee): if(self.collect_registration_fee):
if self.registration_fee <= 0 : if self.registration_fee <= 0 :
frappe.throw("Registration fee can not be Zero") frappe.throw(_("Registration fee can not be Zero"))
@frappe.whitelist() @frappe.whitelist()
def get_sms_text(doc): def get_sms_text(doc):

View File

@ -101,14 +101,14 @@ frappe.ui.form.on("Lab Test", "patient", function(frm) {
frappe.ui.form.on('Normal Test Items', { frappe.ui.form.on('Normal Test Items', {
normal_test_items_remove: function() { normal_test_items_remove: function() {
frappe.msgprint("Not permitted, configure Lab Test Template as required"); frappe.msgprint(__("Not permitted, configure Lab Test Template as required"));
cur_frm.reload_doc(); cur_frm.reload_doc();
} }
}); });
frappe.ui.form.on('Special Test Items', { frappe.ui.form.on('Special Test Items', {
special_test_items_remove: function() { special_test_items_remove: function() {
frappe.msgprint("Not permitted, configure Lab Test Template as required"); frappe.msgprint(__("Not permitted, configure Lab Test Template as required"));
cur_frm.reload_doc(); cur_frm.reload_doc();
} }
}); });
@ -142,7 +142,7 @@ var get_lab_test_prescribed = function(frm){
}); });
} }
else{ else{
frappe.msgprint("Please select Patient to get Lab Tests"); frappe.msgprint(__("Please select Patient to get Lab Tests"));
} }
}; };
@ -217,7 +217,7 @@ cur_frm.cscript.custom_before_submit = function(doc) {
if(doc.normal_test_items){ if(doc.normal_test_items){
for(let result in doc.normal_test_items){ for(let result in doc.normal_test_items){
if(!doc.normal_test_items[result].result_value && doc.normal_test_items[result].require_result_value == 1){ if(!doc.normal_test_items[result].result_value && doc.normal_test_items[result].require_result_value == 1){
frappe.msgprint("Please input all required Result Value(s)"); frappe.msgprint(__("Please input all required Result Value(s)"));
throw("Error"); throw("Error");
} }
} }
@ -225,7 +225,7 @@ cur_frm.cscript.custom_before_submit = function(doc) {
if(doc.special_test_items){ if(doc.special_test_items){
for(let result in doc.special_test_items){ for(let result in doc.special_test_items){
if(!doc.special_test_items[result].result_value && doc.special_test_items[result].require_result_value == 1){ if(!doc.special_test_items[result].result_value && doc.special_test_items[result].require_result_value == 1){
frappe.msgprint("Please input all required Result Value(s)"); frappe.msgprint(__("Please input all required Result Value(s)"));
throw("Error"); throw("Error");
} }
} }

View File

@ -36,7 +36,7 @@ class LabTestTemplate(Document):
try: try:
frappe.delete_doc("Item",self.item) frappe.delete_doc("Item",self.item)
except Exception: except Exception:
frappe.throw("""Not permitted. Please disable the Test Template""") frappe.throw(_("""Not permitted. Please disable the Test Template"""))
def item_price_exist(doc): def item_price_exist(doc):
item_price = frappe.db.exists({ item_price = frappe.db.exists({

View File

@ -53,7 +53,7 @@ frappe.ui.form.on("Patient", "dob", function(frm) {
var today = new Date(); var today = new Date();
var birthDate = new Date(frm.doc.dob); var birthDate = new Date(frm.doc.dob);
if(today < birthDate){ if(today < birthDate){
frappe.msgprint("Please select a valid Date"); frappe.msgprint(__("Please select a valid Date"));
frappe.model.set_value(frm.doctype,frm.docname, "dob", ""); frappe.model.set_value(frm.doctype,frm.docname, "dob", "");
} }
else{ else{
@ -83,7 +83,7 @@ var get_age = function (birth) {
var btn_create_vital_signs = function (frm) { var btn_create_vital_signs = function (frm) {
if (!frm.doc.name) { if (!frm.doc.name) {
frappe.throw("Please save the patient first"); frappe.throw(__("Please save the patient first"));
} }
frappe.route_options = { frappe.route_options = {
"patient": frm.doc.name, "patient": frm.doc.name,
@ -93,7 +93,7 @@ var btn_create_vital_signs = function (frm) {
var btn_create_consultation = function (frm) { var btn_create_consultation = function (frm) {
if (!frm.doc.name) { if (!frm.doc.name) {
frappe.throw("Please save the patient first"); frappe.throw(__("Please save the patient first"));
} }
frappe.route_options = { frappe.route_options = {
"patient": frm.doc.name, "patient": frm.doc.name,

View File

@ -116,8 +116,9 @@ def make_invoice(patient, company):
def get_patient_detail(patient): def get_patient_detail(patient):
patient_dict = frappe.db.sql("""select * from tabPatient where name=%s""", (patient), as_dict=1) patient_dict = frappe.db.sql("""select * from tabPatient where name=%s""", (patient), as_dict=1)
if not patient_dict: if not patient_dict:
frappe.throw("Patient not found") frappe.throw(_("Patient not found"))
vital_sign = frappe.db.sql("""select * from `tabVital Signs` where patient=%s order by signs_date desc limit 1""", (patient), as_dict=1) vital_sign = frappe.db.sql("""select * from `tabVital Signs` where patient=%s
order by signs_date desc limit 1""", (patient), as_dict=1)
details = patient_dict[0] details = patient_dict[0]
if vital_sign: if vital_sign:

View File

@ -181,7 +181,7 @@ var btn_create_consultation = function(frm){
var btn_create_vital_signs = function (frm) { var btn_create_vital_signs = function (frm) {
if(!frm.doc.patient){ if(!frm.doc.patient){
frappe.throw("Please select patient"); frappe.throw(__("Please select patient"));
} }
frappe.route_options = { frappe.route_options = {
"patient": frm.doc.patient, "patient": frm.doc.patient,

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe import frappe
import unittest import unittest
test_dependents = ["Hotel Room Package"] test_dependencies = ["Hotel Room Package"]
test_records = [ test_records = [
dict(doctype="Hotel Room", name="1001", dict(doctype="Hotel Room", name="1001",
hotel_room_type="Basic Room"), hotel_room_type="Basic Room"),

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe import frappe
import unittest import unittest
test_dependencies = ["Hotel Room Package"]
test_records = [ test_records = [
dict(doctype="Hotel Room Pricing", enabled=1, dict(doctype="Hotel Room Pricing", enabled=1,
name="Winter 2017", name="Winter 2017",

View File

@ -6,7 +6,7 @@ from __future__ import unicode_literals
import frappe import frappe
import unittest import unittest
from erpnext.hotels.doctype.hotel_room_reservation.hotel_room_reservation import HotelRoomPricingNotSetError, HotelRoomUnavailableError from erpnext.hotels.doctype.hotel_room_reservation.hotel_room_reservation import HotelRoomPricingNotSetError, HotelRoomUnavailableError
test_dependencies = ["Hotel Room Pricing", "Hotel Room"] test_dependencies = ["Hotel Room Package", "Hotel Room Pricing", "Hotel Room"]
class TestHotelRoomReservation(unittest.TestCase): class TestHotelRoomReservation(unittest.TestCase):
def setUp(self): def setUp(self):

View File

@ -311,7 +311,7 @@ frappe.ui.form.on("Expense Claim Advance", {
employee_advance: function(frm, cdt, cdn) { employee_advance: function(frm, cdt, cdn) {
var child = locals[cdt][cdn]; var child = locals[cdt][cdn];
if(!frm.doc.employee){ if(!frm.doc.employee){
frappe.msgprint('Select an employee to get the employee advance.'); frappe.msgprint(__('Select an employee to get the employee advance.'));
frm.doc.advances = []; frm.doc.advances = [];
refresh_field("advances"); refresh_field("advances");
} }

View File

@ -245,10 +245,6 @@ class TestLeaveApplication(unittest.TestCase):
application.insert() application.insert()
frappe.set_user("test@example.com") frappe.set_user("test@example.com")
# clear permlevel access cache on change user
del application._has_access_to
self.assertRaises(LeaveDayBlockedError, application.submit) self.assertRaises(LeaveDayBlockedError, application.submit)
frappe.db.set_value("Leave Block List", "_Test Leave Block List", frappe.db.set_value("Leave Block List", "_Test Leave Block List",

View File

@ -455,13 +455,13 @@ def format_as_links(salary_slip):
def create_submit_log(submitted_ss, not_submitted_ss, jv_name): def create_submit_log(submitted_ss, not_submitted_ss, jv_name):
if not submitted_ss and not not_submitted_ss: if not submitted_ss and not not_submitted_ss:
frappe.msgprint("No salary slip found to submit for the above selected criteria OR salary slip already submitted") frappe.msgprint(_("No salary slip found to submit for the above selected criteria OR salary slip already submitted"))
if not_submitted_ss: if not_submitted_ss:
frappe.msgprint("Could not submit any Salary Slip <br>\ frappe.msgprint(_("Could not submit any Salary Slip <br>\
Possible reasons: <br>\ Possible reasons: <br>\
1. Net pay is less than 0. <br>\ 1. Net pay is less than 0. <br>\
2. Company Email Address specified in employee master is not valid. <br>") 2. Company Email Address specified in employee master is not valid. <br>"))
def get_salary_slip_list(name, docstatus, as_dict=0): def get_salary_slip_list(name, docstatus, as_dict=0):

View File

@ -28,6 +28,11 @@
"is_child_table": 0, "is_child_table": 0,
"local_fieldname": "eval:frappe.session.user", "local_fieldname": "eval:frappe.session.user",
"remote_fieldname": "user" "remote_fieldname": "user"
},
{
"is_child_table": 0,
"local_fieldname": "company_logo",
"remote_fieldname": "company_logo"
} }
], ],
"idx": 2, "idx": 2,
@ -35,8 +40,8 @@
"mapping_name": "Company to Hub Company", "mapping_name": "Company to Hub Company",
"mapping_type": "Push", "mapping_type": "Push",
"migration_id_field": "hub_sync_id", "migration_id_field": "hub_sync_id",
"modified": "2017-10-09 17:30:17.853929", "modified": "2018-02-14 15:57:05.571142",
"modified_by": "Administrator", "modified_by": "achilles@erpnext.com",
"name": "Company to Hub Company", "name": "Company to Hub Company",
"owner": "Administrator", "owner": "Administrator",
"page_length": 10, "page_length": 10,

View File

@ -21,8 +21,8 @@
"mapping_name": "Hub Message to Lead", "mapping_name": "Hub Message to Lead",
"mapping_type": "Pull", "mapping_type": "Pull",
"migration_id_field": "hub_sync_id", "migration_id_field": "hub_sync_id",
"modified": "2017-10-09 17:30:17.908830", "modified": "2018-02-14 15:57:05.606597",
"modified_by": "Administrator", "modified_by": "achilles@erpnext.com",
"name": "Hub Message to Lead", "name": "Hub Message to Lead",
"owner": "frappetest@gmail.com", "owner": "frappetest@gmail.com",
"page_length": 10, "page_length": 10,

View File

@ -45,8 +45,8 @@
"mapping_name": "Item to Hub Item", "mapping_name": "Item to Hub Item",
"mapping_type": "Push", "mapping_type": "Push",
"migration_id_field": "hub_sync_id", "migration_id_field": "hub_sync_id",
"modified": "2017-10-09 17:30:17.890337", "modified": "2018-02-14 15:57:05.595712",
"modified_by": "Administrator", "modified_by": "achilles@erpnext.com",
"name": "Item to Hub Item", "name": "Item to Hub Item",
"owner": "Administrator", "owner": "Administrator",
"page_length": 10, "page_length": 10,

View File

@ -17,8 +17,8 @@
"mapping": "Hub Message to Lead" "mapping": "Hub Message to Lead"
} }
], ],
"modified": "2017-10-09 17:30:17.680059", "modified": "2018-02-14 15:57:05.519715",
"modified_by": "Administrator", "modified_by": "achilles@erpnext.com",
"module": "Hub Node", "module": "Hub Node",
"name": "Hub Sync", "name": "Hub Sync",
"owner": "Administrator", "owner": "Administrator",

View File

@ -46,7 +46,7 @@ frappe.ui.form.on("Hub Settings", {
set_enable_hub_primary_button: (frm) => { set_enable_hub_primary_button: (frm) => {
frm.page.set_primary_action(__("Enable Hub"), () => { frm.page.set_primary_action(__("Enable Hub"), () => {
if(frappe.session.user === "Administrator") { if(frappe.session.user === "Administrator") {
frappe.msgprint("Please login as another user.") frappe.msgprint(__("Please login as another user."))
} else { } else {
frappe.verify_password(() => { frappe.verify_password(() => {
this.frm.call({ this.frm.call({

View File

@ -492,5 +492,5 @@ erpnext.patches.v10_0.added_extra_gst_custom_field
erpnext.patches.v10_0.workflow_leave_application #2018-01-24 #2018-02-02 #2018-02-08 erpnext.patches.v10_0.workflow_leave_application #2018-01-24 #2018-02-02 #2018-02-08
erpnext.patches.v10_0.set_default_payment_terms_based_on_company erpnext.patches.v10_0.set_default_payment_terms_based_on_company
erpnext.patches.v10_0.update_sales_order_link_to_purchase_order erpnext.patches.v10_0.update_sales_order_link_to_purchase_order
erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2 erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2 #2018-02-13
erpnext.patches.v10_0.item_barcode_childtable_migrate erpnext.patches.v10_0.item_barcode_childtable_migrate

View File

@ -7,3 +7,12 @@ def execute():
return return
make_custom_fields() make_custom_fields()
frappe.db.sql("""
update `tabCustom Field`
set reqd = 0, `default` = ''
where fieldname = 'reason_for_issuing_document'
""")
frappe.db.sql("""delete from `tabCustom Field` where dt = 'Purchase Invoice'
and fieldname in ('port_code', 'shipping_bill_number', 'shipping_bill_date')""")

View File

@ -3,7 +3,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from erpnext.stock.doctype.bin.bin import update_item_projected_qty
def execute(): def execute():
repost_bin_qty() repost_bin_qty()

View File

@ -133,7 +133,7 @@ var get_payment_mode_account = function(frm, mode_of_payment, callback) {
cur_frm.cscript.account_head = function(doc, cdt, cdn) { cur_frm.cscript.account_head = function(doc, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if(!d.charge_type && d.account_head){ if(!d.charge_type && d.account_head){
frappe.msgprint("Please select Charge Type first"); frappe.msgprint(__("Please select Charge Type first"));
frappe.model.set_value(cdt, cdn, "account_head", ""); frappe.model.set_value(cdt, cdn, "account_head", "");
} else if(d.account_head && d.charge_type!=="Actual") { } else if(d.account_head && d.charge_type!=="Actual") {
frappe.call({ frappe.call({

View File

@ -253,9 +253,11 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
cur_frm.doc.items[i].stock_qty = my_qty*cur_frm.doc.items[i].conversion_factor; cur_frm.doc.items[i].stock_qty = my_qty*cur_frm.doc.items[i].conversion_factor;
cur_frm.doc.items[i].qty = my_qty; cur_frm.doc.items[i].qty = my_qty;
frappe.msgprint("Assigning " + d.mr_name + " to " + d.item_code + " (row " + cur_frm.doc.items[i].idx + ")"); frappe.msgprint(__("Assigning {0} to {1} (row {2})",
[d.mr_name, d.item_code, cur_frm.doc.items[i].idx]);
if (qty > 0) { if (qty > 0) {
frappe.msgprint("Splitting " + qty + " units of " + d.item_code); frappe.msgprint(__("Splitting {0} units of {1}", [qty, d.item_code]);
var newrow = frappe.model.add_child(cur_frm.doc, cur_frm.doc.items[i].doctype, "items"); var newrow = frappe.model.add_child(cur_frm.doc, cur_frm.doc.items[i].doctype, "items");
item_length++; item_length++;

View File

@ -84,7 +84,7 @@ erpnext.setup.slides_settings = [
slide.get_input("company_abbr").on("change", function () { slide.get_input("company_abbr").on("change", function () {
if (slide.get_input("company_abbr").val().length > 5) { if (slide.get_input("company_abbr").val().length > 5) {
frappe.msgprint("Company Abbreviation cannot have more than 5 characters"); frappe.msgprint(__("Company Abbreviation cannot have more than 5 characters"));
slide.get_field("company_abbr").set_value(""); slide.get_field("company_abbr").set_value("");
} }
}); });

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, os import frappe, os
from frappe import _
from frappe.utils import get_url, nowdate, date_diff from frappe.utils import get_url, nowdate, date_diff
from frappe.model.document import Document from frappe.model.document import Document
from frappe.contacts.doctype.contact.contact import get_default_contact from frappe.contacts.doctype.contact.contact import get_default_contact
@ -24,13 +25,13 @@ def send_reminder():
last_sent = frappe.db.get_single_value('GST Settings', 'gstin_email_sent_on') last_sent = frappe.db.get_single_value('GST Settings', 'gstin_email_sent_on')
if last_sent and date_diff(nowdate(), last_sent) < 3: if last_sent and date_diff(nowdate(), last_sent) < 3:
frappe.throw("Please wait 3 days before resending the reminder.") frappe.throw(_("Please wait 3 days before resending the reminder."))
frappe.db.set_value('GST Settings', 'GST Settings', 'gstin_email_sent_on', nowdate()) frappe.db.set_value('GST Settings', 'GST Settings', 'gstin_email_sent_on', nowdate())
# enqueue if large number of customers, suppliser # enqueue if large number of customers, suppliser
frappe.enqueue('erpnext.regional.doctype.gst_settings.gst_settings.send_gstin_reminder_to_all_parties') frappe.enqueue('erpnext.regional.doctype.gst_settings.gst_settings.send_gstin_reminder_to_all_parties')
frappe.msgprint('Email Reminders will be sent to all parties with email contacts') frappe.msgprint(_('Email Reminders will be sent to all parties with email contacts'))
def send_gstin_reminder_to_all_parties(): def send_gstin_reminder_to_all_parties():
parties = [] parties = []
@ -60,7 +61,7 @@ def send_gstin_reminder(party_type, party):
frappe.has_permission(party_type, throw=True) frappe.has_permission(party_type, throw=True)
email = _send_gstin_reminder(party_type ,party) email = _send_gstin_reminder(party_type ,party)
if email: if email:
frappe.msgprint('Reminder to update GSTIN Sent', title='Reminder sent', indicator='green') frappe.msgprint(_('Reminder to update GSTIN Sent'), title='Reminder sent', indicator='green')
def _send_gstin_reminder(party_type, party, default_email_id=None, sent_to=None): def _send_gstin_reminder(party_type, party, default_email_id=None, sent_to=None):
'''Send GST Reminder email''' '''Send GST Reminder email'''
@ -70,7 +71,7 @@ def _send_gstin_reminder(party_type, party, default_email_id=None, sent_to=None)
email_id = default_email_id email_id = default_email_id
if not email_id: if not email_id:
frappe.throw('Email not found in default contact', exc=EmailMissing) frappe.throw(_('Email not found in default contact'), exc=EmailMissing)
if sent_to and email_id in sent_to: if sent_to and email_id in sent_to:
return return

View File

@ -95,7 +95,7 @@ def make_custom_fields():
fieldtype='Select', insert_after='invoice_copy', print_hide=1, fieldtype='Select', insert_after='invoice_copy', print_hide=1,
options='Y\nN', default='N'), options='Y\nN', default='N'),
dict(fieldname='invoice_type', label='Invoice Type', dict(fieldname='invoice_type', label='Invoice Type',
fieldtype='Select', insert_after='gst_col_break', print_hide=1, fieldtype='Select', insert_after='invoice_copy', print_hide=1,
options='Regular\nSEZ\nExport\nDeemed Export', default='Regular'), options='Regular\nSEZ\nExport\nDeemed Export', default='Regular'),
dict(fieldname='export_type', label='Export Type', dict(fieldname='export_type', label='Export Type',
fieldtype='Select', insert_after='invoice_type', print_hide=1, fieldtype='Select', insert_after='invoice_type', print_hide=1,
@ -103,10 +103,10 @@ def make_custom_fields():
options='\nWith Payment of Tax\nWithout Payment of Tax'), options='\nWith Payment of Tax\nWithout Payment of Tax'),
dict(fieldname='ecommerce_gstin', label='E-commerce GSTIN', dict(fieldname='ecommerce_gstin', label='E-commerce GSTIN',
fieldtype='Data', insert_after='export_type', print_hide=1), fieldtype='Data', insert_after='export_type', print_hide=1),
dict(fieldname='gst_col_break', fieldtype='Column Break', insert_after='reason_for_issuing_document'), dict(fieldname='gst_col_break', fieldtype='Column Break', insert_after='ecommerce_gstin'),
dict(fieldname='reason_for_issuing_document', label='Reason For Issuing document', dict(fieldname='reason_for_issuing_document', label='Reason For Issuing document',
fieldtype='Select', insert_after='gst_col_break', print_hide=1, fieldtype='Select', insert_after='gst_col_break', print_hide=1,
depends_on='eval:doc.is_return==1', reqd=1, depends_on='eval:doc.is_return==1',
options='\n01-Sales Return\n02-Post Sale Discount\n03-Deficiency in services\n04-Correction in Invoice\n05-Change in POS\n06-Finalization of Provisional assessment\n07-Others') options='\n01-Sales Return\n02-Post Sale Discount\n03-Deficiency in services\n04-Correction in Invoice\n05-Change in POS\n06-Finalization of Provisional assessment\n07-Others')
] ]

View File

@ -92,7 +92,7 @@ frappe.ui.form.on("Company", {
}, },
function(data) { function(data) {
if(data.company_name !== frm.doc.name) { if(data.company_name !== frm.doc.name) {
frappe.msgprint("Company name not same"); frappe.msgprint(__("Company name not same"));
return; return;
} }
frappe.call({ frappe.call({

View File

@ -2007,6 +2007,36 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "company_logo",
"fieldtype": "Attach Image",
"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": "Company Logo",
"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
} }
], ],
"has_web_view": 0, "has_web_view": 0,
@ -2014,6 +2044,7 @@
"hide_toolbar": 0, "hide_toolbar": 0,
"icon": "fa fa-building", "icon": "fa fa-building",
"idx": 1, "idx": 1,
"image_field": "company_logo",
"image_view": 0, "image_view": 0,
"in_create": 0, "in_create": 0,
"is_submittable": 0, "is_submittable": 0,
@ -2021,8 +2052,8 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2018-01-29 12:40:24.646920", "modified": "2018-02-14 15:54:26.776363",
"modified_by": "Administrator", "modified_by": "achilles@erpnext.com",
"module": "Setup", "module": "Setup",
"name": "Company", "name": "Company",
"owner": "Administrator", "owner": "Administrator",

View File

@ -27,7 +27,7 @@ class NamingSeries(Document):
try: try:
options = self.get_options(d) options = self.get_options(d)
except frappe.DoesNotExistError: except frappe.DoesNotExistError:
frappe.msgprint('Unable to find DocType {0}'.format(d)) frappe.msgprint(_('Unable to find DocType {0}').format(d))
#frappe.pass_does_not_exist_error() #frappe.pass_does_not_exist_error()
continue continue

View File

@ -115,8 +115,8 @@ class Batch(Document):
self.expiry_date = add_days(self.manufacturing_date, shelf_life_in_days) self.expiry_date = add_days(self.manufacturing_date, shelf_life_in_days)
if has_expiry_date and not self.expiry_date: if has_expiry_date and not self.expiry_date:
frappe.throw('Expiry date is mandatory for selected item') frappe.throw(_('Expiry date is mandatory for selected item'))
frappe.msgprint('Set items shelf life in days, to set expiry based on manufacturing_date plus self life ') frappe.msgprint(_('Set items shelf life in days, to set expiry based on manufacturing_date plus self life'))
def get_name_from_naming_series(self): def get_name_from_naming_series(self):
""" """

View File

@ -17,9 +17,11 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
from erpnext.accounts.doctype.account.test_account import get_inventory_account from erpnext.accounts.doctype.account.test_account import get_inventory_account
from erpnext.stock.doctype.stock_entry.stock_entry import move_sample_to_retention_warehouse from erpnext.stock.doctype.stock_entry.stock_entry import move_sample_to_retention_warehouse
from six import iteritems
def get_sle(**args): def get_sle(**args):
condition, values = "", [] condition, values = "", []
for key, value in args.iteritems(): for key, value in iteritems(args):
condition += " and " if condition else " where " condition += " and " if condition else " where "
condition += "`{0}`=%s".format(key) condition += "`{0}`=%s".format(key)
values.append(value) values.append(value)

View File

@ -8,6 +8,8 @@ from frappe.utils import cint, flt, cstr, now
from erpnext.stock.utils import get_valuation_method from erpnext.stock.utils import get_valuation_method
import json import json
from six import iteritems
# future reposting # future reposting
class NegativeStockError(frappe.ValidationError): pass class NegativeStockError(frappe.ValidationError): pass
@ -87,7 +89,7 @@ class update_entries_after(object):
"allow_negative_stock")) "allow_negative_stock"))
self.args = args self.args = args
for key, value in args.iteritems(): for key, value in iteritems(args):
setattr(self, key, value) setattr(self, key, value)
self.previous_sle = self.get_sle_before_datetime() self.previous_sle = self.get_sle_before_datetime()