Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6060499ef2 | ||
|
|
27ba588e63 | ||
|
|
ece5077b71 | ||
|
|
c85db1cbb2 | ||
|
|
1adb77ee17 | ||
|
|
368a314d48 | ||
|
|
40d4a8d13f | ||
|
|
47c64ec728 | ||
|
|
4dd6b7e671 | ||
|
|
23b190414c | ||
|
|
0bfd4849ca | ||
|
|
828e2fd5e0 | ||
|
|
0e19e72a5d | ||
|
|
6dfc78b12a | ||
|
|
a5162b7529 | ||
|
|
2eb9b34ff2 | ||
|
|
5db108116a | ||
|
|
bf3e26dd2d | ||
|
|
10ee3655d3 | ||
|
|
f8122646ba | ||
|
|
2dd26055c9 | ||
|
|
8f6e6ff543 | ||
|
|
d492b675a7 | ||
|
|
36a0c5c564 | ||
|
|
db6b832302 | ||
|
|
6125abc495 | ||
|
|
690a0805f6 | ||
|
|
b09c87bd0f | ||
|
|
ef7b6ab8ef | ||
|
|
3b79f19614 | ||
|
|
b0f7e5b23f | ||
|
|
2bb845e53f | ||
|
|
29628f3bb1 | ||
|
|
45328f7729 | ||
|
|
fd5d0db6e2 | ||
|
|
01eb7d02cc | ||
|
|
5af737dd67 | ||
|
|
1c383c3664 | ||
|
|
c5d186c497 | ||
|
|
40d63d0675 | ||
|
|
05997b9138 | ||
|
|
62dbbfba0d | ||
|
|
04f3286c04 | ||
|
|
31c0d43b95 | ||
|
|
6558e1dd80 | ||
|
|
a54a2a99f4 | ||
|
|
eb04405d6b | ||
|
|
d112417301 | ||
|
|
de974c684c | ||
|
|
6c5a9bbe6b | ||
|
|
2edf6b84d6 | ||
|
|
58e493ad51 | ||
|
|
a1f7e070ec | ||
|
|
9333b6208a | ||
|
|
d818bcd888 | ||
|
|
d2e02a3023 | ||
|
|
1daebc04d0 | ||
|
|
4668a69cf5 | ||
|
|
97a70b226a | ||
|
|
19fec06366 |
@@ -1 +1,4 @@
|
||||
from erpnext.__version__ import __version__
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__version__ = '6.27.26'
|
||||
@@ -1,2 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '6.27.17'
|
||||
@@ -19,8 +19,12 @@ class Account(Document):
|
||||
self.get("__onload").can_freeze_account = True
|
||||
|
||||
def autoname(self):
|
||||
self.name = self.account_name.strip() + ' - ' + \
|
||||
frappe.db.get_value("Company", self.company, "abbr")
|
||||
# first validate if company exists
|
||||
company = frappe.db.get_value("Company", self.company, ["abbr", "name"], as_dict=True)
|
||||
if not company:
|
||||
frappe.throw(_('Company {0} does not exist').format(self.company))
|
||||
|
||||
self.name = self.account_name.strip() + ' - ' + company.abbr
|
||||
|
||||
def validate(self):
|
||||
if frappe.local.flags.allow_unverified_charts:
|
||||
@@ -68,7 +72,7 @@ class Account(Document):
|
||||
if self.root_type != db_value.root_type:
|
||||
frappe.db.sql("update `tabAccount` set root_type=%s where lft > %s and rgt < %s",
|
||||
(self.root_type, self.lft, self.rgt))
|
||||
|
||||
|
||||
if self.root_type and not self.report_type:
|
||||
self.report_type = "Balance Sheet" \
|
||||
if self.root_type in ("Asset", "Liability", "Equity") else "Profit and Loss"
|
||||
@@ -78,14 +82,14 @@ class Account(Document):
|
||||
if frappe.db.exists("Account", self.name):
|
||||
if not frappe.db.get_value("Account", self.name, "parent_account"):
|
||||
throw(_("Root cannot be edited."), RootNotEditable)
|
||||
|
||||
|
||||
if not self.parent_account and not self.is_group:
|
||||
frappe.throw(_("Root Account must be a group"))
|
||||
|
||||
|
||||
def validate_group_or_ledger(self):
|
||||
if self.get("__islocal"):
|
||||
return
|
||||
|
||||
|
||||
existing_is_group = frappe.db.get_value("Account", self.name, "is_group")
|
||||
if self.is_group != existing_is_group:
|
||||
if self.check_gle_exists():
|
||||
@@ -153,7 +157,7 @@ class Account(Document):
|
||||
def validate_mandatory(self):
|
||||
if not self.root_type:
|
||||
throw(_("Root Type is mandatory"))
|
||||
|
||||
|
||||
if not self.report_type:
|
||||
throw(_("Report Type is mandatory"))
|
||||
|
||||
@@ -189,9 +193,6 @@ class Account(Document):
|
||||
|
||||
def validate_trash(self):
|
||||
"""checks gl entries and if child exists"""
|
||||
if not self.parent_account:
|
||||
throw(_("Root account can not be deleted"))
|
||||
|
||||
if self.check_gle_exists():
|
||||
throw(_("Account with existing transaction can not be deleted"))
|
||||
if self.check_if_child_exists():
|
||||
@@ -216,9 +217,9 @@ class Account(Document):
|
||||
|
||||
if val != [self.is_group, self.root_type, self.company]:
|
||||
throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
|
||||
|
||||
|
||||
if self.is_group and frappe.db.get_value("Account", new, "parent_account") == old:
|
||||
frappe.db.set_value("Account", new, "parent_account",
|
||||
frappe.db.set_value("Account", new, "parent_account",
|
||||
frappe.db.get_value("Account", old, "parent_account"))
|
||||
|
||||
return new_account
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax
|
||||
|
||||
@@ -19,6 +20,12 @@ def valdiate_taxes_and_charges_template(doc):
|
||||
where is_default = 1 and name != %s and company = %s""".format(doc.doctype),
|
||||
(doc.name, doc.company))
|
||||
|
||||
validate_disabled(doc)
|
||||
|
||||
for tax in doc.get("taxes"):
|
||||
validate_taxes_and_charges(tax)
|
||||
validate_inclusive_tax(tax, doc)
|
||||
|
||||
def validate_disabled(doc):
|
||||
if doc.is_default and doc.disabled:
|
||||
frappe.throw(_("Disabled template must not be default template"))
|
||||
|
||||
@@ -140,4 +140,11 @@ def get_tax_template(posting_date, args):
|
||||
if rule.get(key): rule.no_of_keys_matched += 1
|
||||
|
||||
rule = sorted(tax_rule, lambda b, a: cmp(a.no_of_keys_matched, b.no_of_keys_matched) or cmp(a.priority, b.priority))[0]
|
||||
return rule.sales_tax_template or rule.purchase_tax_template
|
||||
|
||||
tax_template = rule.sales_tax_template or rule.purchase_tax_template
|
||||
doctype = "{0} Taxes and Charges Template".format(rule.tax_type)
|
||||
|
||||
if frappe.db.get_value(doctype, tax_template, 'disabled')==1:
|
||||
return None
|
||||
|
||||
return tax_template
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-04-04 17:27:19.104519",
|
||||
"modified": "2016-05-17 08:40:18.711626",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Delivered Items To Be Billed",
|
||||
"owner": "Administrator",
|
||||
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t`tabDelivery Note Item`.`billed_amt` as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n `tabDelivery Note`.per_billed < 100\norder by `tabDelivery Note`.`name` desc",
|
||||
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`base_amount` - `tabDelivery Note Item`.`billed_amt`*ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere \n `tabDelivery Note`.name = `tabDelivery Note Item`.parent \n and `tabDelivery Note`.docstatus = 1 \n and `tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") \n and `tabDelivery Note Item`.amount > 0\n and `tabDelivery Note Item`.billed_amt < `tabDelivery Note Item`.amount\norder by `tabDelivery Note`.`name` desc",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Delivered Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-04-01 08:26:43.868609",
|
||||
"modified": "2016-05-17 08:26:50.810208",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Ordered Items To Be Billed",
|
||||
"owner": "Administrator",
|
||||
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc",
|
||||
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (`tabSales Order Item`.base_amount - (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and `tabSales Order Item`.amount > 0\n and `tabSales Order Item`.billed_amt < `tabSales Order Item`.amount\norder by `tabSales Order`.transaction_date asc",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Ordered Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-04-01 08:27:32.122070",
|
||||
"modified": "2016-05-17 08:28:26.093139",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Order Items To Be Billed",
|
||||
"owner": "Administrator",
|
||||
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n\tand (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1)) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc",
|
||||
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n and `tabPurchase Order Item`.amount > 0\n\tand (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) < `tabPurchase Order Item`.base_amount\norder by `tabPurchase Order`.transaction_date asc",
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Purchase Order Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -147,10 +147,11 @@ def get_invoice_expense_map(invoice_list):
|
||||
|
||||
def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
|
||||
tax_details = frappe.db.sql("""
|
||||
select parent, account_head, sum(base_tax_amount_after_discount_amount) as tax_amount
|
||||
select parent, account_head, case add_deduct_tax when "Add" then sum(base_tax_amount_after_discount_amount)
|
||||
else sum(base_tax_amount_after_discount_amount) * -1 end as tax_amount
|
||||
from `tabPurchase Taxes and Charges`
|
||||
where parent in (%s) and category in ('Total', 'Valuation and Total')
|
||||
group by parent, account_head
|
||||
group by parent, account_head, add_deduct_tax
|
||||
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
||||
|
||||
invoice_tax_map = {}
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-04-04 17:27:29.449124",
|
||||
"modified": "2016-05-17 08:38:49.654749",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Received Items To Be Billed",
|
||||
"owner": "Administrator",
|
||||
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t`tabPurchase Receipt Item`.`billed_amt` as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 and `tabPurchase Receipt`.status != \"Closed\" and \n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n `tabPurchase Receipt`.per_billed < 100\norder by `tabPurchase Receipt`.`name` desc",
|
||||
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`base_amount` - `tabPurchase Receipt Item`.`billed_amt`*ifnull(`tabPurchase Receipt`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent \n and `tabPurchase Receipt`.docstatus = 1 \n and `tabPurchase Receipt`.status != \"Closed\" \n and `tabPurchase Receipt Item`.amount > 0\n and `tabPurchase Receipt Item`.billed_amt < `tabPurchase Receipt Item`.amount\norder by `tabPurchase Receipt`.`name` desc",
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Received Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -14,6 +14,26 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
onload: function() {
|
||||
this.setup_queries();
|
||||
this._super();
|
||||
|
||||
if(this.frm.get_field('shipping_address')) {
|
||||
this.frm.set_query("shipping_address", function(){
|
||||
if(me.frm.doc.customer){
|
||||
return{
|
||||
filters:{
|
||||
"customer": me.frm.doc.customer
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
return{
|
||||
filters:{
|
||||
"is_your_company_address": 1,
|
||||
"company": me.frm.doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setup_queries: function() {
|
||||
@@ -174,25 +194,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
|
||||
shipping_address: function(){
|
||||
var me = this;
|
||||
|
||||
this.frm.set_query("shipping_address", function(){
|
||||
if(me.frm.doc.customer){
|
||||
return{
|
||||
filters:{
|
||||
"customer": me.frm.doc.customer
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
return{
|
||||
filters:{
|
||||
"is_your_company_address": 1,
|
||||
"company": me.frm.doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.utils.get_address_display(this.frm, "shipping_address",
|
||||
"shipping_address_display", is_your_company_address=true)
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from erpnext.__version__ import __version__
|
||||
|
||||
@@ -8,7 +8,9 @@ frappe.ui.form.on("Opportunity", {
|
||||
customer: function(frm) {
|
||||
erpnext.utils.get_party_details(frm);
|
||||
},
|
||||
customer_address: erpnext.utils.get_address_display,
|
||||
customer_address: function(frm, cdt, cdn){
|
||||
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false);
|
||||
},
|
||||
contact_person: erpnext.utils.get_contact_details,
|
||||
enquiry_from: function(frm) {
|
||||
frm.toggle_reqd("lead", frm.doc.enquiry_from==="Lead");
|
||||
|
||||
@@ -265,7 +265,7 @@
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "status",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Open\nQuotation\nLost\nReplied\nClosed",
|
||||
"options": "Open\nQuotation\nConverted\nLost\nReplied\nClosed",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
@@ -974,7 +974,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-03-03 06:13:49.728079",
|
||||
"modified": "2016-07-03 06:13:49.728079",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Opportunity",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
from . import __version__ as app_version
|
||||
|
||||
app_name = "erpnext"
|
||||
app_title = "ERPNext"
|
||||
@@ -7,7 +8,6 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
|
||||
app_description = """ERP made simple"""
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "6.27.17"
|
||||
app_email = "info@erpnext.com"
|
||||
app_license = "GNU General Public License (v3)"
|
||||
source_link = "https://github.com/frappe/erpnext"
|
||||
|
||||
@@ -15,13 +15,21 @@ form_grid_templates = {
|
||||
|
||||
class BOM(Document):
|
||||
def autoname(self):
|
||||
last_name = frappe.db.sql("""select max(name) from `tabBOM`
|
||||
where name like "BOM/{0}/%%" and item=%s
|
||||
""".format(frappe.db.escape(self.item, percent=False)), self.item)
|
||||
if last_name:
|
||||
idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
|
||||
names = frappe.db.sql_list("""select name from `tabBOM` where item=%s""", self.item)
|
||||
|
||||
if names:
|
||||
# name can be BOM/ITEM/001, BOM/ITEM/001-1, BOM-ITEM-001, BOM-ITEM-001-1
|
||||
|
||||
# split by item
|
||||
names = [name.split(self.item)[-1][1:] for name in names]
|
||||
|
||||
# split by (-) if cancelled
|
||||
names = [cint(name.split('-')[-1]) for name in names]
|
||||
|
||||
idx = max(names) + 1
|
||||
else:
|
||||
idx = 1
|
||||
|
||||
self.name = 'BOM/' + self.item + ('/%.3i' % idx)
|
||||
|
||||
def validate(self):
|
||||
|
||||
@@ -177,7 +177,7 @@ $.extend(cur_frm.cscript, {
|
||||
flt(this.frm.doc.material_transferred_for_manufacturing) - flt(this.frm.doc.produced_qty) :
|
||||
flt(this.frm.doc.qty) - flt(this.frm.doc.material_transferred_for_manufacturing);
|
||||
|
||||
frappe.prompt({fieldtype:"Int", label: __("Qty for {0}", [purpose]), fieldname:"qty",
|
||||
frappe.prompt({fieldtype:"Float", label: __("Qty for {0}", [purpose]), fieldname:"qty",
|
||||
description: __("Max: {0}", [max]) },
|
||||
function(data) {
|
||||
if(data.qty > max) {
|
||||
|
||||
@@ -259,3 +259,4 @@ erpnext.patches.v6_20x.remove_fiscal_year_from_holiday_list
|
||||
erpnext.patches.v6_24.map_customer_address_to_shipping_address_on_po
|
||||
erpnext.patches.v6_27.fix_recurring_order_status
|
||||
erpnext.patches.v6_20x.update_product_bundle_description
|
||||
erpnext.patches.v6_20x.repost_valuation_rate_for_negative_inventory
|
||||
@@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import cint
|
||||
from erpnext.stock.stock_balance import repost
|
||||
|
||||
def execute():
|
||||
if cint(frappe.db.get_value("Stock Settings", None, "allow_negative_stock")):
|
||||
repost(only_actual=True)
|
||||
@@ -337,10 +337,6 @@ def make_material_request(source_name, target_doc=None):
|
||||
def postprocess(source, doc):
|
||||
doc.material_request_type = "Purchase"
|
||||
|
||||
so = frappe.get_doc("Sales Order", source_name)
|
||||
|
||||
item_table = "Packed Item" if so.packed_items else "Sales Order Item"
|
||||
|
||||
doc = get_mapped_doc("Sales Order", source_name, {
|
||||
"Sales Order": {
|
||||
"doctype": "Material Request",
|
||||
@@ -348,12 +344,20 @@ def make_material_request(source_name, target_doc=None):
|
||||
"docstatus": ["=", 1]
|
||||
}
|
||||
},
|
||||
item_table: {
|
||||
"Packed Item": {
|
||||
"doctype": "Material Request Item",
|
||||
"field_map": {
|
||||
"parent": "sales_order",
|
||||
"stock_uom": "uom"
|
||||
}
|
||||
},
|
||||
"Sales Order Item": {
|
||||
"doctype": "Material Request Item",
|
||||
"field_map": {
|
||||
"parent": "sales_order",
|
||||
"stock_uom": "uom"
|
||||
},
|
||||
"condition": lambda doc: not frappe.db.exists('Product Bundle', doc.item_code)
|
||||
}
|
||||
}, target_doc, postprocess)
|
||||
|
||||
|
||||
@@ -103,9 +103,9 @@ class Company(Document):
|
||||
create_charts(self.chart_of_accounts, self.name)
|
||||
|
||||
frappe.db.set(self, "default_receivable_account", frappe.db.get_value("Account",
|
||||
{"company": self.name, "account_type": "Receivable"}))
|
||||
{"company": self.name, "account_type": "Receivable", "is_group": 0}))
|
||||
frappe.db.set(self, "default_payable_account", frappe.db.get_value("Account",
|
||||
{"company": self.name, "account_type": "Payable"}))
|
||||
{"company": self.name, "account_type": "Payable", "is_group": 0}))
|
||||
|
||||
def set_default_accounts(self):
|
||||
self._set_default_account("default_cash_account", "Cash")
|
||||
|
||||
@@ -20,6 +20,7 @@ def setup_complete(args=None):
|
||||
|
||||
install_fixtures.install(args.get("country"))
|
||||
|
||||
update_setup_wizard_access()
|
||||
create_fiscal_year_and_company(args)
|
||||
create_users(args)
|
||||
set_defaults(args)
|
||||
@@ -53,6 +54,14 @@ def setup_complete(args=None):
|
||||
|
||||
pass
|
||||
|
||||
def update_setup_wizard_access():
|
||||
setup_wizard = frappe.get_doc('Page', 'setup-wizard')
|
||||
for roles in setup_wizard.roles:
|
||||
if roles.role == 'System Manager':
|
||||
roles.role = 'Administrator'
|
||||
setup_wizard.flags.ignore_permissions = 1
|
||||
setup_wizard.save()
|
||||
|
||||
def create_fiscal_year_and_company(args):
|
||||
if (args.get('fy_start_date')):
|
||||
curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
|
||||
|
||||
@@ -310,7 +310,8 @@ class PurchaseReceipt(BuyingController):
|
||||
stock_value_diff = frappe.db.get_value("Stock Ledger Entry",
|
||||
{"voucher_type": "Purchase Receipt", "voucher_no": self.name,
|
||||
"voucher_detail_no": d.name}, "stock_value_difference")
|
||||
|
||||
if not stock_value_diff:
|
||||
continue
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": warehouse_account[d.warehouse]["name"],
|
||||
"against": stock_rbnb,
|
||||
|
||||
@@ -49,7 +49,7 @@ class StockEntry(StockController):
|
||||
self.validate_batch()
|
||||
|
||||
self.set_actual_qty()
|
||||
self.calculate_rate_and_amount()
|
||||
self.calculate_rate_and_amount(update_finished_item_rate=False)
|
||||
|
||||
def on_submit(self):
|
||||
self.update_stock_ledger()
|
||||
@@ -234,18 +234,20 @@ class StockEntry(StockController):
|
||||
self.set_actual_qty()
|
||||
self.calculate_rate_and_amount()
|
||||
|
||||
def calculate_rate_and_amount(self, force=False):
|
||||
self.set_basic_rate(force)
|
||||
def calculate_rate_and_amount(self, force=False, update_finished_item_rate=True):
|
||||
self.set_basic_rate(force, update_finished_item_rate)
|
||||
self.distribute_additional_costs()
|
||||
self.update_valuation_rate()
|
||||
self.set_total_incoming_outgoing_value()
|
||||
self.set_total_amount()
|
||||
|
||||
def set_basic_rate(self, force=False):
|
||||
def set_basic_rate(self, force=False, update_finished_item_rate=True):
|
||||
"""get stock and incoming rate on posting date"""
|
||||
raw_material_cost = 0.0
|
||||
fg_basic_rate = 0.0
|
||||
|
||||
for d in self.get('items'):
|
||||
if d.t_warehouse: fg_basic_rate = flt(d.basic_rate)
|
||||
args = frappe._dict({
|
||||
"item_code": d.item_code,
|
||||
"warehouse": d.s_warehouse or d.t_warehouse,
|
||||
@@ -266,13 +268,14 @@ class StockEntry(StockController):
|
||||
if not d.t_warehouse:
|
||||
raw_material_cost += flt(d.basic_amount)
|
||||
|
||||
self.set_basic_rate_for_finished_goods(raw_material_cost)
|
||||
number_of_fg_items = len([t.t_warehouse for t in self.get("items") if t.t_warehouse])
|
||||
if (fg_basic_rate == 0.0 and number_of_fg_items == 1) or update_finished_item_rate:
|
||||
self.set_basic_rate_for_finished_goods(raw_material_cost)
|
||||
|
||||
def set_basic_rate_for_finished_goods(self, raw_material_cost):
|
||||
if self.purpose in ["Manufacture", "Repack"]:
|
||||
number_of_fg_items = len([t.t_warehouse for t in self.get("items") if t.t_warehouse])
|
||||
for d in self.get("items"):
|
||||
if d.bom_no or (d.t_warehouse and number_of_fg_items == 1):
|
||||
if d.bom_no or d.t_warehouse:
|
||||
d.basic_rate = flt(raw_material_cost / flt(d.transfer_qty), d.precision("basic_rate"))
|
||||
d.basic_amount = flt(raw_material_cost, d.precision("basic_amount"))
|
||||
|
||||
|
||||
@@ -229,27 +229,35 @@ class update_entries_after(object):
|
||||
# calculate new valuation rate only if stock value is positive
|
||||
# else it remains the same as that of previous entry
|
||||
self.valuation_rate = new_stock_value / new_stock_qty
|
||||
|
||||
|
||||
def get_moving_average_values(self, sle):
|
||||
actual_qty = flt(sle.actual_qty)
|
||||
new_stock_qty = flt(self.qty_after_transaction) + actual_qty
|
||||
if new_stock_qty >= 0:
|
||||
if actual_qty > 0:
|
||||
if flt(self.qty_after_transaction) <= 0:
|
||||
self.valuation_rate = sle.incoming_rate
|
||||
else:
|
||||
new_stock_value = (self.qty_after_transaction * self.valuation_rate) + \
|
||||
(actual_qty * sle.incoming_rate)
|
||||
|
||||
if actual_qty > 0 or flt(sle.outgoing_rate) > 0:
|
||||
rate = flt(sle.incoming_rate) if actual_qty > 0 else flt(sle.outgoing_rate)
|
||||
self.valuation_rate = new_stock_value / new_stock_qty
|
||||
|
||||
if self.qty_after_transaction < 0 and not self.valuation_rate:
|
||||
# if negative stock, take current valuation rate as incoming rate
|
||||
self.valuation_rate = rate
|
||||
elif sle.outgoing_rate:
|
||||
if new_stock_qty:
|
||||
new_stock_value = (self.qty_after_transaction * self.valuation_rate) + \
|
||||
(actual_qty * sle.outgoing_rate)
|
||||
|
||||
new_stock_qty = abs(self.qty_after_transaction) + actual_qty
|
||||
new_stock_value = (abs(self.qty_after_transaction) * self.valuation_rate) + (actual_qty * rate)
|
||||
self.valuation_rate = new_stock_value / new_stock_qty
|
||||
else:
|
||||
self.valuation_rate = sle.outgoing_rate
|
||||
|
||||
if new_stock_qty:
|
||||
self.valuation_rate = new_stock_value / flt(new_stock_qty)
|
||||
else:
|
||||
if flt(self.qty_after_transaction) >= 0 and sle.outgoing_rate:
|
||||
self.valuation_rate = sle.outgoing_rate
|
||||
|
||||
elif not self.valuation_rate and self.qty_after_transaction <= 0:
|
||||
self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse, self.allow_zero_rate)
|
||||
|
||||
self.valuation_rate = abs(flt(self.valuation_rate))
|
||||
if not self.valuation_rate and actual_qty > 0:
|
||||
self.valuation_rate = sle.incoming_rate
|
||||
|
||||
def get_fifo_values(self, sle):
|
||||
incoming_rate = flt(sle.incoming_rate)
|
||||
@@ -268,10 +276,7 @@ class update_entries_after(object):
|
||||
self.stock_queue.append([actual_qty, incoming_rate])
|
||||
else:
|
||||
qty = self.stock_queue[-1][0] + actual_qty
|
||||
if qty == 0:
|
||||
self.stock_queue.pop(-1)
|
||||
else:
|
||||
self.stock_queue[-1] = [qty, incoming_rate]
|
||||
self.stock_queue[-1] = [qty, incoming_rate]
|
||||
else:
|
||||
qty_to_pop = abs(actual_qty)
|
||||
while qty_to_pop:
|
||||
@@ -298,7 +303,7 @@ class update_entries_after(object):
|
||||
break
|
||||
else:
|
||||
index = 0
|
||||
|
||||
|
||||
# select first batch or the batch with same rate
|
||||
batch = self.stock_queue[index]
|
||||
if qty_to_pop >= batch[0]:
|
||||
@@ -320,7 +325,11 @@ class update_entries_after(object):
|
||||
stock_value = sum((flt(batch[0]) * flt(batch[1]) for batch in self.stock_queue))
|
||||
stock_qty = sum((flt(batch[0]) for batch in self.stock_queue))
|
||||
|
||||
self.valuation_rate = (stock_value / flt(stock_qty)) if stock_qty else 0
|
||||
if stock_qty:
|
||||
self.valuation_rate = stock_value / flt(stock_qty)
|
||||
|
||||
if not self.stock_queue:
|
||||
self.stock_queue.append([0, sle.incoming_rate or sle.outgoing_rate or self.valuation_rate])
|
||||
|
||||
def get_sle_before_datetime(self):
|
||||
"""get previous stock ledger entry before current time-bucket"""
|
||||
|
||||
@@ -5,10 +5,12 @@ frappe.provide("erpnext.support");
|
||||
|
||||
frappe.ui.form.on_change("Maintenance Schedule", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
frappe.ui.form.on_change("Maintenance Schedule", "customer_address",
|
||||
erpnext.utils.get_address_display);
|
||||
frappe.ui.form.on_change("Maintenance Schedule", "contact_person",
|
||||
erpnext.utils.get_contact_details);
|
||||
frappe.ui.form.on_change("Maintenance Schedule", "customer_address", function(){
|
||||
erpnext.utils.get_address_display(cur_frm, 'customer_address', 'address_display');
|
||||
});
|
||||
frappe.ui.form.on_change("Maintenance Schedule", "contact_person", function(){
|
||||
erpnext.utils.get_contact_details(cur_frm);
|
||||
});
|
||||
|
||||
// TODO commonify this code
|
||||
erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({
|
||||
|
||||
@@ -6,10 +6,12 @@ frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer_address",
|
||||
erpnext.utils.get_address_display);
|
||||
frappe.ui.form.on_change("Maintenance Visit", "contact_person",
|
||||
erpnext.utils.get_contact_details);
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer_address", function(frm){
|
||||
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display')
|
||||
});
|
||||
frappe.ui.form.on_change("Maintenance Visit", "contact_person", function(frm){
|
||||
erpnext.utils.get_contact_details(frm)
|
||||
});
|
||||
|
||||
// TODO commonify this code
|
||||
erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
|
||||
@@ -87,4 +89,4 @@ cur_frm.fields_dict['purposes'].grid.get_field('item_code').get_query = function
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return {query: "erpnext.controllers.queries.customer_query" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2066,7 +2066,7 @@ DocType: Delivery Note,Required only for sample item.,ಕೇವಲ ಮಾದ
|
||||
DocType: Stock Ledger Entry,Actual Qty After Transaction,ವ್ಯವಹಾರದ ನಂತರ ನಿಜವಾದ ಪ್ರಮಾಣ
|
||||
,Pending SO Items For Purchase Request,ಖರೀದಿ ವಿನಂತಿ ಆದ್ದರಿಂದ ಐಟಂಗಳು ಬಾಕಿ
|
||||
DocType: Supplier,Billing Currency,ಬಿಲ್ಲಿಂಗ್ ಕರೆನ್ಸಿ
|
||||
apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +148,Extra Large,ದೊಡ್ಡದು
|
||||
apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +148,Extra Large,ಎಕ್ಸ್ಟ್ರಾ ದೊಡ್ಡದು
|
||||
,Profit and Loss Statement,ಲಾಭ ಮತ್ತು ನಷ್ಟ ಹೇಳಿಕೆ
|
||||
DocType: Bank Reconciliation Detail,Cheque Number,ಚೆಕ್ ಸಂಖ್ಯೆ
|
||||
DocType: Payment Tool Detail,Payment Tool Detail,ಪಾವತಿ ಉಪಕರಣ ವಿವರ
|
||||
@@ -2076,7 +2076,7 @@ apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py +500,Warnin
|
||||
apps/erpnext/erpnext/setup/setup_wizard/setup_wizard.py +362,Local,ಸ್ಥಳೀಯ
|
||||
apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +26,Loans and Advances (Assets),ಸಾಲ ಮತ್ತು ಅಡ್ವಾನ್ಸಸ್ ( ಆಸ್ತಿಗಳು )
|
||||
apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +12,Debtors,ಸಾಲಗಾರರು
|
||||
apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +147,Large,ದೊಡ್ಡದು
|
||||
apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +147,Large,ದೊಡ್ಡ
|
||||
DocType: C-Form Invoice Detail,Territory,ಕ್ಷೇತ್ರ
|
||||
apps/erpnext/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +139,Please mention no of visits required,ನಮೂದಿಸಿ ಅಗತ್ಯವಿದೆ ಭೇಟಿ ಯಾವುದೇ
|
||||
DocType: Stock Settings,Default Valuation Method,ಡೀಫಾಲ್ಟ್ ಮೌಲ್ಯಮಾಪನ ವಿಧಾನ
|
||||
|
||||
|
Can't render this file because it is too large.
|
10
setup.py
10
setup.py
@@ -1,7 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from setuptools import setup, find_packages
|
||||
from pip.req import parse_requirements
|
||||
import re, ast
|
||||
|
||||
# get version from __version__ variable in erpnext/__init__.py
|
||||
_version_re = re.compile(r'__version__\s+=\s+(.*)')
|
||||
|
||||
with open('erpnext/__init__.py', 'rb') as f:
|
||||
version = str(ast.literal_eval(_version_re.search(
|
||||
f.read().decode('utf-8')).group(1)))
|
||||
|
||||
version = "6.27.17"
|
||||
requirements = parse_requirements("requirements.txt", session="")
|
||||
|
||||
setup(
|
||||
|
||||
Reference in New Issue
Block a user