Merge branch 'develop'
This commit is contained in:
commit
b1fdbf2335
@ -1 +1 @@
|
|||||||
__version__ = '4.11.1'
|
__version__ = '4.11.2'
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from frappe.utils import cint, cstr, flt, fmt_money, formatdate, getdate
|
from frappe.utils import cstr, flt, fmt_money, formatdate, getdate
|
||||||
from frappe import msgprint, _, scrub
|
from frappe import msgprint, _, scrub
|
||||||
from erpnext.setup.utils import get_company_currency
|
from erpnext.setup.utils import get_company_currency
|
||||||
|
|
||||||
@ -13,10 +13,6 @@ from erpnext.controllers.accounts_controller import AccountsController
|
|||||||
class JournalVoucher(AccountsController):
|
class JournalVoucher(AccountsController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, arg1, arg2=None):
|
||||||
super(JournalVoucher, self).__init__(arg1, arg2)
|
super(JournalVoucher, self).__init__(arg1, arg2)
|
||||||
self.master_type = {}
|
|
||||||
self.credit_days_for = {}
|
|
||||||
self.credit_days_global = -1
|
|
||||||
self.is_approving_authority = -1
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if not self.is_opening:
|
if not self.is_opening:
|
||||||
@ -40,7 +36,7 @@ class JournalVoucher(AccountsController):
|
|||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
if self.voucher_type in ['Bank Voucher', 'Contra Voucher', 'Journal Entry']:
|
if self.voucher_type in ['Bank Voucher', 'Contra Voucher', 'Journal Entry']:
|
||||||
self.check_credit_days()
|
self.check_reference_date()
|
||||||
self.make_gl_entries()
|
self.make_gl_entries()
|
||||||
self.check_credit_limit()
|
self.check_credit_limit()
|
||||||
self.update_advance_paid()
|
self.update_advance_paid()
|
||||||
@ -309,43 +305,18 @@ class JournalVoucher(AccountsController):
|
|||||||
from frappe.utils import money_in_words
|
from frappe.utils import money_in_words
|
||||||
self.total_amount_in_words = money_in_words(amt, company_currency)
|
self.total_amount_in_words = money_in_words(amt, company_currency)
|
||||||
|
|
||||||
def check_credit_days(self):
|
def check_reference_date(self):
|
||||||
if self.cheque_date:
|
if self.cheque_date:
|
||||||
for d in self.get("entries"):
|
for d in self.get("entries"):
|
||||||
if flt(d.credit) > 0 and d.against_invoice \
|
due_date = None
|
||||||
and frappe.db.get_value("Account", d.account, "master_type")=='Customer':
|
if d.against_invoice and flt(d.credit) > 0:
|
||||||
posting_date = frappe.db.get_value("Sales Invoice", d.against_invoice, "posting_date")
|
due_date = frappe.db.get_value("Sales Invoice", d.against_invoice, "due_date")
|
||||||
credit_days = self.get_credit_days_for(d.account)
|
elif d.against_voucher and flt(d.debit) > 0:
|
||||||
if credit_days:
|
due_date = frappe.db.get_value("Purchase Invoice", d.against_voucher, "due_date")
|
||||||
date_diff = (getdate(self.cheque_date) - getdate(posting_date)).days
|
|
||||||
if date_diff > flt(credit_days):
|
|
||||||
msgprint(_("Note: Reference Date exceeds allowed credit days by {0} days for {1}")
|
|
||||||
.format(date_diff - flt(credit_days), d.account))
|
|
||||||
if not self.get_authorized_user():
|
|
||||||
raise frappe.ValidationError
|
|
||||||
|
|
||||||
def get_credit_days_for(self, ac):
|
if due_date and getdate(self.cheque_date) > getdate(due_date):
|
||||||
if not self.credit_days_for.has_key(ac):
|
msgprint(_("Note: Reference Date {0} is after invoice due date {1}")
|
||||||
self.credit_days_for[ac] = cint(frappe.db.get_value("Account", ac, "credit_days"))
|
.format(formatdate(self.cheque_date), formatdate(due_date)))
|
||||||
|
|
||||||
if not self.credit_days_for[ac]:
|
|
||||||
if self.credit_days_global==-1:
|
|
||||||
self.credit_days_global = cint(frappe.db.get_value("Company", self.company, "credit_days"))
|
|
||||||
|
|
||||||
return self.credit_days_global
|
|
||||||
else:
|
|
||||||
return self.credit_days_for[ac]
|
|
||||||
|
|
||||||
def get_authorized_user(self):
|
|
||||||
if self.is_approving_authority==-1:
|
|
||||||
self.is_approving_authority = 0
|
|
||||||
approving_authority = frappe.db.get_value("Accounts Settings", None, "credit_controller")
|
|
||||||
|
|
||||||
# Check logged-in user is authorized
|
|
||||||
if approving_authority in frappe.user.get_roles():
|
|
||||||
self.is_approving_authority = 1
|
|
||||||
|
|
||||||
return self.is_approving_authority
|
|
||||||
|
|
||||||
def make_gl_entries(self, cancel=0, adv_adj=0):
|
def make_gl_entries(self, cancel=0, adv_adj=0):
|
||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
|
|||||||
@ -42,9 +42,6 @@ frappe.ui.form.on("Payment Tool", "received_or_paid", function(frm) {
|
|||||||
erpnext.payment_tool.check_mandatory_to_set_button(frm);
|
erpnext.payment_tool.check_mandatory_to_set_button(frm);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch bank/cash account based on payment mode
|
|
||||||
cur_frm.add_fetch("payment_mode", "default_account", "payment_account");
|
|
||||||
|
|
||||||
// Set party account name
|
// Set party account name
|
||||||
frappe.ui.form.on("Payment Tool", "customer", function(frm) {
|
frappe.ui.form.on("Payment Tool", "customer", function(frm) {
|
||||||
erpnext.payment_tool.set_party_account(frm);
|
erpnext.payment_tool.set_party_account(frm);
|
||||||
|
|||||||
@ -210,14 +210,15 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
calculate_totals: function() {
|
calculate_totals: function() {
|
||||||
var tax_count = this.frm.tax_doclist.length;
|
var tax_count = this.frm.tax_doclist.length;
|
||||||
this.frm.doc.grand_total = flt(tax_count ?
|
this.frm.doc.grand_total = flt(tax_count ?
|
||||||
this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total,
|
this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
|
||||||
precision("grand_total"));
|
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate);
|
||||||
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total /
|
|
||||||
this.frm.doc.conversion_rate, precision("grand_total_import"));
|
|
||||||
|
|
||||||
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
||||||
precision("total_tax"));
|
precision("total_tax"));
|
||||||
|
|
||||||
|
this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
|
||||||
|
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
|
||||||
|
|
||||||
// rounded totals
|
// rounded totals
|
||||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
|
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
|
||||||
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
||||||
|
|||||||
@ -22,10 +22,9 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||||
|
|
||||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||||
list: frappe.get_list("Communication", {"supplier": doc.name}),
|
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc
|
doc: doc
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -110,13 +110,13 @@ class BuyingController(StockController):
|
|||||||
self.round_floats_in(self, ["net_total", "net_total_import"])
|
self.round_floats_in(self, ["net_total", "net_total_import"])
|
||||||
|
|
||||||
def calculate_totals(self):
|
def calculate_totals(self):
|
||||||
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist
|
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
|
||||||
else self.net_total, self.precision("grand_total"))
|
self.grand_total_import = flt(self.grand_total / self.conversion_rate)
|
||||||
self.grand_total_import = flt(self.grand_total / self.conversion_rate,
|
|
||||||
self.precision("grand_total_import"))
|
|
||||||
|
|
||||||
self.total_tax = flt(self.grand_total - self.net_total,
|
self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax"))
|
||||||
self.precision("total_tax"))
|
|
||||||
|
self.grand_total = flt(self.grand_total, self.precision("grand_total"))
|
||||||
|
self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
|
||||||
|
|
||||||
if self.meta.get_field("rounded_total"):
|
if self.meta.get_field("rounded_total"):
|
||||||
self.rounded_total = rounded(self.grand_total)
|
self.rounded_total = rounded(self.grand_total)
|
||||||
|
|||||||
@ -216,17 +216,17 @@ class SellingController(StockController):
|
|||||||
self.round_floats_in(self, ["net_total", "net_total_export"])
|
self.round_floats_in(self, ["net_total", "net_total_export"])
|
||||||
|
|
||||||
def calculate_totals(self):
|
def calculate_totals(self):
|
||||||
self.grand_total = flt(self.tax_doclist and \
|
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
|
||||||
self.tax_doclist[-1].total or self.net_total, self.precision("grand_total"))
|
|
||||||
self.grand_total_export = flt(self.grand_total / self.conversion_rate,
|
|
||||||
self.precision("grand_total_export"))
|
|
||||||
|
|
||||||
self.other_charges_total = flt(self.grand_total - self.net_total,
|
self.grand_total_export = flt(self.grand_total / self.conversion_rate)
|
||||||
self.precision("other_charges_total"))
|
|
||||||
|
|
||||||
self.other_charges_total_export = flt(self.grand_total_export -
|
self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))
|
||||||
self.net_total_export + flt(self.discount_amount),
|
|
||||||
self.precision("other_charges_total_export"))
|
self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export +
|
||||||
|
flt(self.discount_amount), self.precision("other_charges_total_export"))
|
||||||
|
|
||||||
|
self.grand_total = flt(self.grand_total, self.precision("grand_total"))
|
||||||
|
self.grand_total_export = flt(self.grand_total_export, self.precision("grand_total_export"))
|
||||||
|
|
||||||
self.rounded_total = rounded(self.grand_total)
|
self.rounded_total = rounded(self.grand_total)
|
||||||
self.rounded_total_export = rounded(self.grand_total_export)
|
self.rounded_total_export = rounded(self.grand_total_export)
|
||||||
|
|||||||
@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors"
|
|||||||
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
|
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
|
||||||
app_icon = "icon-th"
|
app_icon = "icon-th"
|
||||||
app_color = "#e74c3c"
|
app_color = "#e74c3c"
|
||||||
app_version = "4.11.1"
|
app_version = "4.11.2"
|
||||||
|
|
||||||
error_report_email = "support@erpnext.com"
|
error_report_email = "support@erpnext.com"
|
||||||
|
|
||||||
|
|||||||
@ -341,11 +341,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
var tax_count = this.frm.tax_doclist.length;
|
var tax_count = this.frm.tax_doclist.length;
|
||||||
|
|
||||||
this.frm.doc.grand_total = flt(
|
this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
|
||||||
tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total,
|
this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate);
|
||||||
precision("grand_total"));
|
|
||||||
this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate,
|
|
||||||
precision("grand_total_export"));
|
|
||||||
|
|
||||||
this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
||||||
precision("other_charges_total"));
|
precision("other_charges_total"));
|
||||||
@ -353,6 +350,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
this.frm.doc.net_total_export + flt(this.frm.doc.discount_amount),
|
this.frm.doc.net_total_export + flt(this.frm.doc.discount_amount),
|
||||||
precision("other_charges_total_export"));
|
precision("other_charges_total_export"));
|
||||||
|
|
||||||
|
this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
|
||||||
|
this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total_export, precision("grand_total_export"));
|
||||||
|
|
||||||
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
||||||
this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export);
|
this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -381,7 +381,8 @@ def make_packing_slip(source_name, target_doc=None):
|
|||||||
"Delivery Note": {
|
"Delivery Note": {
|
||||||
"doctype": "Packing Slip",
|
"doctype": "Packing Slip",
|
||||||
"field_map": {
|
"field_map": {
|
||||||
"name": "delivery_note"
|
"name": "delivery_note",
|
||||||
|
"letter_head": "letter_head"
|
||||||
},
|
},
|
||||||
"validation": {
|
"validation": {
|
||||||
"docstatus": ["=", 0]
|
"docstatus": ["=", 0]
|
||||||
|
|||||||
@ -205,7 +205,8 @@ def make_purchase_order(source_name, target_doc=None):
|
|||||||
["uom", "stock_uom"],
|
["uom", "stock_uom"],
|
||||||
["uom", "uom"]
|
["uom", "uom"]
|
||||||
],
|
],
|
||||||
"postprocess": update_item
|
"postprocess": update_item,
|
||||||
|
"condition": lambda doc: doc.ordered_qty < doc.qty
|
||||||
}
|
}
|
||||||
}, target_doc, set_missing_values)
|
}, target_doc, set_missing_values)
|
||||||
|
|
||||||
@ -243,7 +244,8 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None):
|
|||||||
["uom", "stock_uom"],
|
["uom", "stock_uom"],
|
||||||
["uom", "uom"]
|
["uom", "uom"]
|
||||||
],
|
],
|
||||||
"postprocess": update_item
|
"postprocess": update_item,
|
||||||
|
"condition": lambda doc: doc.ordered_qty < doc.qty
|
||||||
}
|
}
|
||||||
}, target_doc, postprocess)
|
}, target_doc, postprocess)
|
||||||
|
|
||||||
@ -315,7 +317,8 @@ def make_stock_entry(source_name, target_doc=None):
|
|||||||
"uom": "stock_uom",
|
"uom": "stock_uom",
|
||||||
"warehouse": "t_warehouse"
|
"warehouse": "t_warehouse"
|
||||||
},
|
},
|
||||||
"postprocess": update_item
|
"postprocess": update_item,
|
||||||
|
"condition": lambda doc: doc.ordered_qty < doc.qty
|
||||||
}
|
}
|
||||||
}, target_doc, set_missing_values)
|
}, target_doc, set_missing_values)
|
||||||
|
|
||||||
|
|||||||
@ -158,6 +158,23 @@
|
|||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "letter_head_details",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Letter Head",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 1,
|
||||||
|
"fieldname": "letter_head",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Letter Head",
|
||||||
|
"options": "Letter Head",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "misc_details",
|
"fieldname": "misc_details",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
@ -180,7 +197,7 @@
|
|||||||
"icon": "icon-suitcase",
|
"icon": "icon-suitcase",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2014-05-27 03:49:14.251039",
|
"modified": "2014-11-13 16:50:50.423299",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Packing Slip",
|
"name": "Packing Slip",
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -1,7 +1,7 @@
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
import os
|
import os
|
||||||
|
|
||||||
version = "4.11.1"
|
version = "4.11.2"
|
||||||
|
|
||||||
with open("requirements.txt", "r") as f:
|
with open("requirements.txt", "r") as f:
|
||||||
install_requires = f.readlines()
|
install_requires = f.readlines()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user