[minor] [cleanup] Landed cost wizard
This commit is contained in:
commit
3f5e59eeeb
@ -333,10 +333,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
// other charges added/deducted
|
||||
if(tax_count) {
|
||||
this.frm.doc.other_charges_added = wn.utils.sum($.map(this.frm.tax_doclist,
|
||||
function(tax) { return tax.add_deduct_tax == "Add" ? tax.tax_amount : 0.0; }));
|
||||
function(tax) { return (tax.add_deduct_tax == "Add" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; }));
|
||||
|
||||
this.frm.doc.other_charges_deducted = wn.utils.sum($.map(this.frm.tax_doclist,
|
||||
function(tax) { return tax.add_deduct_tax == "Deduct" ? tax.tax_amount : 0.0; }));
|
||||
function(tax) { return (tax.add_deduct_tax == "Deduct" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; }));
|
||||
|
||||
wn.model.round_floats_in(this.frm.doc, ["other_charges_added", "other_charges_deducted"]);
|
||||
|
||||
|
@ -18,9 +18,6 @@ class DocType(TransactionBase):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
def autoname(self):
|
||||
supp_master_name = webnotes.defaults.get_global_default('supp_master_name')
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:11",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-08 14:22:08",
|
||||
"modified": "2013-09-02 16:25:44",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -204,6 +204,14 @@
|
||||
"oldfieldname": "website",
|
||||
"oldfieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
|
51
docs/templates/docs.html
vendored
Normal file
51
docs/templates/docs.html
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
{% extends "lib/core/doctype/documentation_tool/docs.html" %}
|
||||
|
||||
{% block navbar %}
|
||||
<div class="navbar navbar-default" style="border-bottom: 2px solid #c0392b">
|
||||
<div class="container">
|
||||
<button type="button" class="navbar-toggle"
|
||||
data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="index.html">
|
||||
<object data="img/splash.svg" class="erpnext-logo"
|
||||
type="image/svg+xml"></object> erpnext.org</a>
|
||||
<div class="collapse navbar-collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="docs.user.html">User</a></li>
|
||||
<li><a href="docs.dev.html">Developer</a></li>
|
||||
<li><a href="docs.user.help.html">Help</a></li>
|
||||
<li><a href="docs.download.html">Download</a></li>
|
||||
<li><a href="https://erpnext.com" target="_blank">Cloud</a></li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li><a href="docs.about.html">About</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<hr />
|
||||
<div class="footer text-muted" style="font-size: 80%;">
|
||||
<div class="content row">
|
||||
<div class="col-md-12">
|
||||
© <a href="https://erpnext.com">Web Notes</a> |
|
||||
<a href="docs.user.help.html">Help</a> |
|
||||
<a href="https://github.com/webnotes/erpnext" target="_blank">Code</a> |
|
||||
<a href="docs.attributions.html">Attributions</a> |
|
||||
<a href="https://erpnext.com">ERPNext Cloud</a> |
|
||||
<a href="https://erpnext.com/partners">Find a Partner</a> |
|
||||
<a href="https://erpnext.com/donate">Donate</a>
|
||||
<br>
|
||||
<p>
|
||||
Code License: <a href="https://www.gnu.org/licenses/gpl.html">GNU/GPL 3</a>.
|
||||
Documentation License: <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA-3.0</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -37,7 +37,7 @@ class JobsMailbox(POP3Mailbox):
|
||||
mail.save_attachments_in_doc(applicant.doc)
|
||||
|
||||
make(content=mail.content, sender=mail.from_email,
|
||||
doctype="Job Applicant", name=applicant.doc.name, set_lead=False)
|
||||
doctype="Job Applicant", name=applicant.doc.name)
|
||||
|
||||
def get_job_applications():
|
||||
if cint(webnotes.conn.get_value('Jobs Email Settings', None, 'extract_emails')):
|
||||
|
@ -11,9 +11,6 @@ class DocType(TransactionBase):
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
def get_sender(self, comm):
|
||||
return webnotes.conn.get_value('Jobs Email Settings',None,'email_id')
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-29 19:25:37",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:43:11",
|
||||
"modified": "2013-09-02 16:26:23",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -89,6 +89,14 @@
|
||||
"fieldtype": "HTML",
|
||||
"label": "Thread HTML"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
|
@ -259,6 +259,8 @@ patch_list = [
|
||||
"patches.august_2013.p06_deprecate_cancelled_sl_entry",
|
||||
"patches.august_2013.p06_fix_sle_against_stock_entry",
|
||||
"execute:webnotes.bean('Style Settings').save() #2013-08-20",
|
||||
"patches.september_2013.p01_fix_buying_amount_gl_entries",
|
||||
"patches.september_2013.p01_update_communication",
|
||||
"patches.august_2013.p06_deprecate_is_cancelled",
|
||||
"execute:webnotes.delete_doc('DocType', 'Budget Control')",
|
||||
]
|
0
patches/september_2013/__init__.py
Normal file
0
patches/september_2013/__init__.py
Normal file
66
patches/september_2013/p01_fix_buying_amount_gl_entries.py
Normal file
66
patches/september_2013/p01_fix_buying_amount_gl_entries.py
Normal file
@ -0,0 +1,66 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import webnotes.defaults
|
||||
from webnotes.utils import cint
|
||||
|
||||
def execute():
|
||||
if not cint(webnotes.defaults.get_global_default("auto_inventory_accounting")):
|
||||
return
|
||||
|
||||
# fix delivery note
|
||||
for dn in webnotes.conn.sql_list("""select name from `tabDelivery Note` where docstatus=1
|
||||
and posting_date >= "2013-08-06" order by posting_date"""):
|
||||
recreate_gl_entries("Delivery Note", dn, "delivery_note_details")
|
||||
|
||||
# fix sales invoice
|
||||
for si in webnotes.conn.sql_list("""select name from `tabSales Invoice` where docstatus=1
|
||||
and update_stock=1 and posting_date >= "2013-08-06" order by posting_date"""):
|
||||
recreate_gl_entries("Sales Invoice", si, "entries")
|
||||
|
||||
def recreate_gl_entries(doctype, name, parentfield):
|
||||
# calculate buying amount and make gl entries
|
||||
bean = webnotes.bean(doctype, name)
|
||||
bean.run_method("set_buying_amount")
|
||||
|
||||
company_values = webnotes.conn.get_value("Company", bean.doc.company, ["default_expense_account",
|
||||
"stock_adjustment_account", "cost_center", "stock_adjustment_cost_center"])
|
||||
|
||||
# update missing expense account and cost center
|
||||
for item in bean.doclist.get({"parentfield": parentfield}):
|
||||
if item.buying_amount and not validate_item_values(item, bean.doc.company):
|
||||
res = webnotes.conn.sql("""select expense_account, cost_center
|
||||
from `tab%s` child where docstatus=1 and item_code=%s and
|
||||
ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and
|
||||
(select company from `tabAccount` ac where ac.name=child.expense_account)=%s and
|
||||
(select company from `tabCost Center` cc where cc.name=child.cost_center)=%s
|
||||
order by creation desc limit 1""" % (item.doctype, "%s", "%s", "%s"),
|
||||
(item.item_code, bean.doc.company, bean.doc.company))
|
||||
if res:
|
||||
item.expense_account = res[0][0]
|
||||
item.cost_center = res[0][1]
|
||||
elif company_values:
|
||||
item.expense_account = company_values[0] or company_values[1]
|
||||
item.cost_center = company_values[2] or company_values[3]
|
||||
|
||||
webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account)
|
||||
webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center)
|
||||
|
||||
# remove gl entries
|
||||
webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s
|
||||
and voucher_no=%s""", (doctype, name))
|
||||
bean.run_method("make_gl_entries")
|
||||
|
||||
def validate_item_values(item, company):
|
||||
if item.expense_account and \
|
||||
webnotes.conn.get_value("Account", item.expense_account, "company")!=company:
|
||||
return False
|
||||
elif item.cost_center and \
|
||||
webnotes.conn.get_value("Cost Center", item.cost_center, "company")!=company:
|
||||
return False
|
||||
elif not (item.expense_account and item.cost_center):
|
||||
return False
|
||||
|
||||
return True
|
10
patches/september_2013/p01_update_communication.py
Normal file
10
patches/september_2013/p01_update_communication.py
Normal file
@ -0,0 +1,10 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
for doctype in ("Contact", "Lead", "Job Applicant", "Supplier", "Customer", "Quotation", "Sales Person", "Support Ticket"):
|
||||
fieldname = doctype.replace(" ", '_').lower()
|
||||
webnotes.conn.sql("""update tabCommunication
|
||||
set parenttype=%s, parentfield='communications',
|
||||
parent=`%s`
|
||||
where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype)
|
||||
|
@ -20,20 +20,6 @@ erpnext.toolbar.setup = function() {
|
||||
<i class="icon-fixed-width icon-comments"></i> '+wn._('Live Chat')+'</a></li>');
|
||||
}
|
||||
|
||||
erpnext.toolbar.set_new_comments();
|
||||
|
||||
$("#toolbar-tools").append('<li><a href="#latest-updates">\
|
||||
<i class="icon-fixed-width icon-rss"></i> Latest Updates</li>');
|
||||
}
|
||||
|
||||
erpnext.toolbar.set_new_comments = function(new_comments) {
|
||||
return;
|
||||
var navbar_nc = $('.navbar-new-comments');
|
||||
if(cint(new_comments)) {
|
||||
navbar_nc.addClass('navbar-new-comments-true')
|
||||
navbar_nc.text(new_comments);
|
||||
} else {
|
||||
navbar_nc.removeClass('navbar-new-comments-true');
|
||||
navbar_nc.text(0);
|
||||
}
|
||||
}
|
@ -17,10 +17,7 @@ class DocType(TransactionBase):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
|
||||
def autoname(self):
|
||||
cust_master_name = webnotes.defaults.get_global_default('cust_master_name')
|
||||
if cust_master_name == 'Customer Name':
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-06-11 14:26:44",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-08 14:22:13",
|
||||
"modified": "2013-09-02 16:25:13",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -348,6 +348,15 @@
|
||||
"options": "Customer Discount",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
|
@ -12,6 +12,9 @@ def add_sales_communication(subject, content, sender, real_name, mail=None,
|
||||
lead_name = webnotes.conn.get_value("Lead", {"email_id": sender})
|
||||
contact_name = webnotes.conn.get_value("Contact", {"email_id": sender})
|
||||
|
||||
parent_doctype = "Contact" if contact_name else "Lead"
|
||||
parent_name = contact_name or lead_name
|
||||
|
||||
if not (lead_name or contact_name):
|
||||
# none, create a new Lead
|
||||
lead = webnotes.bean({
|
||||
@ -26,11 +29,11 @@ def add_sales_communication(subject, content, sender, real_name, mail=None,
|
||||
lead_name = lead.doc.name
|
||||
|
||||
message = make(content=content, sender=sender, subject=subject,
|
||||
lead=lead_name, contact=contact_name, date=date)
|
||||
doctype = parent_doctype, name = parent_name, date=date)
|
||||
|
||||
if mail:
|
||||
# save attachments to parent if from mail
|
||||
bean = webnotes.bean("Contact" if contact_name else "Lead", contact_name or lead_name)
|
||||
bean = webnotes.bean(parent_doctype, parent_name)
|
||||
mail.save_attachments_in_doc(bean.doc)
|
||||
|
||||
class SalesMailbox(POP3Mailbox):
|
||||
|
@ -24,7 +24,6 @@ class DocType(SellingController):
|
||||
})
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
customer = webnotes.conn.get_value("Customer", {"lead_name": self.doc.name})
|
||||
if customer:
|
||||
self.doc.fields["__is_customer"] = customer
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-04-10 11:45:37",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-08 14:22:14",
|
||||
"modified": "2013-09-02 17:25:59",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -410,6 +410,14 @@
|
||||
"fieldtype": "Check",
|
||||
"label": "Blog Subscriber"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"doctype": "DocPerm",
|
||||
|
@ -25,9 +25,6 @@ class DocType(TransactionBase):
|
||||
"contact_by": webnotes.conn.get_value("Opportunity", self.doc.name, "contact_by") if \
|
||||
(not cint(self.doc.fields.get("__islocal"))) else None,
|
||||
})
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
def get_item_details(self, item_code):
|
||||
item = sql("""select item_name, stock_uom, description_html, description, item_group, brand
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 18:50:30",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-08 14:22:15",
|
||||
"modified": "2013-09-02 16:27:33",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -442,6 +442,14 @@
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Sales User"
|
||||
|
@ -20,9 +20,6 @@ class DocType(SellingController):
|
||||
self.doclist = doclist
|
||||
self.tname = 'Quotation Item'
|
||||
self.fname = 'quotation_details'
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
# Get contact person details based on customer selected
|
||||
# ------------------------------------------------------
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:08",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-09 14:46:11",
|
||||
"modified": "2013-09-02 16:25:01",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -835,6 +835,14 @@
|
||||
"read_only": 0,
|
||||
"width": "40px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:24",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-05 18:11:22",
|
||||
"modified": "2013-09-02 16:26:54",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -160,6 +160,14 @@
|
||||
"options": "Budget Distribution",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
|
@ -38,17 +38,22 @@ class DocType:
|
||||
total_amt = self.get_total_pr_amt(purchase_receipts)
|
||||
|
||||
for pr in purchase_receipts:
|
||||
pr_obj = get_obj('Purchase Receipt', pr, with_children = 1)
|
||||
idx = max([d.idx for d in pr_obj.doclist.get({"parentfield": "purchase_tax_details"})])
|
||||
pr_bean = webnotes.bean('Purchase Receipt', pr)
|
||||
idx = max([d.idx for d in pr_bean.doclist.get({"parentfield": "purchase_tax_details"})])
|
||||
|
||||
for lc in self.doclist.get({"parentfield": "landed_cost_details"}):
|
||||
amt = flt(lc.amount) * flt(pr_obj.doc.net_total)/ flt(total_amt)
|
||||
amt = flt(lc.amount) * flt(pr_bean.doc.net_total)/ flt(total_amt)
|
||||
|
||||
pr_oc_row = webnotes.conn.sql("""select name from `tabPurchase Taxes and Charges`
|
||||
where parent = %s and category = 'Valuation' and add_deduct_tax = 'Add'
|
||||
and charge_type = 'Actual' and account_head = %s""",(pr, lc.account_head))
|
||||
if not pr_oc_row: # add if not exists
|
||||
ch = addchild(pr_obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges')
|
||||
matched_row = pr_bean.doclist.get({
|
||||
"parentfield": "purchase_tax_details",
|
||||
"category": "Valuation",
|
||||
"add_deduct_tax": "Add",
|
||||
"charge_type": "Actual",
|
||||
"account_head": lc.account_head
|
||||
})
|
||||
|
||||
if not matched_row: # add if not exists
|
||||
ch = addchild(pr_bean.doc, 'purchase_tax_details', 'Purchase Taxes and Charges')
|
||||
ch.category = 'Valuation'
|
||||
ch.add_deduct_tax = 'Add'
|
||||
ch.charge_type = 'Actual'
|
||||
@ -62,12 +67,12 @@ class DocType:
|
||||
ch.save(1)
|
||||
idx += 1
|
||||
else: # overwrite if exists
|
||||
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
|
||||
set rate = %s, tax_amount = %s where name = %s and parent = %s""",
|
||||
(amt, amt, pr_oc_row[0][0], pr))
|
||||
|
||||
pr_obj.calculate_taxes_and_totals()
|
||||
for d in pr_obj.doclist:
|
||||
matched_row[0].rate = amt
|
||||
matched_row[0].tax_amount = amt
|
||||
matched_row[0].cost_center = lc.cost_center
|
||||
|
||||
pr_bean.run_method("validate")
|
||||
for d in pr_bean.doclist:
|
||||
d.save()
|
||||
|
||||
def get_total_pr_amt(self, purchase_receipts):
|
||||
|
@ -46,7 +46,7 @@ class SupportMailbox(POP3Mailbox):
|
||||
|
||||
make(content=mail.content, sender=mail.from_email, subject = ticket.doc.subject,
|
||||
doctype="Support Ticket", name=ticket.doc.name,
|
||||
lead = ticket.doc.lead, contact=ticket.doc.contact, date=mail.date)
|
||||
date=mail.date)
|
||||
|
||||
if new_ticket and cint(self.email_settings.send_autoreply) and \
|
||||
"mailer-daemon" not in mail.from_email.lower():
|
||||
|
@ -11,9 +11,6 @@ class DocType(TransactionBase):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
def get_sender(self, comm):
|
||||
return webnotes.conn.get_value('Email Settings',None,'support_email')
|
||||
@ -53,7 +50,7 @@ class DocType(TransactionBase):
|
||||
if not self.doc.company:
|
||||
self.doc.company = webnotes.conn.get_value("Lead", self.doc.lead, "company") or \
|
||||
webnotes.conn.get_default("company")
|
||||
|
||||
|
||||
def on_trash(self):
|
||||
webnotes.conn.sql("""update `tabCommunication` set support_ticket=NULL
|
||||
where support_ticket=%s""", (self.doc.name,))
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-01 10:36:25",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-28 18:29:06",
|
||||
"modified": "2013-09-02 16:24:24",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -261,6 +261,14 @@
|
||||
"hidden": 1,
|
||||
"label": "Content Type"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"doctype": "DocPerm",
|
||||
|
@ -30,7 +30,6 @@ prob = {
|
||||
}
|
||||
|
||||
def make(reset=False, simulate=True):
|
||||
webnotes.connect()
|
||||
#webnotes.print_messages = True
|
||||
webnotes.mute_emails = True
|
||||
webnotes.rollback_on_exception = True
|
||||
@ -38,7 +37,7 @@ def make(reset=False, simulate=True):
|
||||
if reset:
|
||||
setup()
|
||||
if simulate:
|
||||
simulate()
|
||||
_simulate()
|
||||
|
||||
def setup():
|
||||
install()
|
||||
@ -50,7 +49,7 @@ def setup():
|
||||
# make_opening_stock()
|
||||
# make_opening_accounts()
|
||||
|
||||
def simulate():
|
||||
def _simulate():
|
||||
global runs_for
|
||||
current_date = webnotes.utils.getdate(start_date)
|
||||
|
||||
@ -411,7 +410,4 @@ def import_data(dt, submit=False):
|
||||
if submit:
|
||||
webnotes.form_dict["params"] = json.dumps({"_submit": 1})
|
||||
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", doctype+".csv")
|
||||
upload()
|
||||
|
||||
if __name__=="__main__":
|
||||
make()
|
||||
upload()
|
@ -6,7 +6,14 @@ import webnotes, os
|
||||
import utilities.demo.make_demo
|
||||
|
||||
def make_demo_app():
|
||||
|
||||
webnotes.mute_emails = 1
|
||||
webnotes.connect()
|
||||
utilities.demo.make_demo.make(reset=True, simulate=False)
|
||||
# setup demo user etc so that the site it up faster, while the data loads
|
||||
make_demo_user()
|
||||
make_demo_login_page()
|
||||
make_demo_on_login_script()
|
||||
utilities.demo.make_demo.make(reset=False, simulate=True)
|
||||
|
||||
def make_demo_user():
|
||||
roles = ["Accounts Manager", "Analytics", "Expense Approver", "Accounts User",
|
||||
@ -111,11 +118,4 @@ def make_demo_on_login_script():
|
||||
webnotes.conn.commit()
|
||||
|
||||
if __name__=="__main__":
|
||||
# webnotes.connect()
|
||||
webnotes.mute_emails = 1
|
||||
utilities.demo.make_demo.make(reset=True, simulate=False)
|
||||
# setup demo user etc so that the site it up faster, while the data loads
|
||||
make_demo_user()
|
||||
make_demo_login_page()
|
||||
make_demo_on_login_script()
|
||||
utilities.demo.make_demo.make(reset=False, simulate=True)
|
||||
make_demo_app()
|
@ -12,9 +12,6 @@ class DocType(TransactionBase):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
def on_communication_sent(self, comm):
|
||||
webnotes.conn.set(self.doc, 'status', 'Replied')
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:32",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:32:19",
|
||||
"modified": "2013-09-02 16:26:13",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -225,6 +225,14 @@
|
||||
"oldfieldtype": "Small Text",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communications",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"doctype": "DocPerm",
|
||||
|
@ -229,20 +229,7 @@ class TransactionBase(StatusUpdater):
|
||||
if int(webnotes.conn.get_value("Notification Control", None, dt) or 0):
|
||||
self.doc.fields["__notification_message"] = \
|
||||
webnotes.conn.get_value("Notification Control", None, dt + "_message")
|
||||
|
||||
def add_communication_list(self):
|
||||
# remove communications if present
|
||||
self.doclist = webnotes.doclist(self.doclist).get({
|
||||
"doctype": ["!=", "Communcation"]})
|
||||
|
||||
comm_list = webnotes.conn.sql("""select * from tabCommunication
|
||||
where %s=%s order by modified desc limit 20""" \
|
||||
% (self.doc.doctype.replace(" ", "_").lower(), "%s"),
|
||||
self.doc.name, as_dict=1, update={"doctype":"Communication"})
|
||||
|
||||
self.doclist.extend(webnotes.doclist([webnotes.doc(fielddata=d) \
|
||||
for d in comm_list]))
|
||||
|
||||
|
||||
def validate_posting_time(self):
|
||||
if not self.doc.posting_time:
|
||||
self.doc.posting_time = now_datetime().strftime('%H:%M:%S')
|
||||
|
Loading…
x
Reference in New Issue
Block a user