Merge branch 'master' into develop
This commit is contained in:
commit
4b0dd8a159
@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '10.0.8'
|
__version__ = '10.0.9'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -252,7 +252,7 @@ def add_ac(args=None):
|
|||||||
if not ac.parent_account:
|
if not ac.parent_account:
|
||||||
ac.parent_account = args.get("parent")
|
ac.parent_account = args.get("parent")
|
||||||
|
|
||||||
if ac.is_root:
|
if getattr(ac, 'is_root', None):
|
||||||
ac.parent_account=''
|
ac.parent_account=''
|
||||||
|
|
||||||
ac.old_parent = ""
|
ac.old_parent = ""
|
||||||
|
@ -54,6 +54,7 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
if self.meta.get_field("taxes_and_charges"):
|
if self.meta.get_field("taxes_and_charges"):
|
||||||
self.validate_enabled_taxes_and_charges()
|
self.validate_enabled_taxes_and_charges()
|
||||||
|
self.validate_tax_account_company()
|
||||||
|
|
||||||
self.validate_party()
|
self.validate_party()
|
||||||
self.validate_currency()
|
self.validate_currency()
|
||||||
@ -255,6 +256,14 @@ class AccountsController(TransactionBase):
|
|||||||
if frappe.db.get_value(taxes_and_charges_doctype, self.taxes_and_charges, "disabled"):
|
if frappe.db.get_value(taxes_and_charges_doctype, self.taxes_and_charges, "disabled"):
|
||||||
frappe.throw(_("{0} '{1}' is disabled").format(taxes_and_charges_doctype, self.taxes_and_charges))
|
frappe.throw(_("{0} '{1}' is disabled").format(taxes_and_charges_doctype, self.taxes_and_charges))
|
||||||
|
|
||||||
|
def validate_tax_account_company(self):
|
||||||
|
for d in self.get("taxes"):
|
||||||
|
if d.account_head:
|
||||||
|
tax_account_company = frappe.db.get_value("Account", d.account_head, "company")
|
||||||
|
if tax_account_company != self.company:
|
||||||
|
frappe.throw(_("Row #{0}: Account {1} does not belong to company {2}")
|
||||||
|
.format(d.idx, d.account_head, self.company))
|
||||||
|
|
||||||
def get_gl_dict(self, args, account_currency=None):
|
def get_gl_dict(self, args, account_currency=None):
|
||||||
"""this method populates the common properties of a gl entry record"""
|
"""this method populates the common properties of a gl entry record"""
|
||||||
|
|
||||||
@ -722,11 +731,15 @@ def get_tax_rate(account_head):
|
|||||||
return frappe.db.get_value("Account", account_head, ["tax_rate", "account_name"], as_dict=True)
|
return frappe.db.get_value("Account", account_head, ["tax_rate", "account_name"], as_dict=True)
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_default_taxes_and_charges(master_doctype, company=None):
|
def get_default_taxes_and_charges(master_doctype, tax_template=None, company=None):
|
||||||
if not company: return {}
|
if not company: return {}
|
||||||
|
|
||||||
default_tax = frappe.db.get_value(master_doctype,
|
if tax_template and company:
|
||||||
{"is_default": 1, "company": company})
|
tax_template_company = frappe.db.get_value(master_doctype, tax_template, "company")
|
||||||
|
if tax_template_company == company:
|
||||||
|
return
|
||||||
|
|
||||||
|
default_tax = frappe.db.get_value(master_doctype, {"is_default": 1, "company": company})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'taxes_and_charges': default_tax,
|
'taxes_and_charges': default_tax,
|
||||||
|
@ -232,7 +232,7 @@ def make_quotation(source_name, target_doc=None):
|
|||||||
quotation.conversion_rate = exchange_rate
|
quotation.conversion_rate = exchange_rate
|
||||||
|
|
||||||
# get default taxes
|
# get default taxes
|
||||||
taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template", quotation.company)
|
taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template", company=quotation.company)
|
||||||
if taxes.get('taxes'):
|
if taxes.get('taxes'):
|
||||||
quotation.update(taxes)
|
quotation.update(taxes)
|
||||||
|
|
||||||
|
@ -35,4 +35,16 @@ def get_list_context(context):
|
|||||||
context.title = 'All Chapters'
|
context.title = 'All Chapters'
|
||||||
context.no_breadcrumbs = True
|
context.no_breadcrumbs = True
|
||||||
context.order_by = 'creation desc'
|
context.order_by = 'creation desc'
|
||||||
context.introduction = '<p>All Chapters</p>'
|
context.introduction = '<p>All Chapters</p>'
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def leave(title, user_id, leave_reason):
|
||||||
|
chapter = frappe.get_doc("Chapter", title)
|
||||||
|
for member in chapter.members:
|
||||||
|
if member.user == user_id:
|
||||||
|
member.enabled = 0
|
||||||
|
member.leave_reason = leave_reason
|
||||||
|
chapter.save(ignore_permissions=1)
|
||||||
|
frappe.db.commit()
|
||||||
|
return "Thank you for Feedback"
|
@ -5,34 +5,39 @@
|
|||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>{{ introduction }}</p>
|
<p>{{ introduction }}</p>
|
||||||
{% if meetup_embed_html %}
|
{% if meetup_embed_html %}
|
||||||
{{ meetup_embed_html }}
|
{{ meetup_embed_html }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h3>List of Members</h3>
|
<h3>List of Members</h3>
|
||||||
{% if members %}
|
|
||||||
|
{% if members %}
|
||||||
<table class="table table-bordered small" style="max-width: 500px;">
|
<table class="table table-bordered small" style="max-width: 500px;">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="15%" ></th>
|
<th width="15%" ></th>
|
||||||
<th>Member Details</th>
|
<th>Member Details</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% set index = [1] %}
|
||||||
{% for user in members %}
|
{% for user in members %}
|
||||||
<tr>
|
{% if user.enabled == 1 %}
|
||||||
<td>{{ loop.index }}</td>
|
<tr>
|
||||||
<td>
|
<td>{{ index|length }}</td>
|
||||||
<div class="row">
|
<td>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">{{ frappe.db.get_value('User', user.user, 'full_name') }}</div>
|
<div class="row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6">{{ frappe.db.get_value('User', user.user, 'full_name') }}</div>
|
||||||
{% if user.website_url %}
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
<a href="{{ user.website_url }}">{{ user.website_url or '' }}</a>
|
{% if user.website_url %}
|
||||||
|
<a href="{{ user.website_url }}">{{ user.website_url or '' }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
{% if user.introduction %}
|
||||||
|
{{ user.introduction }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-12">
|
</td>
|
||||||
{% if user.introduction %}
|
</tr>
|
||||||
{{ user.introduction }}
|
{% set __ = index.append(1) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -1,21 +1,30 @@
|
|||||||
{% if doc.published %}
|
{% if doc.published %}
|
||||||
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable">
|
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable">
|
||||||
<a href="/{{ doc.route }}">
|
<a href={{ route }}>
|
||||||
<h3>{{ doc.name }}</h3>
|
<h3>{{ doc.name }}</h3>
|
||||||
<p>
|
<p>
|
||||||
<span class="label">{{ frappe.db.get_value('User', chapter_head, 'full_name') }}</span>
|
<span class="label"> Chapter Head : {{ frappe.db.get_value('User', chapter_head, 'full_name') }} </span>
|
||||||
<span class="label">
|
<span class="label">
|
||||||
{% if members %}
|
{% if members %}
|
||||||
Members: {{ members|length }}
|
{% set index = [] %}
|
||||||
|
{% for user in members %}
|
||||||
|
{% if user.enabled == 1 %}
|
||||||
|
{% set __ = index.append(1) %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
Members: {{ index|length }}
|
||||||
{% else %}
|
{% else %}
|
||||||
Members: 0
|
Members: 0
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
|
<!-- Assignment of value to global variable not working in jinja -->
|
||||||
</p>
|
</p>
|
||||||
<p>{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}</p>
|
<p>{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}</p>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- this is a sample default list template -->
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
|
@ -132,6 +132,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": "leave_reason",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"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": "Leave Reason",
|
||||||
|
"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,
|
||||||
@ -144,7 +174,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-12-06 11:33:34.300252",
|
"modified": "2018-01-12 12:16:10.591039",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Non Profit",
|
"module": "Non Profit",
|
||||||
"name": "Chapter Member",
|
"name": "Chapter Member",
|
||||||
|
@ -295,7 +295,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-12-05 07:02:06.690416",
|
"modified": "2018-01-15 09:40:41.153561",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Non Profit",
|
"module": "Non Profit",
|
||||||
"name": "Donor",
|
"name": "Donor",
|
||||||
@ -330,6 +330,7 @@
|
|||||||
"show_name_in_global_search": 0,
|
"show_name_in_global_search": 0,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"title_field": "donor_name",
|
||||||
"track_changes": 1,
|
"track_changes": 1,
|
||||||
"track_seen": 0
|
"track_seen": 0
|
||||||
}
|
}
|
@ -325,7 +325,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-12-05 07:03:21.606732",
|
"modified": "2018-01-15 09:38:41.878167",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Non Profit",
|
"module": "Non Profit",
|
||||||
"name": "Member",
|
"name": "Member",
|
||||||
@ -380,6 +380,7 @@
|
|||||||
"show_name_in_global_search": 0,
|
"show_name_in_global_search": 0,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"title_field": "member_name",
|
||||||
"track_changes": 1,
|
"track_changes": 1,
|
||||||
"track_seen": 0
|
"track_seen": 0
|
||||||
}
|
}
|
@ -506,7 +506,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-12-06 12:03:08.624579",
|
"modified": "2018-01-15 09:40:25.229551",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Non Profit",
|
"module": "Non Profit",
|
||||||
"name": "Volunteer",
|
"name": "Volunteer",
|
||||||
@ -540,6 +540,7 @@
|
|||||||
"show_name_in_global_search": 0,
|
"show_name_in_global_search": 0,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"title_field": "volunteer_name",
|
||||||
"track_changes": 1,
|
"track_changes": 1,
|
||||||
"track_seen": 0
|
"track_seen": 0
|
||||||
}
|
}
|
@ -244,10 +244,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
method: "erpnext.controllers.accounts_controller.get_default_taxes_and_charges",
|
method: "erpnext.controllers.accounts_controller.get_default_taxes_and_charges",
|
||||||
args: {
|
args: {
|
||||||
"master_doctype": taxes_and_charges_field.options,
|
"master_doctype": taxes_and_charges_field.options,
|
||||||
|
"tax_template": me.frm.doc.taxes_and_charges,
|
||||||
"company": me.frm.doc.company
|
"company": me.frm.doc.company
|
||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(!r.exc) {
|
if(!r.exc && r.message) {
|
||||||
frappe.run_serially([
|
frappe.run_serially([
|
||||||
() => {
|
() => {
|
||||||
// directly set in doc, so as not to call triggers
|
// directly set in doc, so as not to call triggers
|
||||||
|
@ -204,7 +204,6 @@ def _get_cart_quotation(party=None):
|
|||||||
"status": "Draft",
|
"status": "Draft",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"__islocal": 1,
|
"__islocal": 1,
|
||||||
"payment_terms_template": "_Test Payment Term Template",
|
|
||||||
(party.doctype.lower()): party.name
|
(party.doctype.lower()): party.name
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from erpnext.shopping_cart.cart import _get_cart_quotation, update_cart, get_par
|
|||||||
from erpnext.tests.utils import create_test_contact_and_address
|
from erpnext.tests.utils import create_test_contact_and_address
|
||||||
|
|
||||||
|
|
||||||
test_dependencies = ['Payment Terms Template']
|
# test_dependencies = ['Payment Terms Template']
|
||||||
|
|
||||||
class TestShoppingCart(unittest.TestCase):
|
class TestShoppingCart(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
@ -11,18 +11,18 @@
|
|||||||
<p><a href="/login?redirect-to=/{{ chapter.route }}" class='btn btn-primary'>Login</a></p>
|
<p><a href="/login?redirect-to=/{{ chapter.route }}" class='btn btn-primary'>Login</a></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if already_member %}
|
{% if already_member %}
|
||||||
<p>You are already a member of {{ chapter.title }}!</p>
|
<p>You are already a member of {{ chapter.name }}!</p>
|
||||||
{{ chapter_button() }}
|
{{ chapter_button() }}
|
||||||
<p><a href="">Leave Chapter</a></p>
|
<p><a href="">Leave Chapter</a></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if frappe.local.request.method=='POST' %}
|
{% if frappe.local.request.method=='POST' %}
|
||||||
<p>Welcome to chapter {{ chapter.title }}!</p>
|
<p>Welcome to chapter {{ chapter.name }}!</p>
|
||||||
{{ chapter_button() }}
|
{{ chapter_button() }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div style="padding: 20px 0;">
|
<div style="padding: 20px 0;">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-8 col-md-8">
|
<div class="col-lg-8 col-md-8">
|
||||||
<form name="user-intro" action="/join-chapter" method='POST'>
|
<form name="user-intro" action="/non_profit/join-chapter" method='POST'>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input name="name" class="hidden form-control" type="text"
|
<input name="name" class="hidden form-control" type="text"
|
||||||
value="{{chapter.name}}">
|
value="{{chapter.name}}">
|
||||||
|
@ -4,7 +4,7 @@ def get_context(context):
|
|||||||
context.no_cache = True
|
context.no_cache = True
|
||||||
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
|
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
|
||||||
if frappe.session.user!='Guest':
|
if frappe.session.user!='Guest':
|
||||||
if frappe.session.user in [d.user for d in chapter.members]:
|
if frappe.session.user in [d.user for d in chapter.members if d.enabled == 1]:
|
||||||
context.already_member = True
|
context.already_member = True
|
||||||
else:
|
else:
|
||||||
if frappe.request.method=='GET':
|
if frappe.request.method=='GET':
|
||||||
|
@ -1,16 +1,42 @@
|
|||||||
{% extends "templates/web.html" %}
|
{% extends "templates/web.html" %}
|
||||||
<!--
|
|
||||||
{% macro chapter_button() %}
|
|
||||||
<p><a href="/{{ chapter.route }}" class='btn btn-primary'>
|
|
||||||
Go to Chapter Page</a></p>
|
|
||||||
{% endmacro %}
|
|
||||||
-->
|
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
|
|
||||||
{% if member_deleted %}
|
{% if member_deleted %}
|
||||||
<p>You are not a member of {{ chapter.title }}!</p>
|
<p>You are not a member of {{ chapter.name }}!</p>
|
||||||
|
<div>
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="leave">Why do you want to leave this chapter</label>
|
||||||
|
<input type="text" name="leave" class="form-control" id="leave">
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-default btn-leave" data-title= "{{ chapter.name }}" id="btn-leave">Submit
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
<p>Please signup and login to join this chapter</p>
|
<p>Please signup and login to join this chapter</p>
|
||||||
|
|
||||||
<p><a href="/join-chapter?name={{ chapter.name }}" class='btn btn-primary'>Become Member agian</a></p>
|
<p><a href="/join-chapter?name={{ chapter.name }}" class='btn btn-primary'>Become Member agian</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<script>
|
||||||
|
frappe.ready(function() {
|
||||||
|
$(".btn-leave").on("click", function() {
|
||||||
|
var leave = $("#leave").val();
|
||||||
|
var user_id = frappe.session.user;
|
||||||
|
var title = $(this).attr("data-title");
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.non_profit.doctype.chapter.chapter.leave",
|
||||||
|
args: {
|
||||||
|
leave_reason: leave,
|
||||||
|
user_id: user_id,
|
||||||
|
title: title
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
if(r.message) {
|
||||||
|
frappe.msgprint(r.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -3,13 +3,5 @@ import frappe
|
|||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.no_cache = True
|
context.no_cache = True
|
||||||
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
|
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
|
||||||
# if frappe.session.user!='Guest':
|
|
||||||
if frappe.session.user in [d.user for d in chapter.members]:
|
|
||||||
user = frappe.session.user
|
|
||||||
parent = frappe.form_dict.name
|
|
||||||
frappe.db.sql("""delete from `tabChapter Member` where parent = %s and user = %s """, (parent, user))
|
|
||||||
frappe.db.commit()
|
|
||||||
|
|
||||||
context.member_deleted = True
|
context.member_deleted = True
|
||||||
|
|
||||||
context.chapter = chapter
|
context.chapter = chapter
|
||||||
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
import frappe.share
|
import frappe.share
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import cstr, now_datetime, cint, flt
|
from frappe.utils import cstr, now_datetime, cint, flt, get_time
|
||||||
from erpnext.controllers.status_updater import StatusUpdater
|
from erpnext.controllers.status_updater import StatusUpdater
|
||||||
|
|
||||||
class UOMMustBeIntegerError(frappe.ValidationError): pass
|
class UOMMustBeIntegerError(frappe.ValidationError): pass
|
||||||
@ -26,6 +26,11 @@ class TransactionBase(StatusUpdater):
|
|||||||
now = now_datetime()
|
now = now_datetime()
|
||||||
self.posting_date = now.strftime('%Y-%m-%d')
|
self.posting_date = now.strftime('%Y-%m-%d')
|
||||||
self.posting_time = now.strftime('%H:%M:%S.%f')
|
self.posting_time = now.strftime('%H:%M:%S.%f')
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
get_time(self.posting_time)
|
||||||
|
except ValueError:
|
||||||
|
frappe.throw(_('Invalid Posting Time'))
|
||||||
|
|
||||||
def add_calendar_event(self, opts, force=False):
|
def add_calendar_event(self, opts, force=False):
|
||||||
if cstr(self.contact_by) != cstr(self._prev.contact_by) or \
|
if cstr(self.contact_by) != cstr(self._prev.contact_by) or \
|
||||||
|
Loading…
Reference in New Issue
Block a user