Merge branch 'hotfix'
This commit is contained in:
commit
d65d67e0a7
@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '7.1.11'
|
__version__ = '7.1.12'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<h2 class="text-center">{%= __(report.report_name) %}</h2>
|
<h2 class="text-center">{%= __(report.report_name) %}</h2>
|
||||||
<h4 class="text-center">{%= filters.customer || filters.supplier %} </h4>
|
<h4 class="text-center">{%= filters.customer || filters.supplier %} </h4>
|
||||||
<h5 class="text-center">
|
<h5 class="text-center">
|
||||||
{%= filters.ageing_based_on %}
|
{%= __(filters.ageing_based_on) %}
|
||||||
{%= __("Until") %}
|
{%= __("Until") %}
|
||||||
{%= dateutil.str_to_user(filters.report_date) %}
|
{%= dateutil.str_to_user(filters.report_date) %}
|
||||||
</h5>
|
</h5>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{% if(__(report.report_name) == "Accounts Receivable" || __(report.report_name) == "Accounts Payable") { %}
|
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||||
<th style="width: 15%">{%= __("Date") %}</th>
|
<th style="width: 15%">{%= __("Date") %}</th>
|
||||||
<th style="width: 15%">{%= __("Ref") %}</th>
|
<th style="width: 15%">{%= __("Ref") %}</th>
|
||||||
<th style="width: 40%">{%= __("Party") %}</th>
|
<th style="width: 40%">{%= __("Party") %}</th>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for(var i=0, l=data.length; i<l; i++) { %}
|
{% for(var i=0, l=data.length; i<l; i++) { %}
|
||||||
<tr>
|
<tr>
|
||||||
{% if(__(report.report_name) == "Accounts Receivable" || __(report.report_name) == "Accounts Payable") { %}
|
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||||
{% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %}
|
{% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %}
|
||||||
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
|
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
|
||||||
<td>{%= data[i][__("Voucher Type")] %}
|
<td>{%= data[i][__("Voucher Type")] %}
|
||||||
@ -38,21 +38,21 @@
|
|||||||
<td>{%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}
|
<td>{%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}
|
||||||
<br>{%= __("Remarks") %}: {%= data[i][__("Remarks")] %}</td>
|
<br>{%= __("Remarks") %}: {%= data[i][__("Remarks")] %}</td>
|
||||||
<td style="text-align: right">
|
<td style="text-align: right">
|
||||||
{%= format_currency(data[i][__("Invoiced Amount")], data[i]["currency"]) %}</td>
|
{%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"]) %}</td>
|
||||||
<td style="text-align: right">
|
<td style="text-align: right">
|
||||||
{%= format_currency(data[i][__("Paid Amount")], data[i]["currency"]) %}</td>
|
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||||
<td style="text-align: right">
|
<td style="text-align: right">
|
||||||
{%= format_currency(data[i][__("Outstanding Amount")], data[i]["currency"]) %}</td>
|
{%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %}</td>
|
||||||
{% } else { %}
|
{% } else { %}
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><b>{%= __("Total") %}</b></td>
|
<td><b>{%= __("Total") %}</b></td>
|
||||||
<td style="text-align: right">
|
<td style="text-align: right">
|
||||||
{%= format_currency(data[i][__("Invoiced Amount")]) %}</td>
|
{%= format_currency(data[i]["Invoiced Amount"]) %}</td>
|
||||||
<td style="text-align: right">
|
<td style="text-align: right">
|
||||||
{%= format_currency(data[i][__("Paid Amount")]) %}</td>
|
{%= format_currency(data[i]["Paid Amount"]) %}</td>
|
||||||
<td style="text-align: right">
|
<td style="text-align: right">
|
||||||
{%= format_currency(data[i][__("Outstanding Amount")]) %}</td>
|
{%= format_currency(data[i]["Outstanding Amount"]) %}</td>
|
||||||
{% } %}
|
{% } %}
|
||||||
{% } else { %}
|
{% } else { %}
|
||||||
{% if(data[i][__("Customer")] || data[i][__("Supplier")]|| " ") { %}
|
{% if(data[i][__("Customer")] || data[i][__("Supplier")]|| " ") { %}
|
||||||
@ -71,4 +71,4 @@
|
|||||||
{% } %}
|
{% } %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p class="text-right text-muted">Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
|
<p class="text-right text-muted">{{ __("Printed On") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
|
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt, cint
|
||||||
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
|
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
@ -92,12 +92,13 @@ def get_provisional_profit_loss(asset, liability, equity, period_list, company):
|
|||||||
def check_opening_balance(asset, liability, equity):
|
def check_opening_balance(asset, liability, equity):
|
||||||
# Check if previous year balance sheet closed
|
# Check if previous year balance sheet closed
|
||||||
opening_balance = 0
|
opening_balance = 0
|
||||||
|
float_precision = cint(frappe.db.get_default("float_precision")) or 2
|
||||||
if asset:
|
if asset:
|
||||||
opening_balance = flt(asset[0].get("opening_balance", 0))
|
opening_balance = flt(asset[0].get("opening_balance", 0), float_precision)
|
||||||
if liability:
|
if liability:
|
||||||
opening_balance -= flt(liability[0].get("opening_balance", 0))
|
opening_balance -= flt(liability[0].get("opening_balance", 0), float_precision)
|
||||||
if equity:
|
if equity:
|
||||||
opening_balance -= flt(equity[0].get("opening_balance", 0))
|
opening_balance -= flt(equity[0].get("opening_balance", 0), float_precision)
|
||||||
|
|
||||||
if opening_balance:
|
if opening_balance:
|
||||||
return _("Previous Financial Year is not closed"),opening_balance
|
return _("Previous Financial Year is not closed"),opening_balance
|
||||||
|
@ -231,6 +231,7 @@ class PurchaseOrder(BuyingController):
|
|||||||
"target_parent_dt": "Sales Order",
|
"target_parent_dt": "Sales Order",
|
||||||
"target_dt": "Sales Order Item",
|
"target_dt": "Sales Order Item",
|
||||||
'target_field': 'ordered_qty',
|
'target_field': 'ordered_qty',
|
||||||
|
"join_field": "sales_order_item",
|
||||||
"target_parent_field": ''
|
"target_parent_field": ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -207,6 +207,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
|
|||||||
target_doc.rejected_qty = -1* source_doc.rejected_qty
|
target_doc.rejected_qty = -1* source_doc.rejected_qty
|
||||||
target_doc.qty = -1* source_doc.qty
|
target_doc.qty = -1* source_doc.qty
|
||||||
target_doc.purchase_order = source_doc.purchase_order
|
target_doc.purchase_order = source_doc.purchase_order
|
||||||
|
target_doc.purchase_order_item = source_doc.purchase_order_item
|
||||||
target_doc.rejected_warehouse = source_doc.rejected_warehouse
|
target_doc.rejected_warehouse = source_doc.rejected_warehouse
|
||||||
elif doctype == "Purchase Invoice":
|
elif doctype == "Purchase Invoice":
|
||||||
target_doc.received_qty = -1* source_doc.received_qty
|
target_doc.received_qty = -1* source_doc.received_qty
|
||||||
|
@ -63,8 +63,8 @@ def get_salary_slips(filters):
|
|||||||
order by employee, month""" % conditions, filters, as_dict=1)
|
order by employee, month""" % conditions, filters, as_dict=1)
|
||||||
|
|
||||||
if not salary_slips:
|
if not salary_slips:
|
||||||
msgprint(_("No salary slip found for month: ") + cstr(filters.get("month")) +
|
frappe.throw(_("No salary slip found for month {0} and year {1}").format(
|
||||||
_(" and year: ") + cstr(filters.get("fiscal_year")), raise_exception=1)
|
filters.get("month"), filters.get("fiscal_year")))
|
||||||
|
|
||||||
return salary_slips
|
return salary_slips
|
||||||
|
|
||||||
|
@ -347,3 +347,5 @@ erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
|
|||||||
erpnext.patches.v7_1.add_account_user_role_for_timesheet
|
erpnext.patches.v7_1.add_account_user_role_for_timesheet
|
||||||
erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
|
erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
|
||||||
erpnext.patches.v7_1.update_invoice_status
|
erpnext.patches.v7_1.update_invoice_status
|
||||||
|
erpnext.patches.v7_0.po_status_issue_for_pr_return
|
||||||
|
erpnext.patches.v7_1.update_missing_salary_component_type
|
||||||
|
36
erpnext/patches/v7_0/po_status_issue_for_pr_return.py
Normal file
36
erpnext/patches/v7_0/po_status_issue_for_pr_return.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
parent_list = []
|
||||||
|
count = 0
|
||||||
|
for data in frappe.db.sql("""
|
||||||
|
select
|
||||||
|
`tabPurchase Receipt Item`.purchase_order, `tabPurchase Receipt Item`.name,
|
||||||
|
`tabPurchase Receipt Item`.item_code, `tabPurchase Receipt Item`.idx,
|
||||||
|
`tabPurchase Receipt Item`.parent
|
||||||
|
from
|
||||||
|
`tabPurchase Receipt Item`, `tabPurchase Receipt`
|
||||||
|
where
|
||||||
|
`tabPurchase Receipt Item`.parent = `tabPurchase Receipt`.name and
|
||||||
|
`tabPurchase Receipt Item`.purchase_order_item is null and
|
||||||
|
`tabPurchase Receipt Item`.purchase_order is not null and
|
||||||
|
`tabPurchase Receipt`.is_return = 1""", as_dict=1):
|
||||||
|
name = frappe.db.get_value('Purchase Order Item',
|
||||||
|
{'item_code': data.item_code, 'parent': data.purchase_order, 'idx': data.idx}, 'name')
|
||||||
|
|
||||||
|
if name:
|
||||||
|
frappe.db.set_value('Purchase Receipt Item', data.name, 'purchase_order_item', name, update_modified=False)
|
||||||
|
parent_list.append(data.parent)
|
||||||
|
|
||||||
|
count +=1
|
||||||
|
if count % 200 == 0:
|
||||||
|
frappe.db.commit()
|
||||||
|
|
||||||
|
if len(parent_list) > 0:
|
||||||
|
for parent in set(parent_list):
|
||||||
|
doc = frappe.get_doc('Purchase Receipt', parent)
|
||||||
|
doc.update_qty(update_modified=False)
|
25
erpnext/patches/v7_1/update_missing_salary_component_type.py
Normal file
25
erpnext/patches/v7_1/update_missing_salary_component_type.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
'''
|
||||||
|
Some components do not have type set, try and guess whether they turn up in
|
||||||
|
earnings or deductions in existing salary slips
|
||||||
|
'''
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
for s in frappe.db.sql('select name from `tabSalary Component` where ifnull(type, "")=""'):
|
||||||
|
compontent = frappe.get_doc('Salary Component', s[0])
|
||||||
|
|
||||||
|
# guess
|
||||||
|
guess = frappe.db.sql('''select
|
||||||
|
parentfield from `tabSalary Detail`
|
||||||
|
where salary_component=%s limit 1''', s[0])
|
||||||
|
|
||||||
|
if guess:
|
||||||
|
compontent.type = 'Earning' if guess[0][0]=='earnings' else 'Deduction'
|
||||||
|
|
||||||
|
else:
|
||||||
|
compontent.type = 'Deduction'
|
||||||
|
|
||||||
|
compontent.save()
|
@ -2,6 +2,7 @@ import frappe
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doctype('Role')
|
frappe.reload_doctype('Role')
|
||||||
|
frappe.reload_doctype('User')
|
||||||
for role_name in ('Customer', 'Supplier', 'Student'):
|
for role_name in ('Customer', 'Supplier', 'Student'):
|
||||||
if frappe.db.exists('Role', role_name):
|
if frappe.db.exists('Role', role_name):
|
||||||
frappe.db.set_value('Role', role_name, 'desk_access', 0)
|
frappe.db.set_value('Role', role_name, 'desk_access', 0)
|
||||||
|
@ -181,7 +181,6 @@
|
|||||||
}
|
}
|
||||||
.cart-dropdown-container .cart-items-dropdown {
|
.cart-dropdown-container .cart-items-dropdown {
|
||||||
max-height: 350px;
|
max-height: 350px;
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
.cart-dropdown-container .cart-items-dropdown .cart-dropdown {
|
.cart-dropdown-container .cart-items-dropdown .cart-dropdown {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -65,7 +65,7 @@ $.extend(shopping_cart, {
|
|||||||
var cart_count = getCookie("cart_count");
|
var cart_count = getCookie("cart_count");
|
||||||
|
|
||||||
if(cart_count) {
|
if(cart_count) {
|
||||||
$(".shopping-cart").toggleClass('hidden', true);
|
$(".shopping-cart").toggleClass('hidden', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var $cart = $('.cart-icon');
|
var $cart = $('.cart-icon');
|
||||||
|
@ -233,7 +233,6 @@
|
|||||||
|
|
||||||
.cart-items-dropdown {
|
.cart-items-dropdown {
|
||||||
max-height: 350px;
|
max-height: 350px;
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cart-items-dropdown .cart-dropdown {
|
.cart-items-dropdown .cart-dropdown {
|
||||||
|
@ -372,7 +372,7 @@
|
|||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Customer's Purchase Order",
|
"label": "Customer's Purchase Order",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 1,
|
"no_copy": 0,
|
||||||
"oldfieldname": "po_no",
|
"oldfieldname": "po_no",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -403,7 +403,7 @@
|
|||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Customer's Purchase Order Date",
|
"label": "Customer's Purchase Order Date",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 1,
|
"no_copy": 0,
|
||||||
"oldfieldname": "po_date",
|
"oldfieldname": "po_date",
|
||||||
"oldfieldtype": "Date",
|
"oldfieldtype": "Date",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -3226,7 +3226,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-11-05 08:09:08.921026",
|
"modified": "2016-11-14 16:07:45.817880",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Sales Order",
|
"name": "Sales Order",
|
||||||
|
@ -8,6 +8,7 @@ frappe.query_reports["Stock Balance"] = {
|
|||||||
"label": __("From Date"),
|
"label": __("From Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"width": "80",
|
"width": "80",
|
||||||
|
"reqd": 1,
|
||||||
"default": sys_defaults.year_start_date,
|
"default": sys_defaults.year_start_date,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -15,6 +16,7 @@ frappe.query_reports["Stock Balance"] = {
|
|||||||
"label": __("To Date"),
|
"label": __("To Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"width": "80",
|
"width": "80",
|
||||||
|
"reqd": 1,
|
||||||
"default": frappe.datetime.get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -61,11 +61,10 @@
|
|||||||
<button class="btn btn-primary btn-sm">
|
<button class="btn btn-primary btn-sm">
|
||||||
{{ _("Add to Cart") }}</button>
|
{{ _("Add to Cart") }}</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="item-update-cart"
|
<div id="item-update-cart" style="display: none;">
|
||||||
style="display: none;
|
<a href="/cart" class='btn btn-sm btn-default'>
|
||||||
padding-left: 0px; padding-right: 0px;
|
<i class='octicon octicon-check'></i>
|
||||||
padding-top: 10px;">
|
{{ _("View in Cart") }}</a>
|
||||||
<a href="/cart">{{ _("Goto Cart") }}</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 col-xs-4 text-right col-amount">
|
<div class="col-sm-4 col-xs-4 text-right col-amount">
|
||||||
{{ d.get_formatted("amount") }}
|
{{ d.get_formatted("amount") }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
@ -1,7 +1,12 @@
|
|||||||
{% macro product_image_square(website_image, css_class="") %}
|
{% macro product_image_square(website_image, css_class="") %}
|
||||||
{% if website_image -%} <meta itemprop="image" content="{{ frappe.utils.quoted(website_image) | abs_url }}"></meta>{%- endif %}
|
{% if website_image -%}
|
||||||
<div class="product-image product-image-square {% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
|
<meta itemprop="image" content="{{ frappe.utils.quoted(website_image) | abs_url }}"></meta>
|
||||||
{% if website_image -%} style="background-image: url('{{ frappe.utils.quoted(website_image) | abs_url }}');" {%- endif %}>
|
{%- endif %}
|
||||||
|
<div class="product-image product-image-square
|
||||||
|
{% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
|
||||||
|
{% if website_image -%}
|
||||||
|
style="background-image: url('{{ frappe.utils.quoted(website_image) | abs_url }}');"
|
||||||
|
{%- endif %}>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{% block navbar_right_extension %}
|
{% block navbar_right_extension %}
|
||||||
<li class="shopping-cart hidden">
|
<li class="shopping-cart hidden">
|
||||||
<div class="cart-icon small">
|
<div class="cart-icon">
|
||||||
<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="navLogin">
|
<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="navLogin">
|
||||||
Cart <span class="badge-wrapper" id="cart-count"></span>
|
Cart <span class="badge-wrapper" id="cart-count"></span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro item_name_and_description_cart(d) %}
|
{% macro item_name_and_description_cart(d) %}
|
||||||
<div class="row item_name_dropdown">
|
<div class="row item_name_dropdown">
|
||||||
<div class="col-xs-4 col-sm-4 order-image-col">
|
<div class="col-xs-4 col-sm-4 order-image-col">
|
||||||
|
@ -10,15 +10,43 @@ from frappe.utils import cint, formatdate
|
|||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def send_message(subject="Website Query", message="", sender="", status="Open"):
|
def send_message(subject="Website Query", message="", sender="", status="Open"):
|
||||||
from frappe.www.contact import send_message as website_send_message
|
from frappe.www.contact import send_message as website_send_message
|
||||||
|
lead = customer = None
|
||||||
|
|
||||||
website_send_message(subject, message, sender)
|
website_send_message(subject, message, sender)
|
||||||
|
|
||||||
|
customer = frappe.db.get_value('Contact', dict(email_id=sender), 'customer')
|
||||||
|
if not customer:
|
||||||
|
lead = frappe.db.get_value('Lead', dict(email_id=sender))
|
||||||
|
if not lead:
|
||||||
|
new_lead = frappe.get_doc(dict(
|
||||||
|
doctype='Lead',
|
||||||
|
email_id = sender,
|
||||||
|
lead_name = sender.split('@')[0].title()
|
||||||
|
)).insert(ignore_permissions=True)
|
||||||
|
|
||||||
|
opportunity = frappe.get_doc(dict(
|
||||||
|
doctype='Opportunity',
|
||||||
|
enquiry_from = 'Customer' if customer else 'Lead',
|
||||||
|
status = 'Open',
|
||||||
|
title = subject,
|
||||||
|
to_discuss=message
|
||||||
|
))
|
||||||
|
|
||||||
|
if customer:
|
||||||
|
opportunity.customer = customer
|
||||||
|
else:
|
||||||
|
opportunity.lead = new_lead.name
|
||||||
|
|
||||||
|
opportunity.insert(ignore_permissions=True)
|
||||||
|
|
||||||
comm = frappe.get_doc({
|
comm = frappe.get_doc({
|
||||||
"doctype":"Communication",
|
"doctype":"Communication",
|
||||||
"subject": subject,
|
"subject": subject,
|
||||||
"content": message,
|
"content": message,
|
||||||
"sender": sender,
|
"sender": sender,
|
||||||
"sent_or_received": "Received"
|
"sent_or_received": "Received",
|
||||||
|
'reference_doctype': 'Opportunity',
|
||||||
|
'reference_name': opportunity.name
|
||||||
})
|
})
|
||||||
comm.insert(ignore_permissions=True)
|
comm.insert(ignore_permissions=True)
|
||||||
|
|
||||||
|
@ -4,4 +4,4 @@ import frappe
|
|||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
# do your magic here
|
# do your magic here
|
||||||
pass
|
context.show_sidebar = True
|
||||||
|
Loading…
Reference in New Issue
Block a user