Merge branch 'develop'

This commit is contained in:
Pratik Vyas 2014-11-14 15:27:34 +05:30
commit b1fdbf2335
13 changed files with 271 additions and 282 deletions

View File

@ -1 +1 @@
__version__ = '4.11.1'
__version__ = '4.11.2'

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals
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 erpnext.setup.utils import get_company_currency
@ -13,10 +13,6 @@ from erpnext.controllers.accounts_controller import AccountsController
class JournalVoucher(AccountsController):
def __init__(self, arg1, arg2=None):
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):
if not self.is_opening:
@ -40,7 +36,7 @@ class JournalVoucher(AccountsController):
def on_submit(self):
if self.voucher_type in ['Bank Voucher', 'Contra Voucher', 'Journal Entry']:
self.check_credit_days()
self.check_reference_date()
self.make_gl_entries()
self.check_credit_limit()
self.update_advance_paid()
@ -309,43 +305,18 @@ class JournalVoucher(AccountsController):
from frappe.utils import money_in_words
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:
for d in self.get("entries"):
if flt(d.credit) > 0 and d.against_invoice \
and frappe.db.get_value("Account", d.account, "master_type")=='Customer':
posting_date = frappe.db.get_value("Sales Invoice", d.against_invoice, "posting_date")
credit_days = self.get_credit_days_for(d.account)
if credit_days:
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
due_date = None
if d.against_invoice and flt(d.credit) > 0:
due_date = frappe.db.get_value("Sales Invoice", d.against_invoice, "due_date")
elif d.against_voucher and flt(d.debit) > 0:
due_date = frappe.db.get_value("Purchase Invoice", d.against_voucher, "due_date")
def get_credit_days_for(self, ac):
if not self.credit_days_for.has_key(ac):
self.credit_days_for[ac] = cint(frappe.db.get_value("Account", ac, "credit_days"))
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
if due_date and getdate(self.cheque_date) > getdate(due_date):
msgprint(_("Note: Reference Date {0} is after invoice due date {1}")
.format(formatdate(self.cheque_date), formatdate(due_date)))
def make_gl_entries(self, cancel=0, adv_adj=0):
from erpnext.accounts.general_ledger import make_gl_entries

View File

@ -42,9 +42,6 @@ frappe.ui.form.on("Payment Tool", "received_or_paid", function(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
frappe.ui.form.on("Payment Tool", "customer", function(frm) {
erpnext.payment_tool.set_party_account(frm);

View File

@ -210,14 +210,15 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
calculate_totals: function() {
var tax_count = this.frm.tax_doclist.length;
this.frm.doc.grand_total = flt(tax_count ?
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, precision("grand_total_import"));
this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate);
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
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
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);

View File

@ -22,10 +22,9 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.cscript.make_contact(doc,dt,dn);
cur_frm.communication_view = new frappe.views.CommunicationList({
list: frappe.get_list("Communication", {"supplier": doc.name}),
parent: cur_frm.fields_dict.communication_html.wrapper,
doc: doc
})
});
}
}

View File

@ -110,13 +110,13 @@ class BuyingController(StockController):
self.round_floats_in(self, ["net_total", "net_total_import"])
def calculate_totals(self):
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist
else self.net_total, self.precision("grand_total"))
self.grand_total_import = flt(self.grand_total / self.conversion_rate,
self.precision("grand_total_import"))
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
self.grand_total_import = flt(self.grand_total / self.conversion_rate)
self.total_tax = flt(self.grand_total - self.net_total,
self.precision("total_tax"))
self.total_tax = flt(self.grand_total - self.net_total, 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"):
self.rounded_total = rounded(self.grand_total)

View File

@ -216,17 +216,17 @@ class SellingController(StockController):
self.round_floats_in(self, ["net_total", "net_total_export"])
def calculate_totals(self):
self.grand_total = flt(self.tax_doclist and \
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.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
self.other_charges_total = flt(self.grand_total - self.net_total,
self.precision("other_charges_total"))
self.grand_total_export = flt(self.grand_total / self.conversion_rate)
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.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))
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_export = rounded(self.grand_total_export)

View File

@ -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_icon = "icon-th"
app_color = "#e74c3c"
app_version = "4.11.1"
app_version = "4.11.2"
error_report_email = "support@erpnext.com"

View File

@ -341,11 +341,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
var me = this;
var tax_count = this.frm.tax_doclist.length;
this.frm.doc.grand_total = flt(
tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total,
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.grand_total = flt(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);
this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_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),
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_export = Math.round(this.frm.doc.grand_total_export);
},

View File

@ -381,7 +381,8 @@ def make_packing_slip(source_name, target_doc=None):
"Delivery Note": {
"doctype": "Packing Slip",
"field_map": {
"name": "delivery_note"
"name": "delivery_note",
"letter_head": "letter_head"
},
"validation": {
"docstatus": ["=", 0]

View File

@ -205,7 +205,8 @@ def make_purchase_order(source_name, target_doc=None):
["uom", "stock_uom"],
["uom", "uom"]
],
"postprocess": update_item
"postprocess": update_item,
"condition": lambda doc: doc.ordered_qty < doc.qty
}
}, 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", "uom"]
],
"postprocess": update_item
"postprocess": update_item,
"condition": lambda doc: doc.ordered_qty < doc.qty
}
}, target_doc, postprocess)
@ -315,7 +317,8 @@ def make_stock_entry(source_name, target_doc=None):
"uom": "stock_uom",
"warehouse": "t_warehouse"
},
"postprocess": update_item
"postprocess": update_item,
"condition": lambda doc: doc.ordered_qty < doc.qty
}
}, target_doc, set_missing_values)

View File

@ -1,264 +1,281 @@
{
"autoname": "PS.#######",
"creation": "2013-04-11 15:32:24",
"description": "Generate packing slips for packages to be delivered. Used to notify package number, package contents and its weight.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Transaction",
"autoname": "PS.#######",
"creation": "2013-04-11 15:32:24",
"description": "Generate packing slips for packages to be delivered. Used to notify package number, package contents and its weight.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Transaction",
"fields": [
{
"fieldname": "packing_slip_details",
"fieldtype": "Section Break",
"label": "Packing Slip Items",
"permlevel": 0,
"fieldname": "packing_slip_details",
"fieldtype": "Section Break",
"label": "Packing Slip Items",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
},
{
"description": "Indicates that the package is a part of this delivery (Only Draft)",
"fieldname": "delivery_note",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Delivery Note",
"options": "Delivery Note",
"permlevel": 0,
"read_only": 0,
"description": "Indicates that the package is a part of this delivery (Only Draft)",
"fieldname": "delivery_note",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Delivery Note",
"options": "Delivery Note",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"no_copy": 0,
"options": "PS-",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"no_copy": 0,
"options": "PS-",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 1
},
},
{
"fieldname": "section_break0",
"fieldtype": "Section Break",
"permlevel": 0,
"fieldname": "section_break0",
"fieldtype": "Section Break",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "column_break2",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
},
{
"description": "Identification of the package for the delivery (for print)",
"fieldname": "from_case_no",
"fieldtype": "Data",
"in_list_view": 1,
"label": "From Package No.",
"no_copy": 1,
"permlevel": 0,
"read_only": 0,
"reqd": 1,
"description": "Identification of the package for the delivery (for print)",
"fieldname": "from_case_no",
"fieldtype": "Data",
"in_list_view": 1,
"label": "From Package No.",
"no_copy": 1,
"permlevel": 0,
"read_only": 0,
"reqd": 1,
"width": "50px"
},
},
{
"fieldname": "column_break3",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
},
{
"description": "If more than one package of the same type (for print)",
"fieldname": "to_case_no",
"fieldtype": "Data",
"in_list_view": 1,
"label": "To Package No.",
"no_copy": 1,
"permlevel": 0,
"read_only": 0,
"description": "If more than one package of the same type (for print)",
"fieldname": "to_case_no",
"fieldtype": "Data",
"in_list_view": 1,
"label": "To Package No.",
"no_copy": 1,
"permlevel": 0,
"read_only": 0,
"width": "50px"
},
},
{
"fieldname": "package_item_details",
"fieldtype": "Section Break",
"label": "Package Item Details",
"permlevel": 0,
"fieldname": "package_item_details",
"fieldtype": "Section Break",
"label": "Package Item Details",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "get_items",
"fieldtype": "Button",
"label": "Get Items",
"fieldname": "get_items",
"fieldtype": "Button",
"label": "Get Items",
"permlevel": 0
},
},
{
"fieldname": "item_details",
"fieldtype": "Table",
"label": "Items",
"options": "Packing Slip Item",
"permlevel": 0,
"fieldname": "item_details",
"fieldtype": "Table",
"label": "Items",
"options": "Packing Slip Item",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "package_weight_details",
"fieldtype": "Section Break",
"label": "Package Weight Details",
"permlevel": 0,
"fieldname": "package_weight_details",
"fieldtype": "Section Break",
"label": "Package Weight Details",
"permlevel": 0,
"read_only": 0
},
},
{
"description": "The net weight of this package. (calculated automatically as sum of net weight of items)",
"fieldname": "net_weight_pkg",
"fieldtype": "Float",
"label": "Net Weight",
"no_copy": 1,
"permlevel": 0,
"description": "The net weight of this package. (calculated automatically as sum of net weight of items)",
"fieldname": "net_weight_pkg",
"fieldtype": "Float",
"label": "Net Weight",
"no_copy": 1,
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "net_weight_uom",
"fieldtype": "Link",
"label": "Net Weight UOM",
"no_copy": 1,
"options": "UOM",
"permlevel": 0,
"fieldname": "net_weight_uom",
"fieldtype": "Link",
"label": "Net Weight UOM",
"no_copy": 1,
"options": "UOM",
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "column_break4",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break4",
"fieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
},
{
"description": "The gross weight of the package. Usually net weight + packaging material weight. (for print)",
"fieldname": "gross_weight_pkg",
"fieldtype": "Float",
"label": "Gross Weight",
"no_copy": 1,
"permlevel": 0,
"description": "The gross weight of the package. Usually net weight + packaging material weight. (for print)",
"fieldname": "gross_weight_pkg",
"fieldtype": "Float",
"label": "Gross Weight",
"no_copy": 1,
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "gross_weight_uom",
"fieldtype": "Link",
"label": "Gross Weight UOM",
"no_copy": 1,
"options": "UOM",
"permlevel": 0,
"fieldname": "gross_weight_uom",
"fieldtype": "Link",
"label": "Gross Weight UOM",
"no_copy": 1,
"options": "UOM",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "misc_details",
"fieldtype": "Section Break",
"label": "Misc Details",
"permlevel": 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",
"fieldtype": "Section Break",
"label": "Misc Details",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Amended From",
"no_copy": 1,
"options": "Packing Slip",
"permlevel": 0,
"print_hide": 1,
"fieldname": "amended_from",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Amended From",
"no_copy": 1,
"options": "Packing Slip",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
}
],
"icon": "icon-suitcase",
"idx": 1,
"is_submittable": 1,
"modified": "2014-05-27 03:49:14.251039",
"modified_by": "Administrator",
"module": "Stock",
"name": "Packing Slip",
"owner": "Administrator",
],
"icon": "icon-suitcase",
"idx": 1,
"is_submittable": 1,
"modified": "2014-11-13 16:50:50.423299",
"modified_by": "Administrator",
"module": "Stock",
"name": "Packing Slip",
"owner": "Administrator",
"permissions": [
{
"amend": 1,
"apply_user_permissions": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Material User",
"submit": 1,
"amend": 1,
"apply_user_permissions": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Material User",
"submit": 1,
"write": 1
},
},
{
"amend": 1,
"apply_user_permissions": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"submit": 1,
"amend": 1,
"apply_user_permissions": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"submit": 1,
"write": 1
},
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Material Master Manager",
"submit": 1,
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Material Master Manager",
"submit": 1,
"write": 1
},
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Material Manager",
"submit": 1,
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Material Manager",
"submit": 1,
"write": 1
},
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"submit": 1,
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"submit": 1,
"write": 1
}
],
"read_only_onload": 1,
],
"read_only_onload": 1,
"search_fields": "delivery_note"
}
}

View File

@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
version = "4.11.1"
version = "4.11.2"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()