mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-23 02:59:41 +00:00
Compare commits
76 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f553e7206 | ||
|
|
ba7d8b0cac | ||
|
|
1ce6df8ff6 | ||
|
|
7132bd3659 | ||
|
|
13a2574bd6 | ||
|
|
09855fc3cc | ||
|
|
55f6308169 | ||
|
|
c2ae1a7375 | ||
|
|
c792e65d99 | ||
|
|
471908ab9f | ||
|
|
9fef3df6a0 | ||
|
|
8a686ba982 | ||
|
|
f509d13d28 | ||
|
|
96d7905383 | ||
|
|
b2e7a1f605 | ||
|
|
3912a31a6f | ||
|
|
b713406e22 | ||
|
|
32b2a7795e | ||
|
|
f945e10cce | ||
|
|
2f957f27b0 | ||
|
|
7b46e5148a | ||
|
|
79a415e3b8 | ||
|
|
ce893499d7 | ||
|
|
d89152e4a5 | ||
|
|
6677fd58ef | ||
|
|
c6a695d0f3 | ||
|
|
54910000d4 | ||
|
|
1f2f82fcc2 | ||
|
|
1a0d32cdfb | ||
|
|
c33e96f860 | ||
|
|
ca95384f05 | ||
|
|
4b207647db | ||
|
|
ade5b82167 | ||
|
|
bcbfeb0d53 | ||
|
|
710c38ffe1 | ||
|
|
94360cca20 | ||
|
|
f1b276122e | ||
|
|
62be8dfd21 | ||
|
|
1a922196fa | ||
|
|
c6b47bcdda | ||
|
|
15f7b1ee1a | ||
|
|
08b39b1ff8 | ||
|
|
da7d1667d5 | ||
|
|
4f10f15686 | ||
|
|
d02038f591 | ||
|
|
83e61bf368 | ||
|
|
d95c376d57 | ||
|
|
c6285069dc | ||
|
|
4ccf692f7c | ||
|
|
8573aee8b8 | ||
|
|
dab3cdc106 | ||
|
|
2de1f86009 | ||
|
|
b176dea74e | ||
|
|
47b89756d9 | ||
|
|
aabc634afd | ||
|
|
3becd4239f | ||
|
|
1b5edcbbd8 | ||
|
|
51135a1522 | ||
|
|
97e523b4a4 | ||
|
|
09ec13f7cf | ||
|
|
2179cd97c8 | ||
|
|
c8baa01e9c | ||
|
|
dda0906458 | ||
|
|
cd04380149 | ||
|
|
df3bf5d76b | ||
|
|
833432086b | ||
|
|
2646f84a30 | ||
|
|
7364f0cf1c | ||
|
|
a9ce706bfb | ||
|
|
49ccac5d95 | ||
|
|
98122a2574 | ||
|
|
ea768ec132 | ||
|
|
d00ce6a8cf | ||
|
|
68a628ea1e | ||
|
|
6a277e244c | ||
|
|
383b13cdb5 |
@@ -16,16 +16,13 @@ install:
|
||||
- sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis
|
||||
- sudo pip install --upgrade pip
|
||||
- rm $TRAVIS_BUILD_DIR/.git/shallow
|
||||
- cd ~/ && bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git --frappe-branch develop
|
||||
- bash $TRAVIS_BUILD_DIR/travis/bench_init.sh
|
||||
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
|
||||
|
||||
script:
|
||||
- cd ~/frappe-bench
|
||||
- bench get-app erpnext $TRAVIS_BUILD_DIR
|
||||
- bench use test_site
|
||||
- bench setup redis-cache
|
||||
- bench setup redis-async-broker
|
||||
- bench setup procfile --with-celery-broker
|
||||
- bench reinstall
|
||||
- bench build
|
||||
- bench build-website
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# stolen from http://cgit.drupalcode.org/octopus/commit/?id=db4f837
|
||||
includedir=`mysql_config --variable=pkgincludedir`
|
||||
thiscwd=`pwd`
|
||||
_THIS_DB_VERSION=`mysql -V 2>&1 | tr -d "\n" | cut -d" " -f6 | awk '{ print $1}' | cut -d"-" -f1 | awk '{ print $1}' | sed "s/[\,']//g"`
|
||||
if [ "$_THIS_DB_VERSION" = "5.5.40" ] && [ ! -e "$includedir-$_THIS_DB_VERSION-fixed.log" ] ; then
|
||||
cd $includedir
|
||||
sudo patch -p1 < $thiscwd/ci/my_config.h.patch &> /dev/null
|
||||
sudo touch $includedir-$_THIS_DB_VERSION-fixed.log
|
||||
fi
|
||||
@@ -1,22 +0,0 @@
|
||||
diff -burp a/my_config.h b/my_config.h
|
||||
--- a/my_config.h 2014-10-09 19:32:46.000000000 -0400
|
||||
+++ b/my_config.h 2014-10-09 19:35:12.000000000 -0400
|
||||
@@ -641,17 +641,4 @@
|
||||
#define SIZEOF_TIME_T 8
|
||||
/* #undef TIME_T_UNSIGNED */
|
||||
|
||||
-/*
|
||||
- stat structure (from <sys/stat.h>) is conditionally defined
|
||||
- to have different layout and size depending on the defined macros.
|
||||
- The correct macro is defined in my_config.h, which means it MUST be
|
||||
- included first (or at least before <features.h> - so, practically,
|
||||
- before including any system headers).
|
||||
-
|
||||
- __GLIBC__ is defined in <features.h>
|
||||
-*/
|
||||
-#ifdef __GLIBC__
|
||||
-#error <my_config.h> MUST be included first!
|
||||
-#endif
|
||||
-
|
||||
#endif
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '6.27.1'
|
||||
__version__ = '6.27.8'
|
||||
|
||||
@@ -353,25 +353,31 @@ class JournalEntry(AccountsController):
|
||||
self.remark = ("\n").join(r) #User Remarks is not mandatory
|
||||
|
||||
def set_print_format_fields(self):
|
||||
total_amount = 0.0
|
||||
bank_account_currency = None
|
||||
pay_to_recd_from = None
|
||||
bank_amount = party_amount = total_amount = 0.0
|
||||
currency = bank_account_currency = party_account_currency = pay_to_recd_from= None
|
||||
for d in self.get('accounts'):
|
||||
if d.party_type and d.party:
|
||||
if not pay_to_recd_from:
|
||||
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
||||
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
||||
|
||||
party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||
party_account_currency = d.account_currency
|
||||
|
||||
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
|
||||
total_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||
bank_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||
bank_account_currency = d.account_currency
|
||||
|
||||
if pay_to_recd_from:
|
||||
self.pay_to_recd_from = pay_to_recd_from
|
||||
else:
|
||||
total_amount = 0
|
||||
if bank_amount:
|
||||
total_amount = bank_amount
|
||||
currency = bank_account_currency
|
||||
else:
|
||||
total_amount = party_amount
|
||||
currency = party_account_currency
|
||||
|
||||
self.set_total_amount(total_amount, bank_account_currency)
|
||||
self.set_total_amount(total_amount, currency)
|
||||
|
||||
def set_total_amount(self, amt, currency):
|
||||
self.total_amount = amt
|
||||
@@ -664,7 +670,7 @@ def get_payment_entry(ref_doc, args):
|
||||
bank_row.cost_center = cost_center
|
||||
|
||||
amount = args.get("debit_in_account_currency") or args.get("amount")
|
||||
|
||||
|
||||
if bank_row.account_currency == args.get("party_account_currency"):
|
||||
bank_row.set(args.get("amount_field_bank"), amount)
|
||||
else:
|
||||
|
||||
@@ -598,13 +598,13 @@
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_create": 1,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-02-24 16:49:46.832403",
|
||||
"modified": "2016-04-12 15:26:22.756129",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Request",
|
||||
@@ -675,5 +675,6 @@
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -242,6 +242,8 @@ def filter_pricing_rules(args, pricing_rules):
|
||||
for p in pricing_rules:
|
||||
if p.item_code and args.variant_of:
|
||||
p.variant_of = args.variant_of
|
||||
else:
|
||||
p.variant_of = None
|
||||
|
||||
# find pricing rule with highest priority
|
||||
if pricing_rules:
|
||||
@@ -251,7 +253,7 @@ def filter_pricing_rules(args, pricing_rules):
|
||||
|
||||
# apply internal priority
|
||||
all_fields = ["item_code", "item_group", "brand", "customer", "customer_group", "territory",
|
||||
"supplier", "supplier_type", "campaign", "sales_partner"]
|
||||
"supplier", "supplier_type", "campaign", "sales_partner", "variant_of"]
|
||||
|
||||
if len(pricing_rules) > 1:
|
||||
for field_set in [["item_code", "variant_of", "item_group", "brand"],
|
||||
|
||||
@@ -2692,7 +2692,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2016-03-18 13:13:43.694604",
|
||||
"modified": "2016-03-21 13:13:43.694604",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice",
|
||||
|
||||
@@ -3418,7 +3418,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2016-03-18 13:12:12.430038",
|
||||
"modified": "2016-03-21 13:12:12.430038",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
||||
@@ -375,7 +375,7 @@ class SalesInvoice(SellingController):
|
||||
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
|
||||
|
||||
if flt(self.paid_amount) + flt(self.write_off_amount) \
|
||||
- flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)):
|
||||
- flt(self.grand_total) > 1/(10**(self.precision("grand_total") + 1)):
|
||||
frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
|
||||
|
||||
|
||||
@@ -471,7 +471,7 @@ class SalesInvoice(SellingController):
|
||||
frappe.db.set(self,'paid_amount',0)
|
||||
|
||||
frappe.db.set(self, 'base_paid_amount',
|
||||
flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount")))
|
||||
flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount")))
|
||||
|
||||
def check_prev_docstatus(self):
|
||||
for d in self.get('items'):
|
||||
|
||||
@@ -19,19 +19,6 @@ frappe.ui.form.on("Tax Rule", "refresh", function(frm) {
|
||||
frappe.ui.form.trigger("Tax Rule", "tax_type");
|
||||
})
|
||||
|
||||
frappe.ui.form.on("Tax Rule", "use_for_shopping_cart", function(frm) {
|
||||
if(!frm.doc.use_for_shopping_cart &&
|
||||
(frappe.get_list("Tax Rule", {"use_for_shopping_cart":1}).length == 0)) {
|
||||
frappe.model.get_value("Shopping Cart Settings", "Shopping Cart Settings",
|
||||
"enabled", function(docfield) {
|
||||
if(docfield.enabled){
|
||||
frm.set_value("use_for_shopping_cart", 1);
|
||||
frappe.throw(__("Shopping Cart is enabled"));
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
frappe.ui.form.on("Tax Rule", "customer", function(frm) {
|
||||
frappe.call({
|
||||
method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
|
||||
@@ -64,4 +51,4 @@ frappe.ui.form.on("Tax Rule", "supplier", function(frm) {
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import cstr
|
||||
from frappe.utils import cstr, cint
|
||||
|
||||
class IncorrectCustomerGroup(frappe.ValidationError): pass
|
||||
class IncorrectSupplierType(frappe.ValidationError): pass
|
||||
@@ -20,15 +20,16 @@ class TaxRule(Document):
|
||||
self.validate_tax_template()
|
||||
self.validate_date()
|
||||
self.validate_filters()
|
||||
self.validate_use_for_shopping_cart()
|
||||
|
||||
def validate_tax_template(self):
|
||||
if self.tax_type== "Sales":
|
||||
self.purchase_tax_template = self.supplier = self.supplier_type= None
|
||||
self.purchase_tax_template = self.supplier = self.supplier_type = None
|
||||
if self.customer:
|
||||
self.customer_group = None
|
||||
|
||||
else:
|
||||
self.sales_tax_template= self.customer = self.customer_group= None
|
||||
self.sales_tax_template = self.customer = self.customer_group = None
|
||||
|
||||
if self.supplier:
|
||||
self.supplier_type = None
|
||||
@@ -81,6 +82,15 @@ class TaxRule(Document):
|
||||
if tax_rule[0].priority == self.priority:
|
||||
frappe.throw(_("Tax Rule Conflicts with {0}".format(tax_rule[0].name)), ConflictingTaxRule)
|
||||
|
||||
def validate_use_for_shopping_cart(self):
|
||||
'''If shopping cart is enabled and no tax rule exists for shopping cart, enable this one'''
|
||||
if (not self.use_for_shopping_cart
|
||||
and cint(frappe.db.get_single_value('Shopping Cart Settings', 'enabled'))
|
||||
and not frappe.db.get_value('Tax Rule', {'use_for_shopping_cart': 1, 'name': ['!=', self.name]})):
|
||||
|
||||
self.use_for_shopping_cart = 1
|
||||
frappe.msgprint(_("Enabling 'Use for Shopping Cart', as Shopping Cart is enabled and there should be at least one Tax Rule for Shopping Cart"))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_party_details(party, party_type, args=None):
|
||||
out = {}
|
||||
@@ -109,11 +119,11 @@ def get_party_details(party, party_type, args=None):
|
||||
def get_tax_template(posting_date, args):
|
||||
"""Get matching tax rule"""
|
||||
args = frappe._dict(args)
|
||||
conditions = ["""(from_date is null or from_date = '' or from_date <= '{0}')
|
||||
conditions = ["""(from_date is null or from_date = '' or from_date <= '{0}')
|
||||
and (to_date is null or to_date = '' or to_date >= '{0}')""".format(posting_date)]
|
||||
|
||||
for key, value in args.iteritems():
|
||||
if key in "use_for_shopping_cart":
|
||||
if key=="use_for_shopping_cart":
|
||||
conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0))
|
||||
else:
|
||||
conditions.append("ifnull({0}, '') in ('', '{1}')".format(key, frappe.db.escape(cstr(value))))
|
||||
|
||||
@@ -299,8 +299,12 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup
|
||||
else:
|
||||
args.update(get_party_details(party, party_type))
|
||||
|
||||
if party_type=="Customer":
|
||||
if party_type in ("Customer", "Lead"):
|
||||
args.update({"tax_type": "Sales"})
|
||||
|
||||
if party_type=='Lead':
|
||||
args['customer'] = None
|
||||
del args['lead']
|
||||
else:
|
||||
args.update({"tax_type": "Purchase"})
|
||||
|
||||
|
||||
@@ -37,9 +37,12 @@
|
||||
<br>{%= data[i][__("Voucher No")] %}</td>
|
||||
<td>{%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}
|
||||
<br>{%= __("Remarks") %}: {%= data[i][__("Remarks")] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Invoiced Amount")]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Paid Amount")]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Outstanding Amount")]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i][__("Invoiced Amount")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i][__("Paid Amount")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i][__("Outstanding Amount")], data[i]["currency"]) %}</td>
|
||||
{% } else { %}
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
||||
@@ -58,21 +58,19 @@ class ReceivablePayableReport(object):
|
||||
"width": 120
|
||||
})
|
||||
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
})
|
||||
if args.get("party_type") == "Customer":
|
||||
columns += [_("Territory") + ":Link/Territory:80"]
|
||||
if args.get("party_type") == "Supplier":
|
||||
columns += [_("Supplier Type") + ":Link/Supplier Type:80"]
|
||||
columns += [
|
||||
{
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 100,
|
||||
"hidden": 1
|
||||
},
|
||||
_("Remarks") + "::200"
|
||||
]
|
||||
|
||||
|
||||
columns.append(_("Remarks") + "::200")
|
||||
|
||||
return columns
|
||||
|
||||
def get_data(self, party_naming_by, args):
|
||||
@@ -120,17 +118,17 @@ class ReceivablePayableReport(object):
|
||||
row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2),
|
||||
cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount)
|
||||
|
||||
if self.filters.get(scrub(args.get("party_type"))):
|
||||
row.append(gle.account_currency)
|
||||
else:
|
||||
row.append(company_currency)
|
||||
|
||||
# customer territory / supplier type
|
||||
if args.get("party_type") == "Customer":
|
||||
row += [self.get_territory(gle.party)]
|
||||
if args.get("party_type") == "Supplier":
|
||||
row += [self.get_supplier_type(gle.party)]
|
||||
|
||||
if self.filters.get(scrub(args.get("party_type"))):
|
||||
row.append(gle.account_currency)
|
||||
else:
|
||||
row.append(company_currency)
|
||||
|
||||
row.append(gle.remarks)
|
||||
data.append(row)
|
||||
|
||||
|
||||
@@ -18,18 +18,25 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
columns += [ args.get("party_type") + " Name::140"]
|
||||
|
||||
columns += [
|
||||
_("Total Invoiced Amt") + ":Currency:140",
|
||||
_("Total Paid Amt") + ":Currency:140",
|
||||
_("Total Outstanding Amt") + ":Currency:160",
|
||||
"0-" + str(self.filters.range1) + ":Currency:100",
|
||||
str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency:100",
|
||||
str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency:100",
|
||||
str(self.filters.range3) + _("-Above") + ":Currency:100"]
|
||||
_("Total Invoiced Amt") + ":Currency/currency:140",
|
||||
_("Total Paid Amt") + ":Currency/currency:140",
|
||||
_("Total Outstanding Amt") + ":Currency/currency:160",
|
||||
"0-" + str(self.filters.range1) + ":Currency/currency:100",
|
||||
str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency/currency:100",
|
||||
str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency/currency:100",
|
||||
str(self.filters.range3) + _("-Above") + ":Currency/currency:100"]
|
||||
|
||||
if args.get("party_type") == "Customer":
|
||||
columns += [_("Territory") + ":Link/Territory:80"]
|
||||
if args.get("party_type") == "Supplier":
|
||||
columns += [_("Supplier Type") + ":Link/Supplier Type:80"]
|
||||
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 80
|
||||
})
|
||||
|
||||
return columns
|
||||
|
||||
@@ -53,6 +60,8 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
row += [self.get_territory(party)]
|
||||
if args.get("party_type") == "Supplier":
|
||||
row += [self.get_supplier_type(party)]
|
||||
|
||||
row.append(party_dict.currency)
|
||||
data.append(row)
|
||||
|
||||
return data
|
||||
@@ -73,6 +82,8 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
)
|
||||
for k in party_total[d.party].keys():
|
||||
party_total[d.party][k] += d.get(k, 0)
|
||||
|
||||
party_total[d.party].currency = d.currency
|
||||
|
||||
return party_total
|
||||
|
||||
@@ -90,7 +101,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
cols += ["bill_no", "bill_date"]
|
||||
|
||||
cols += ["invoiced_amt", "paid_amt",
|
||||
"outstanding_amt", "age", "range1", "range2", "range3", "range4"]
|
||||
"outstanding_amt", "age", "range1", "range2", "range3", "range4", "currency"]
|
||||
|
||||
if args.get("party_type") == "Supplier":
|
||||
cols += ["supplier_type", "remarks"]
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-11-02 12:32:02.048551",
|
||||
"modified": "2016-04-04 17:27:19.104519",
|
||||
"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`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`base_amount` - ifnull((select sum(base_amount) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"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 Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\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`.`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",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Delivered Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -145,11 +145,11 @@ class GrossProfitGenerator(object):
|
||||
self.data.append(row)
|
||||
|
||||
if self.grouped:
|
||||
self.collapse_group()
|
||||
self.get_average_rate_based_on_group_by()
|
||||
else:
|
||||
self.grouped_data = []
|
||||
|
||||
def collapse_group(self):
|
||||
def get_average_rate_based_on_group_by(self):
|
||||
# sum buying / selling totals for group
|
||||
self.grouped_data = []
|
||||
for key in self.grouped.keys():
|
||||
@@ -166,6 +166,8 @@ class GrossProfitGenerator(object):
|
||||
if new_row.base_amount else 0
|
||||
new_row.buying_rate = (new_row.buying_amount / new_row.qty) \
|
||||
if new_row.qty else 0
|
||||
new_row.base_rate = (new_row.base_amount / new_row.qty) \
|
||||
if new_row.qty else 0
|
||||
|
||||
self.grouped_data.append(new_row)
|
||||
|
||||
|
||||
@@ -16,6 +16,14 @@ def execute(filters=None):
|
||||
if item_list:
|
||||
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
|
||||
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 80
|
||||
})
|
||||
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
|
||||
print company_currency
|
||||
data = []
|
||||
for d in item_list:
|
||||
purchase_receipt = None
|
||||
@@ -34,7 +42,7 @@ def execute(filters=None):
|
||||
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
|
||||
|
||||
total_tax = sum(row[last_col:])
|
||||
row += [total_tax, d.base_net_amount + total_tax]
|
||||
row += [total_tax, d.base_net_amount + total_tax, company_currency]
|
||||
|
||||
data.append(row)
|
||||
|
||||
@@ -48,7 +56,8 @@ def get_columns():
|
||||
"Supplier Name::120", "Payable Account:Link/Account:120", _("Project") + ":Link/Project:80",
|
||||
_("Company") + ":Link/Company:100", _("Purchase Order") + ":Link/Purchase Order:100",
|
||||
_("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Expense Account") + ":Link/Account:140",
|
||||
_("Qty") + ":Float:120", _("Rate") + ":Currency:120", _("Amount") + ":Currency:120"]
|
||||
_("Qty") + ":Float:120", _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
|
||||
]
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
@@ -110,7 +119,7 @@ def get_tax_accounts(item_list, columns):
|
||||
(tax_amount * d.base_net_amount) / d.base_net_total
|
||||
|
||||
tax_accounts.sort()
|
||||
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
|
||||
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
|
||||
columns += [account_head + ":Currency/currency:80" for account_head in tax_accounts]
|
||||
columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:80"]
|
||||
|
||||
return item_tax, tax_accounts
|
||||
|
||||
@@ -14,7 +14,14 @@ def execute(filters=None):
|
||||
item_list = get_items(filters)
|
||||
if item_list:
|
||||
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
|
||||
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 80
|
||||
})
|
||||
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
|
||||
|
||||
data = []
|
||||
for d in item_list:
|
||||
delivery_note = None
|
||||
@@ -32,7 +39,7 @@ def execute(filters=None):
|
||||
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
|
||||
|
||||
total_tax = sum(row[last_col:])
|
||||
row += [total_tax, d.base_net_amount + total_tax]
|
||||
row += [total_tax, d.base_net_amount + total_tax, company_currency]
|
||||
|
||||
data.append(row)
|
||||
|
||||
@@ -48,7 +55,7 @@ def get_columns():
|
||||
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
|
||||
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
||||
_("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120",
|
||||
_("Rate") + ":Currency:120", _("Amount") + ":Currency:120"
|
||||
_("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
|
||||
]
|
||||
|
||||
def get_conditions(filters):
|
||||
@@ -108,7 +115,7 @@ def get_tax_accounts(item_list, columns):
|
||||
flt((tax_amount * d.base_net_amount) / d.base_net_total)
|
||||
|
||||
tax_accounts.sort()
|
||||
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
|
||||
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
|
||||
columns += [account_head + ":Currency/currency:80" for account_head in tax_accounts]
|
||||
columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:80"]
|
||||
|
||||
return item_tax, tax_accounts
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-02-23 18:48:42.372321",
|
||||
"modified": "2016-04-01 08:26:43.868609",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Ordered Items To Be Billed",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-02-23 18:51:21.968327",
|
||||
"modified": "2016-04-01 08:27:32.122070",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Order Items To Be Billed",
|
||||
|
||||
@@ -21,6 +21,8 @@ def execute(filters=None):
|
||||
invoice_expense_map, expense_accounts)
|
||||
invoice_po_pr_map = get_invoice_po_pr_map(invoice_list)
|
||||
supplier_details = get_supplier_deatils(invoice_list)
|
||||
|
||||
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
|
||||
|
||||
data = []
|
||||
for inv in invoice_list:
|
||||
@@ -32,7 +34,7 @@ def execute(filters=None):
|
||||
row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name,
|
||||
supplier_details.get(inv.supplier),
|
||||
inv.credit_to, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks,
|
||||
", ".join(purchase_order), ", ".join(purchase_receipt)]
|
||||
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency]
|
||||
|
||||
# map expense values
|
||||
base_net_total = 0
|
||||
@@ -62,10 +64,19 @@ def execute(filters=None):
|
||||
def get_columns(invoice_list):
|
||||
"""return columns based on filters"""
|
||||
columns = [
|
||||
_("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier Id") + "::120",
|
||||
_("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120",
|
||||
_("Project") + ":Link/Project:80", _("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
|
||||
_("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100"
|
||||
_("Invoice") + ":Link/Purchase Invoice:120",
|
||||
_("Posting Date") + ":Date:80", _("Supplier Id") + "::120",
|
||||
_("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120",
|
||||
_("Payable Account") + ":Link/Account:120", _("Project") + ":Link/Project:80",
|
||||
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
|
||||
_("Purchase Order") + ":Link/Purchase Order:100",
|
||||
_("Purchase Receipt") + ":Link/Purchase Receipt:100",
|
||||
{
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 80
|
||||
}
|
||||
]
|
||||
expense_accounts = tax_accounts = expense_columns = tax_columns = []
|
||||
|
||||
@@ -84,14 +95,14 @@ def get_columns(invoice_list):
|
||||
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
|
||||
|
||||
|
||||
expense_columns = [(account + ":Currency:120") for account in expense_accounts]
|
||||
expense_columns = [(account + ":Currency/currency:120") for account in expense_accounts]
|
||||
for account in tax_accounts:
|
||||
if account not in expense_accounts:
|
||||
tax_columns.append(account + ":Currency:120")
|
||||
tax_columns.append(account + ":Currency/currency:120")
|
||||
|
||||
columns = columns + expense_columns + [_("Net Total") + ":Currency:120"] + tax_columns + \
|
||||
[_("Total Tax") + ":Currency:120", _("Grand Total") + ":Currency:120",
|
||||
_("Rounded Total") + ":Currency:120", _("Outstanding Amount") + ":Currency:120"]
|
||||
columns = columns + expense_columns + [_("Net Total") + ":Currency/currency:120"] + tax_columns + \
|
||||
[_("Total Tax") + ":Currency/currency:120", _("Grand Total") + ":Currency/currency:120",
|
||||
_("Rounded Total") + ":Currency/currency:120", _("Outstanding Amount") + ":Currency/currency:120"]
|
||||
|
||||
return columns, expense_accounts, tax_accounts
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-11-02 12:33:11.681513",
|
||||
"modified": "2016-04-04 17:27:29.449124",
|
||||
"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`.`qty` - ifnull((select sum(qty) from `tabPurchase Invoice Item` \n\t where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus = 1 and\n\t `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t as \"Qty:Float:110\",\n\t(`tabPurchase Receipt Item`.`base_amount` - ifnull((select sum(base_amount) \n from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus = 1 and\n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t as \"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 Item`.qty > ifnull((select sum(qty) from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus=1 and \n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\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`.`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",
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Received Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -22,6 +22,7 @@ def execute(filters=None):
|
||||
|
||||
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
|
||||
customer_map = get_customer_deatils(invoice_list)
|
||||
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
|
||||
|
||||
data = []
|
||||
for inv in invoice_list:
|
||||
@@ -32,7 +33,8 @@ def execute(filters=None):
|
||||
row = [inv.name, inv.posting_date, inv.customer, inv.customer_name,
|
||||
customer_map.get(inv.customer, {}).get("customer_group"),
|
||||
customer_map.get(inv.customer, {}).get("territory"),
|
||||
inv.debit_to, inv.project, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)]
|
||||
inv.debit_to, inv.project, inv.remarks,
|
||||
", ".join(sales_order), ", ".join(delivery_note), company_currency]
|
||||
|
||||
# map income values
|
||||
base_net_total = 0
|
||||
@@ -66,7 +68,13 @@ def get_columns(invoice_list):
|
||||
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer Id") + "::120",
|
||||
_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
|
||||
_("Receivable Account") + ":Link/Account:120", _("Project") +":Link/Project:80", _("Remarks") + "::150",
|
||||
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100"
|
||||
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
||||
{
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 80
|
||||
}
|
||||
]
|
||||
|
||||
income_accounts = tax_accounts = income_columns = tax_columns = []
|
||||
@@ -83,14 +91,14 @@ def get_columns(invoice_list):
|
||||
and parent in (%s) order by account_head""" %
|
||||
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
|
||||
|
||||
income_columns = [(account + ":Currency:120") for account in income_accounts]
|
||||
income_columns = [(account + ":Currency/currency:120") for account in income_accounts]
|
||||
for account in tax_accounts:
|
||||
if account not in income_accounts:
|
||||
tax_columns.append(account + ":Currency:120")
|
||||
tax_columns.append(account + ":Currency/currency:120")
|
||||
|
||||
columns = columns + income_columns + [_("Net Total") + ":Currency:120"] + tax_columns + \
|
||||
[_("Total Tax") + ":Currency:120", _("Grand Total") + ":Currency:120",
|
||||
_("Rounded Total") + ":Currency:120", _("Outstanding Amount") + ":Currency:120"]
|
||||
columns = columns + income_columns + [_("Net Total") + ":Currency/currency:120"] + tax_columns + \
|
||||
[_("Total Tax") + ":Currency/currency:120", _("Grand Total") + ":Currency/currency:120",
|
||||
_("Rounded Total") + ":Currency/currency:120", _("Outstanding Amount") + ":Currency/currency:120"]
|
||||
|
||||
return columns, income_accounts, tax_accounts
|
||||
|
||||
|
||||
@@ -171,18 +171,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
erpnext.buying.get_items_from_product_bundle(me.frm);
|
||||
}, __("Get items from"));
|
||||
},
|
||||
|
||||
company: function() {
|
||||
var me = this;
|
||||
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address")
|
||||
&& !this.frm.doc.shipping_address) {
|
||||
erpnext.utils.get_shipping_address(this.frm)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
shipping_address: function(){
|
||||
var me = this;
|
||||
|
||||
|
||||
this.frm.set_query("shipping_address", function(){
|
||||
if(me.frm.doc.customer){
|
||||
return{
|
||||
@@ -200,8 +192,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.utils.get_address_display(this.frm, "shipping_address",
|
||||
|
||||
erpnext.utils.get_address_display(this.frm, "shipping_address",
|
||||
"shipping_address_display", is_your_company_address=true)
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2693,7 +2693,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-03-18 13:13:07.334625",
|
||||
"modified": "2016-03-21 13:13:07.334625",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-02-22 11:27:39.445257",
|
||||
"modified": "2016-04-01 08:26:52.361800",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Item-wise Purchase History",
|
||||
|
||||
@@ -184,8 +184,8 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
idx desc,
|
||||
name, item_name
|
||||
limit %(start)s, %(page_len)s """.format(key=searchfield,
|
||||
fcond=get_filters_cond(doctype, filters, conditions),
|
||||
mcond=get_match_cond(doctype)),
|
||||
fcond=get_filters_cond(doctype, filters, conditions).replace('%', '%%'),
|
||||
mcond=get_match_cond(doctype).replace('%', '%%')),
|
||||
{
|
||||
"today": nowdate(),
|
||||
"txt": "%%%s%%" % txt,
|
||||
|
||||
@@ -51,7 +51,10 @@ class SellingController(StockController):
|
||||
|
||||
elif getattr(self, "lead", None):
|
||||
from erpnext.crm.doctype.lead.lead import get_lead_details
|
||||
self.update_if_missing(get_lead_details(self.lead))
|
||||
self.update_if_missing(get_lead_details(
|
||||
self.lead,
|
||||
posting_date=self.get('transaction_date') or self.get('posting_date'),
|
||||
company=self.company))
|
||||
|
||||
def set_price_list_and_item_details(self):
|
||||
self.set_price_list_currency("Selling")
|
||||
|
||||
@@ -283,8 +283,8 @@ class calculate_taxes_and_totals(object):
|
||||
last_tax.tax_amount += diff
|
||||
last_tax.tax_amount_after_discount_amount += diff
|
||||
last_tax.total += diff
|
||||
|
||||
self._set_in_company_currency(last_tax,
|
||||
|
||||
self._set_in_company_currency(last_tax,
|
||||
["total", "tax_amount", "tax_amount_after_discount_amount"])
|
||||
|
||||
def calculate_totals(self):
|
||||
@@ -319,22 +319,22 @@ class calculate_taxes_and_totals(object):
|
||||
self.doc.round_floats_in(self.doc, ["grand_total", "base_grand_total"])
|
||||
|
||||
if self.doc.meta.get_field("rounded_total"):
|
||||
self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total,
|
||||
self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total,
|
||||
self.doc.currency, self.doc.precision("rounded_total"))
|
||||
if self.doc.meta.get_field("base_rounded_total"):
|
||||
company_currency = get_company_currency(self.doc.company)
|
||||
|
||||
|
||||
self.doc.base_rounded_total = \
|
||||
round_based_on_smallest_currency_fraction(self.doc.base_grand_total,
|
||||
round_based_on_smallest_currency_fraction(self.doc.base_grand_total,
|
||||
company_currency, self.doc.precision("base_rounded_total"))
|
||||
|
||||
def _cleanup(self):
|
||||
for tax in self.doc.get("taxes"):
|
||||
tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
|
||||
|
||||
|
||||
def set_discount_amount(self):
|
||||
if not self.doc.discount_amount and self.doc.additional_discount_percentage:
|
||||
self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on)))
|
||||
self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on)))
|
||||
* self.doc.additional_discount_percentage / 100, self.doc.precision("discount_amount"))
|
||||
|
||||
def apply_discount_amount(self):
|
||||
@@ -397,13 +397,13 @@ class calculate_taxes_and_totals(object):
|
||||
for adv in self.doc.get("advances")])
|
||||
|
||||
self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance"))
|
||||
|
||||
|
||||
if self.doc.party_account_currency == self.doc.currency:
|
||||
invoice_total = self.doc.grand_total
|
||||
else:
|
||||
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
|
||||
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
|
||||
self.doc.precision("grand_total"))
|
||||
|
||||
|
||||
if invoice_total > 0 and self.doc.total_advance > invoice_total:
|
||||
frappe.throw(_("Advance amount cannot be greater than {0} {1}")
|
||||
.format(self.doc.party_account_currency, invoice_total))
|
||||
@@ -417,21 +417,23 @@ class calculate_taxes_and_totals(object):
|
||||
# total_advance is only for non POS Invoice
|
||||
if self.doc.is_return:
|
||||
return
|
||||
|
||||
|
||||
self.doc.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount"])
|
||||
self._set_in_company_currency(self.doc, ['write_off_amount'])
|
||||
|
||||
if self.doc.party_account_currency == self.doc.currency:
|
||||
total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance
|
||||
total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance
|
||||
- flt(self.doc.write_off_amount), self.doc.precision("grand_total"))
|
||||
else:
|
||||
total_amount_to_pay = flt(flt(self.doc.grand_total *
|
||||
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
||||
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
||||
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
|
||||
|
||||
|
||||
if self.doc.doctype == "Sales Invoice":
|
||||
self.doc.round_floats_in(self.doc, ["paid_amount"])
|
||||
paid_amount = self.doc.paid_amount \
|
||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
||||
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount),
|
||||
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount),
|
||||
self.doc.precision("outstanding_amount"))
|
||||
elif self.doc.doctype == "Purchase Invoice":
|
||||
self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
|
||||
self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
|
||||
|
||||
@@ -43,6 +43,10 @@ def get_data(filters, conditions):
|
||||
inc, cond= '',''
|
||||
query_details = conditions["based_on_select"] + conditions["period_wise_select"]
|
||||
|
||||
posting_date = 't1.transaction_date'
|
||||
if conditions.get('trans') in ['Sales Invoice', 'Purchase Invoice', 'Purchase Receipt', 'Delivery Note']:
|
||||
posting_date = 't1.posting_date'
|
||||
|
||||
if conditions["based_on_select"] in ["t1.project,", "t2.project,"]:
|
||||
cond = 'and '+ conditions["based_on_select"][:-1] +' IS Not NULL'
|
||||
|
||||
@@ -65,11 +69,11 @@ def get_data(filters, conditions):
|
||||
else :
|
||||
inc = 1
|
||||
data1 = frappe.db.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
|
||||
where t2.parent = t1.name and t1.company = %s and t1.posting_date >= %s and %s >= t1.posting_date and
|
||||
where t2.parent = t1.name and t1.company = %s and %s between %s and %s and
|
||||
t1.docstatus = 1 %s %s
|
||||
group by %s
|
||||
""" % (query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"], "%s",
|
||||
"%s", "%s", conditions.get("addl_tables_relational_cond"), cond, conditions["group_by"]), (filters.get("company"),
|
||||
posting_date, "%s", "%s", conditions.get("addl_tables_relational_cond"), cond, conditions["group_by"]), (filters.get("company"),
|
||||
year_start_date, year_end_date),as_list=1)
|
||||
|
||||
for d in range(len(data1)):
|
||||
@@ -80,11 +84,11 @@ def get_data(filters, conditions):
|
||||
|
||||
#to get distinct value of col specified by group_by in filter
|
||||
row = frappe.db.sql("""select DISTINCT(%s) from `tab%s` t1, `tab%s Item` t2 %s
|
||||
where t2.parent = t1.name and t1.company = %s and t1.posting_date >= %s and %s >= t1.posting_date
|
||||
where t2.parent = t1.name and t1.company = %s and %s between %s and %s
|
||||
and t1.docstatus = 1 and %s = %s %s
|
||||
""" %
|
||||
(sel_col, conditions["trans"], conditions["trans"], conditions["addl_tables"],
|
||||
"%s", "%s", "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")),
|
||||
"%s", posting_date, "%s", "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")),
|
||||
(filters.get("company"), year_start_date, year_end_date, data1[d][0]), as_list=1)
|
||||
|
||||
for i in range(len(row)):
|
||||
@@ -92,11 +96,11 @@ def get_data(filters, conditions):
|
||||
|
||||
#get data for group_by filter
|
||||
row1 = frappe.db.sql(""" select %s , %s from `tab%s` t1, `tab%s Item` t2 %s
|
||||
where t2.parent = t1.name and t1.company = %s and t1.posting_date >= %s and %s >= t1.posting_date
|
||||
where t2.parent = t1.name and t1.company = %s and %s between %s and %s
|
||||
and t1.docstatus = 1 and %s = %s and %s = %s %s
|
||||
""" %
|
||||
(sel_col, conditions["period_wise_select"], conditions["trans"],
|
||||
conditions["trans"], conditions["addl_tables"], "%s", "%s","%s", sel_col,
|
||||
conditions["trans"], conditions["addl_tables"], "%s", posting_date, "%s","%s", sel_col,
|
||||
"%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")),
|
||||
(filters.get("company"), year_start_date, year_end_date, row[i][0],
|
||||
data1[d][0]), as_list=1)
|
||||
@@ -109,12 +113,12 @@ def get_data(filters, conditions):
|
||||
data.append(des)
|
||||
else:
|
||||
data = frappe.db.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
|
||||
where t2.parent = t1.name and t1.company = %s and t1.posting_date >= %s and %s >= t1.posting_date and
|
||||
where t2.parent = t1.name and t1.company = %s and %s between %s and %s and
|
||||
t1.docstatus = 1 %s %s
|
||||
group by %s
|
||||
""" %
|
||||
(query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"],
|
||||
"%s", "%s", "%s", cond, conditions.get("addl_tables_relational_cond", ""), conditions["group_by"]),
|
||||
"%s", posting_date, "%s", "%s", cond, conditions.get("addl_tables_relational_cond", ""), conditions["group_by"]),
|
||||
(filters.get("company"), year_start_date, year_end_date), as_list=1)
|
||||
|
||||
return data
|
||||
|
||||
@@ -10,6 +10,7 @@ from frappe.model.mapper import get_mapped_doc
|
||||
|
||||
from erpnext.controllers.selling_controller import SellingController
|
||||
from erpnext.utilities.address_and_contact import load_address_and_contact
|
||||
from erpnext.accounts.party import set_taxes
|
||||
|
||||
sender_field = "email_id"
|
||||
|
||||
@@ -58,7 +59,7 @@ class Lead(SellingController):
|
||||
def check_email_id_is_unique(self):
|
||||
if self.email_id:
|
||||
# validate email is unique
|
||||
duplicate_leads = frappe.db.sql_list("""select name from tabLead
|
||||
duplicate_leads = frappe.db.sql_list("""select name from tabLead
|
||||
where email_id=%s and name!=%s""", (self.email_id, self.name))
|
||||
|
||||
if duplicate_leads:
|
||||
@@ -138,7 +139,7 @@ def make_quotation(source_name, target_doc=None):
|
||||
return target_doc
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_lead_details(lead):
|
||||
def get_lead_details(lead, posting_date=None, company=None):
|
||||
if not lead: return {}
|
||||
|
||||
from erpnext.accounts.party import set_address_details
|
||||
@@ -158,4 +159,9 @@ def get_lead_details(lead):
|
||||
|
||||
set_address_details(out, lead, "Lead")
|
||||
|
||||
taxes_and_charges = set_taxes(None, 'Lead', posting_date, company,
|
||||
billing_address=out.get('customer_address'), shipping_address=out.get('shipping_address_name'))
|
||||
if taxes_and_charges:
|
||||
out['taxes_and_charges'] = taxes_and_charges
|
||||
|
||||
return out
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#Allow Over Delivery/Billing
|
||||
|
||||
While creating Delivery Note, system validates if item's Qty mentined is same as in the Sales Order. It Item Qty has been increased, you will get over-delivery validation. If you want to be able to deliver more items than mentioned in the Sales Order, you should update "Allow over delivery or receipt upto this percent" in the Item master.
|
||||
While creating Delivery Note, system validates if item's Qty mentined is same as in the Sales Order. If Item Qty has been increased, you will get over-delivery validation. If you want to be able to deliver more items than mentioned in the Sales Order, you should update "Allow over delivery or receipt upto this percent" in the Item master.
|
||||
|
||||
<img alt="Item wise Allowance percentage" class="screenshot" src="{{docs_base_url}}/assets/img/articles/allowance-percentage-1.png">
|
||||
|
||||
@@ -19,4 +19,4 @@ Update global value for "Allow over delivery or receipt upto this percent" from
|
||||
<img alt="Item wise Allowance percentage" class="screenshot" src="{{docs_base_url}}/assets/img/articles/allowance-percentage-2.png">
|
||||
|
||||
|
||||
<!-- markdown -->
|
||||
<!-- markdown -->
|
||||
|
||||
@@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
|
||||
app_description = """ERP made simple"""
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "6.27.1"
|
||||
app_version = "6.27.8"
|
||||
app_email = "info@erpnext.com"
|
||||
app_license = "GNU General Public License (v3)"
|
||||
source_link = "https://github.com/frappe/erpnext"
|
||||
|
||||
@@ -229,14 +229,13 @@ def get_employees_who_are_born_today():
|
||||
and status = 'Active'""", {"date": today()}, as_dict=True)
|
||||
|
||||
def get_holiday_list_for_employee(employee, raise_exception=True):
|
||||
employee = frappe.db.get_value("Employee", employee, ["holiday_list", "company"], as_dict=True)
|
||||
holiday_list = employee.holiday_list
|
||||
holiday_list, company = frappe.db.get_value("Employee", employee, ["holiday_list", "company"])
|
||||
|
||||
if not holiday_list:
|
||||
holiday_list = frappe.db.get_value("Company", employee.company, "default_holiday_list")
|
||||
holiday_list = frappe.db.get_value("Company", company, "default_holiday_list")
|
||||
|
||||
if not holiday_list and raise_exception:
|
||||
frappe.throw(_("Please set a Holiday List for either the Employee or the Company"))
|
||||
frappe.throw(_('Please set a default Holiday List for Employee {0} or Company {0}').format(employee, company))
|
||||
|
||||
return holiday_list
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@ frappe.ui.form.on("Employee Attendance Tool", {
|
||||
refresh: function(frm) {
|
||||
frm.disable_save();
|
||||
},
|
||||
|
||||
|
||||
onload: function(frm) {
|
||||
frm.set_value("date", get_today());
|
||||
erpnext.employee_attendance_tool.load_employees(frm);
|
||||
},
|
||||
|
||||
@@ -22,8 +23,7 @@ frappe.ui.form.on("Employee Attendance Tool", {
|
||||
company: function(frm) {
|
||||
erpnext.employee_attendance_tool.load_employees(frm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,9 @@ class LeaveAllocation(Document):
|
||||
frappe.throw(_("Total leaves allocated is mandatory"))
|
||||
|
||||
def validate_total_leaves_allocated(self):
|
||||
if date_diff(self.to_date, self.from_date) <= flt(self.total_leaves_allocated):
|
||||
# Adding a day to include To Date in the difference
|
||||
date_difference = date_diff(self.to_date, self.from_date) + 1
|
||||
if date_difference < self.total_leaves_allocated:
|
||||
frappe.throw(_("Total allocated leaves are more than days in the period"), OverAllocationError)
|
||||
|
||||
def validate_against_leave_applications(self):
|
||||
|
||||
@@ -335,16 +335,14 @@ def get_leave_allocation_records(date, employee=None):
|
||||
|
||||
|
||||
def get_holidays(employee, from_date, to_date):
|
||||
tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1
|
||||
where e1.name = %s and h1.parent = h2.name and e1.holiday_list = h2.name
|
||||
and h1.holiday_date between %s and %s""", (employee, from_date, to_date))[0][0]
|
||||
'''get holidays between two dates for the given employee'''
|
||||
holiday_list = get_holiday_list_for_employee(employee)
|
||||
|
||||
if not tot_hol:
|
||||
tot_hol = frappe.db.sql("""select count(distinct holiday_date) from `tabHoliday` h1, `tabHoliday List` h2
|
||||
where h1.parent = h2.name and h1.holiday_date between %s and %s
|
||||
and h2.is_default = 1""", (from_date, to_date))[0][0]
|
||||
holidays = frappe.db.sql("""select count(distinct holiday_date) from `tabHoliday` h1, `tabHoliday List` h2
|
||||
where h1.parent = h2.name and h1.holiday_date between %s and %s
|
||||
and h2.name = %s""", (from_date, to_date, holiday_list))[0][0]
|
||||
|
||||
return tot_hol
|
||||
return holidays
|
||||
|
||||
def is_lwp(leave_type):
|
||||
lwp = frappe.db.sql("select is_lwp from `tabLeave Type` where name = %s", leave_type)
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe.utils import add_days, cint, cstr, flt, getdate, nowdate, rounded, date_diff
|
||||
from frappe.utils import add_days, cint, cstr, flt, getdate, nowdate, rounded, date_diff, money_in_words
|
||||
from frappe.model.naming import make_autoname
|
||||
|
||||
from frappe import msgprint, _
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from erpnext.setup.utils import get_company_currency
|
||||
from erpnext.hr.utils import set_employee_name
|
||||
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
|
||||
@@ -18,6 +19,22 @@ class SalarySlip(TransactionBase):
|
||||
def autoname(self):
|
||||
self.name = make_autoname('Sal Slip/' +self.employee + '/.#####')
|
||||
|
||||
def validate(self):
|
||||
self.check_existing()
|
||||
|
||||
if not (len(self.get("earnings")) or len(self.get("deductions"))):
|
||||
self.get_emp_and_leave_details()
|
||||
else:
|
||||
self.get_leave_details(lwp = self.leave_without_pay)
|
||||
|
||||
if not self.net_pay:
|
||||
self.calculate_net_pay()
|
||||
|
||||
company_currency = get_company_currency(self.company)
|
||||
self.total_in_words = money_in_words(self.rounded_total, company_currency)
|
||||
|
||||
set_employee_name(self)
|
||||
|
||||
def get_emp_and_leave_details(self):
|
||||
if self.employee:
|
||||
joining_date, relieving_date = frappe.db.get_value("Employee", self.employee,
|
||||
@@ -59,7 +76,9 @@ class SalarySlip(TransactionBase):
|
||||
|
||||
def get_leave_details(self, joining_date=None, relieving_date=None, lwp=None):
|
||||
if not self.fiscal_year:
|
||||
self.fiscal_year = frappe.db.get_default("fiscal_year")
|
||||
# if default fiscal year is not set, get from nowdate
|
||||
self.fiscal_year = get_fiscal_year(nowdate())[0]
|
||||
|
||||
if not self.month:
|
||||
self.month = "%02d" % getdate(nowdate()).month
|
||||
|
||||
@@ -150,23 +169,6 @@ class SalarySlip(TransactionBase):
|
||||
self.employee = ''
|
||||
frappe.throw(_("Salary Slip of employee {0} already created for this month").format(self.employee))
|
||||
|
||||
def validate(self):
|
||||
from frappe.utils import money_in_words
|
||||
self.check_existing()
|
||||
|
||||
if not (len(self.get("earnings")) or len(self.get("deductions"))):
|
||||
self.get_emp_and_leave_details()
|
||||
else:
|
||||
self.get_leave_details(lwp = self.leave_without_pay)
|
||||
|
||||
if not self.net_pay:
|
||||
self.calculate_net_pay()
|
||||
|
||||
company_currency = get_company_currency(self.company)
|
||||
self.total_in_words = money_in_words(self.rounded_total, company_currency)
|
||||
|
||||
set_employee_name(self)
|
||||
|
||||
def calculate_earning_total(self):
|
||||
self.gross_pay = flt(self.arrear_amount) + flt(self.leave_encashment_amount)
|
||||
for d in self.get("earnings"):
|
||||
|
||||
@@ -71,7 +71,7 @@ class ProductionPlanningTool(Document):
|
||||
pp_so.sales_order_date = cstr(r['transaction_date'])
|
||||
pp_so.customer = cstr(r['customer'])
|
||||
pp_so.grand_total = flt(r['base_grand_total'])
|
||||
|
||||
|
||||
def get_pending_material_requests(self):
|
||||
""" Pull Material Requests that are pending based on criteria selected"""
|
||||
mr_filter = item_filter = ""
|
||||
@@ -81,7 +81,7 @@ class ProductionPlanningTool(Document):
|
||||
mr_filter += " and mr.transaction_date <= %(to_date)s"
|
||||
if self.warehouse:
|
||||
mr_filter += " and mr_item.warehouse = %(warehouse)s"
|
||||
|
||||
|
||||
if self.fg_item:
|
||||
item_filter += " and item.name = %(item)s"
|
||||
|
||||
@@ -102,7 +102,7 @@ class ProductionPlanningTool(Document):
|
||||
}, as_dict=1)
|
||||
|
||||
self.add_mr_in_table(pending_mr)
|
||||
|
||||
|
||||
def add_mr_in_table(self, pending_mr):
|
||||
""" Add Material Requests in the table"""
|
||||
self.clear_table("material_requests")
|
||||
@@ -119,7 +119,7 @@ class ProductionPlanningTool(Document):
|
||||
self.get_so_items()
|
||||
elif self.get_items_from == "Material Request":
|
||||
self.get_mr_items()
|
||||
|
||||
|
||||
def get_so_items(self):
|
||||
so_list = [d.sales_order for d in self.get('sales_orders') if d.sales_order]
|
||||
if not so_list:
|
||||
@@ -128,7 +128,7 @@ class ProductionPlanningTool(Document):
|
||||
|
||||
item_condition = ""
|
||||
if self.fg_item:
|
||||
item_condition = ' and so_item.item_code = "' + self.fg_item + '"'
|
||||
item_condition = ' and so_item.item_code = "{0}"'.format(frappe.db.escape(self.fg_item))
|
||||
|
||||
items = frappe.db.sql("""select distinct parent, item_code, warehouse,
|
||||
(qty - delivered_qty) as pending_qty
|
||||
@@ -139,7 +139,7 @@ class ProductionPlanningTool(Document):
|
||||
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
||||
|
||||
if self.fg_item:
|
||||
item_condition = ' and pi.item_code = "' + self.fg_item + '"'
|
||||
item_condition = ' and pi.item_code = "{0}"'.format(frappe.db.escape(self.fg_item))
|
||||
|
||||
packed_items = frappe.db.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as warehouse,
|
||||
(((so_item.qty - so_item.delivered_qty) * pi.qty) / so_item.qty)
|
||||
@@ -153,7 +153,7 @@ class ProductionPlanningTool(Document):
|
||||
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
||||
|
||||
self.add_items(items + packed_items)
|
||||
|
||||
|
||||
def get_mr_items(self):
|
||||
mr_list = [d.material_request for d in self.get('material_requests') if d.material_request]
|
||||
if not mr_list:
|
||||
@@ -173,7 +173,7 @@ class ProductionPlanningTool(Document):
|
||||
(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
|
||||
|
||||
self.add_items(items)
|
||||
|
||||
|
||||
|
||||
def add_items(self, items):
|
||||
self.clear_table("items")
|
||||
@@ -187,13 +187,13 @@ class ProductionPlanningTool(Document):
|
||||
pi.bom_no = item_details and item_details.bom_no or ''
|
||||
pi.planned_qty = flt(p['pending_qty'])
|
||||
pi.pending_qty = flt(p['pending_qty'])
|
||||
|
||||
|
||||
if self.get_items_from == "Sales Order":
|
||||
pi.sales_order = p['parent']
|
||||
elif self.get_items_from == "Material Request":
|
||||
pi.material_request = p['parent']
|
||||
pi.material_request_item = p['name']
|
||||
|
||||
|
||||
def validate_data(self):
|
||||
self.validate_company()
|
||||
for d in self.get('items'):
|
||||
@@ -201,7 +201,7 @@ class ProductionPlanningTool(Document):
|
||||
frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx)))
|
||||
else:
|
||||
validate_bom_no(d.item_code, d.bom_no)
|
||||
|
||||
|
||||
if not flt(d.planned_qty):
|
||||
frappe.throw(_("Please enter Planned Qty for Item {0} at row {1}").format(d.item_code, d.idx))
|
||||
|
||||
@@ -213,17 +213,17 @@ class ProductionPlanningTool(Document):
|
||||
validate_uom_is_integer(self, "stock_uom", "planned_qty")
|
||||
|
||||
items = self.get_production_items()
|
||||
|
||||
|
||||
pro_list = []
|
||||
frappe.flags.mute_messages = True
|
||||
|
||||
|
||||
for key in items:
|
||||
production_order = self.create_production_order(items[key])
|
||||
if production_order:
|
||||
pro_list.append(production_order)
|
||||
|
||||
|
||||
frappe.flags.mute_messages = False
|
||||
|
||||
|
||||
if pro_list:
|
||||
pro_list = ["""<a href="#Form/Production Order/%s" target="_blank">%s</a>""" % \
|
||||
(p, p) for p in pro_list]
|
||||
@@ -247,14 +247,14 @@ class ProductionPlanningTool(Document):
|
||||
"fg_warehouse" : d.warehouse,
|
||||
"status" : "Draft",
|
||||
}
|
||||
|
||||
|
||||
""" Club similar BOM and item for processing in case of Sales Orders """
|
||||
if self.get_items_from == "Material Request":
|
||||
item_details.update({
|
||||
"qty": d.planned_qty
|
||||
})
|
||||
item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details
|
||||
|
||||
|
||||
else:
|
||||
item_details.update({
|
||||
"qty":flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{})
|
||||
@@ -275,7 +275,7 @@ class ProductionPlanningTool(Document):
|
||||
pro.wip_warehouse = warehouse.get('wip_warehouse')
|
||||
if not pro.fg_warehouse:
|
||||
pro.fg_warehouse = warehouse.get('fg_warehouse')
|
||||
|
||||
|
||||
try:
|
||||
pro.insert()
|
||||
return pro.name
|
||||
@@ -283,7 +283,7 @@ class ProductionPlanningTool(Document):
|
||||
pass
|
||||
|
||||
def get_so_wise_planned_qty(self):
|
||||
"""
|
||||
"""
|
||||
bom_dict {
|
||||
bom_no: ['sales_order', 'qty']
|
||||
}
|
||||
@@ -295,7 +295,7 @@ class ProductionPlanningTool(Document):
|
||||
else:
|
||||
bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
|
||||
return bom_dict
|
||||
|
||||
|
||||
def download_raw_materials(self):
|
||||
""" Create csv data for required raw material to produce finished goods"""
|
||||
self.validate_data()
|
||||
|
||||
@@ -256,4 +256,6 @@ erpnext.patches.v6_24.set_recurring_id
|
||||
erpnext.patches.v6_20x.set_compact_print
|
||||
execute:frappe.delete_doc_if_exists("Web Form", "contact") #2016-03-10
|
||||
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_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
|
||||
|
||||
@@ -3,4 +3,4 @@ import erpnext.setup.install
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("website", "doctype", "web_form_field", force=True)
|
||||
erpnext.setup.install.add_web_forms()
|
||||
#erpnext.setup.install.add_web_forms()
|
||||
|
||||
11
erpnext/patches/v6_20x/update_product_bundle_description.py
Normal file
11
erpnext/patches/v6_20x/update_product_bundle_description.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import sanitize_html
|
||||
|
||||
def execute():
|
||||
for product_bundle in frappe.get_all('Product Bundle'):
|
||||
doc = frappe.get_doc('Product Bundle', product_bundle.name)
|
||||
for item in doc.items:
|
||||
if item.description:
|
||||
description = sanitize_html(item.description)
|
||||
item.db_set('description', description, update_modified=False)
|
||||
1
erpnext/patches/v6_27/__init__.py
Normal file
1
erpnext/patches/v6_27/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
51
erpnext/patches/v6_27/fix_recurring_order_status.py
Normal file
51
erpnext/patches/v6_27/fix_recurring_order_status.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# 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
|
||||
|
||||
def execute():
|
||||
for doc in (
|
||||
{
|
||||
"doctype": "Sales Order",
|
||||
"stock_doctype": "Delivery Note",
|
||||
"invoice_doctype": "Sales Invoice",
|
||||
"stock_doctype_ref_field": "against_sales_order",
|
||||
"invoice_ref_field": "sales_order"
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Order",
|
||||
"stock_doctype": "Purchase Receipt",
|
||||
"invoice_doctype": "Purchase Invoice",
|
||||
"stock_doctype_ref_field": "prevdoc_docname",
|
||||
"invoice_ref_field": "purchase_order"
|
||||
}):
|
||||
|
||||
order_list = frappe.db.sql("""select name from `tab{0}`
|
||||
where docstatus=1 and is_recurring=1
|
||||
and ifnull(recurring_id, '') != name and creation >= '2016-01-25'"""
|
||||
.format(doc["doctype"]), as_dict=1)
|
||||
|
||||
for order in order_list:
|
||||
frappe.db.sql("""update `tab{0} Item`
|
||||
set delivered_qty=0, billed_amt=0 where parent=%s""".format(doc["doctype"]), order.name)
|
||||
|
||||
# Check against Delivery Note and Purchase Receipt
|
||||
stock_doc_list = frappe.db.sql("""select distinct parent from `tab{0} Item`
|
||||
where docstatus=1 and ifnull({1}, '')=%s"""
|
||||
.format(doc["stock_doctype"], doc["stock_doctype_ref_field"]), order.name)
|
||||
|
||||
if stock_doc_list:
|
||||
for dn in stock_doc_list:
|
||||
frappe.get_doc(doc["stock_doctype"], dn[0]).update_qty(update_modified=False)
|
||||
|
||||
# Check against Invoice
|
||||
invoice_list = frappe.db.sql("""select distinct parent from `tab{0} Item`
|
||||
where docstatus=1 and ifnull({1}, '')=%s"""
|
||||
.format(doc["invoice_doctype"], doc["invoice_ref_field"]), order.name)
|
||||
|
||||
if invoice_list:
|
||||
for dn in invoice_list:
|
||||
frappe.get_doc(doc["invoice_doctype"], dn[0]).update_qty(update_modified=False)
|
||||
|
||||
frappe.get_doc(doc["doctype"], order.name).set_status(update=True, update_modified=False)
|
||||
@@ -1,9 +1,13 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doctype("Web Form")
|
||||
frappe.delete_doc("Web Form", "Issues")
|
||||
frappe.delete_doc("Web Form", "Addresses")
|
||||
pass
|
||||
|
||||
from erpnext.setup.install import add_web_forms
|
||||
add_web_forms()
|
||||
# done via fixtures
|
||||
|
||||
# frappe.reload_doctype("Web Form")
|
||||
# frappe.delete_doc("Web Form", "Issues")
|
||||
# frappe.delete_doc("Web Form", "Addresses")
|
||||
|
||||
# from erpnext.setup.install import add_web_forms
|
||||
# add_web_forms()
|
||||
|
||||
@@ -118,7 +118,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
|
||||
setup_sms: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped"], this.frm.doc.status)
|
||||
if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped", "Closed"], this.frm.doc.status)
|
||||
&& this.frm.doctype != "Purchase Invoice") {
|
||||
this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); });
|
||||
}
|
||||
@@ -308,7 +308,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
|
||||
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
|
||||
else var date = this.frm.doc.transaction_date;
|
||||
set_party_account(set_pricing);
|
||||
|
||||
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") &&
|
||||
in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)){
|
||||
erpnext.utils.get_shipping_address(this.frm, function(){
|
||||
set_party_account(set_pricing);
|
||||
})
|
||||
}else{
|
||||
set_party_account(set_pricing);
|
||||
}
|
||||
|
||||
if(this.frm.doc.company) {
|
||||
erpnext.last_selected_company = this.frm.doc.company;
|
||||
@@ -841,11 +849,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this.frm.doc.recurring_id) {
|
||||
this.frm.set_value('recurring_id', this.frm.doc.name);
|
||||
}
|
||||
|
||||
if(this.frm.doc.is_recurring) {
|
||||
if(!this.frm.doc.recurring_id) {
|
||||
this.frm.set_value('recurring_id', this.frm.doc.name);
|
||||
}
|
||||
|
||||
var owner_email = this.frm.doc.owner=="Administrator"
|
||||
? frappe.user_info("Administrator").email
|
||||
: this.frm.doc.owner;
|
||||
|
||||
@@ -28,7 +28,6 @@ function load_erpnext_slides() {
|
||||
{"label": __("Manufacturing"), "value": "Manufacturing"},
|
||||
{"label": __("Retail"), "value": "Retail"},
|
||||
{"label": __("Services"), "value": "Services"},
|
||||
{"label": __("Education"), "value": "Education"},
|
||||
{"label": __("Other"), "value": "Other"},
|
||||
], reqd:1},
|
||||
{fieldname:'chart_of_accounts', label: __('Chart of Accounts'),
|
||||
|
||||
@@ -69,37 +69,57 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field,
|
||||
if(r.message) {
|
||||
frm.set_value(display_field, r.message)
|
||||
}
|
||||
|
||||
if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) {
|
||||
if(!erpnext.utils.validate_mandatory(frm, "Customer/Supplier",
|
||||
frm.doc.customer || frm.doc.supplier, address_field)) return;
|
||||
|
||||
if(!erpnext.utils.validate_mandatory(frm, "Posting/Transaction Date",
|
||||
frm.doc.posting_date || frm.doc.transaction_date, address_field)) return;
|
||||
} else return;
|
||||
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.party.set_taxes",
|
||||
args: {
|
||||
"party": frm.doc.customer || frm.doc.supplier,
|
||||
"party_type": (frm.doc.customer ? "Customer" : "Supplier"),
|
||||
"posting_date": frm.doc.posting_date || frm.doc.transaction_date,
|
||||
"company": frm.doc.company,
|
||||
"billing_address": ((frm.doc.customer) ? (frm.doc.customer_address) : (frm.doc.supplier_address)),
|
||||
"shipping_address": frm.doc.shipping_address_name
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message){
|
||||
frm.set_value("taxes_and_charges", r.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
erpnext.utils.set_taxes(frm, address_field, display_field, is_your_company_address);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
frm.set_value(display_field, null);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
erpnext.utils.set_taxes = function(frm, address_field, display_field, is_your_company_address) {
|
||||
if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) {
|
||||
if(!erpnext.utils.validate_mandatory(frm, "Lead/Customer/Supplier",
|
||||
frm.doc.customer || frm.doc.supplier || frm.doc.lead, address_field)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!erpnext.utils.validate_mandatory(frm, "Posting/Transaction Date",
|
||||
frm.doc.posting_date || frm.doc.transaction_date, address_field)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
var party_type, party;
|
||||
if (frm.doc.lead) {
|
||||
party_type = 'Lead';
|
||||
party = frm.doc.lead;
|
||||
} else if (frm.doc.customer) {
|
||||
party_type = 'Customer';
|
||||
party = frm.doc.customer;
|
||||
} else if (frm.doc.supplier) {
|
||||
party_type = 'Supplier';
|
||||
party = frm.doc.supplier;
|
||||
}
|
||||
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.party.set_taxes",
|
||||
args: {
|
||||
"party": party,
|
||||
"party_type": party_type,
|
||||
"posting_date": frm.doc.posting_date || frm.doc.transaction_date,
|
||||
"company": frm.doc.company,
|
||||
"billing_address": ((frm.doc.customer || frm.doc.lead) ? (frm.doc.customer_address) : (frm.doc.supplier_address)),
|
||||
"shipping_address": frm.doc.shipping_address_name
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message){
|
||||
frm.set_value("taxes_and_charges", r.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
erpnext.utils.get_contact_details = function(frm) {
|
||||
@@ -127,7 +147,7 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) {
|
||||
return true;
|
||||
}
|
||||
|
||||
erpnext.utils.get_shipping_address = function(frm){
|
||||
erpnext.utils.get_shipping_address = function(frm, callback){
|
||||
frappe.call({
|
||||
method: "erpnext.utilities.doctype.address.address.get_shipping_address",
|
||||
args: {company: frm.doc.company},
|
||||
@@ -136,6 +156,10 @@ erpnext.utils.get_shipping_address = function(frm){
|
||||
frm.set_value("shipping_address", r.message[0]) //Address title or name
|
||||
frm.set_value("shipping_address_display", r.message[1]) //Address to be displayed on the page
|
||||
}
|
||||
|
||||
if(callback){
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ def get_customer_outstanding(customer, company):
|
||||
select sum(base_grand_total*(100 - per_billed)/100)
|
||||
from `tabSales Order`
|
||||
where customer=%s and docstatus = 1 and company=%s
|
||||
and per_billed < 100 and status != 'Stopped'""", (customer, company))
|
||||
and per_billed < 100 and status != 'Closed'""", (customer, company))
|
||||
|
||||
outstanding_based_on_so = flt(outstanding_based_on_so[0][0]) if outstanding_based_on_so else 0.0
|
||||
|
||||
@@ -210,7 +210,7 @@ def get_customer_outstanding(customer, company):
|
||||
where
|
||||
dn.name = dn_item.parent
|
||||
and dn.customer=%s and dn.company=%s
|
||||
and dn.docstatus = 1 and dn.status != 'Stopped'
|
||||
and dn.docstatus = 1 and dn.status not in ('Closed', 'Stopped')
|
||||
and ifnull(dn_item.against_sales_order, '') = ''
|
||||
and ifnull(dn_item.against_sales_invoice, '') = ''""", (customer, company), as_dict=True)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
cur_frm.add_custom_button(__('Lost'),
|
||||
cur_frm.cscript['Declare Order Lost'], __("Status"));
|
||||
}
|
||||
|
||||
|
||||
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
}
|
||||
|
||||
this.toggle_reqd_lead_customer();
|
||||
|
||||
|
||||
},
|
||||
|
||||
quotation_to: function() {
|
||||
@@ -96,7 +96,11 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
var me = this;
|
||||
frappe.call({
|
||||
method: "erpnext.crm.doctype.lead.lead.get_lead_details",
|
||||
args: { "lead": this.frm.doc.lead },
|
||||
args: {
|
||||
'lead': this.frm.doc.lead,
|
||||
'posting_date': this.frm.doc.transaction_date,
|
||||
'company': this.frm.doc.company,
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
me.frm.updating_party_details = true;
|
||||
@@ -166,6 +170,6 @@ frappe.ui.form.on("Quotation Item", "items_on_form_rendered", function(frm, cdt,
|
||||
|
||||
frappe.ui.form.on("Quotation Item", "stock_balance", function(frm, cdt, cdn) {
|
||||
var d = frappe.model.get_doc(cdt, cdn);
|
||||
frappe.route_options = {"item_code": d.item_code};
|
||||
frappe.route_options = {"item_code": d.item_code};
|
||||
frappe.set_route("query-report", "Stock Balance");
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3018,7 +3018,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-03-18 13:11:32.654873",
|
||||
"modified": "2016-03-21 13:11:32.654873",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-01-28 14:59:04.611174",
|
||||
"modified": "2016-04-01 08:26:55.705992",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Item-wise Sales History",
|
||||
@@ -16,4 +16,4 @@
|
||||
"ref_doctype": "Sales Order",
|
||||
"report_name": "Item-wise Sales History",
|
||||
"report_type": "Query Report"
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-10-06 12:43:48.259027",
|
||||
"modified": "2016-04-12 18:45:49.733159",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Pending SO Items For Purchase Request",
|
||||
"owner": "Administrator",
|
||||
"query": "select so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\",\n sum(so_item.qty) - sum(mr_item.qty) as \"Pending Qty:Float:100 \", \n so.company as \"Company:Link/Company:\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere \n so_item.`parent` = so.`name` \n and mr_item.parent = mr.name\n and mr_item.sales_order = so.name\n and mr_item.item_code = so_item.item_code\n and so.docstatus = 1 and so.status != \"Stopped\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\nhaving sum(so_item.qty) > sum(mr_item.qty)\norder by so.name desc, so_item.item_code asc",
|
||||
"query": "select so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\",\n sum(so_item.qty) - sum(mr_item.qty) as \"Pending Qty:Float:100 \", \n so.company as \"Company:Link/Company:\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere \n so_item.`parent` = so.`name` \n and mr_item.parent = mr.name\n and mr_item.sales_order = so.name\n and mr_item.item_code = so_item.item_code\n and so.docstatus = 1 and so.status != \"Closed\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\nhaving sum(so_item.qty) > sum(mr_item.qty)\norder by so.name desc, so_item.item_code asc",
|
||||
"ref_doctype": "Sales Order",
|
||||
"report_name": "Pending SO Items For Purchase Request",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<h3>{%= __("Next Steps") %}</h3>
|
||||
<ul class="list-unstyled">
|
||||
<li><a class="text-muted" href="#">{%= __("Go to the Desktop and start using ERPNext") %}</a></li>
|
||||
<li><a class="text-muted" href="#Module/Learn">{%= __("View a list of all the help videos") %}</a></li>
|
||||
<li><a class="text-muted" href="#modules/Learn">{%= __("View a list of all the help videos") %}</a></li>
|
||||
<li><a class="text-muted" href="https://manual.erpnext.com" target="_blank">{%= __("Read the ERPNext Manual") %}</a></li>
|
||||
<li><a class="text-muted" href="https://discuss.erpnext.com" target="_blank">{%= __("Community Forum") %}</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -426,7 +426,7 @@ def create_users(args):
|
||||
# create employee for self
|
||||
emp = frappe.get_doc({
|
||||
"doctype": "Employee",
|
||||
"full_name": " ".join(filter(None, [args.get("first_name"), args.get("last_name")])),
|
||||
"employee_name": " ".join(filter(None, [args.get("first_name"), args.get("last_name")])),
|
||||
"user_id": frappe.session.user,
|
||||
"status": "Active",
|
||||
"company": args.get("company_name")
|
||||
@@ -470,7 +470,7 @@ def create_users(args):
|
||||
# create employee
|
||||
emp = frappe.get_doc({
|
||||
"doctype": "Employee",
|
||||
"full_name": fullname,
|
||||
"employee_name": fullname,
|
||||
"user_id": email,
|
||||
"status": "Active",
|
||||
"company": args.get("company_name")
|
||||
|
||||
@@ -27,9 +27,8 @@ class StockEntry(StockController):
|
||||
return _("From {0} to {1}").format(self.from_warehouse, self.to_warehouse)
|
||||
|
||||
def onload(self):
|
||||
if self.docstatus==1:
|
||||
for item in self.get("items"):
|
||||
item.update(get_bin_details(item.item_code, item.s_warehouse))
|
||||
for item in self.get("items"):
|
||||
item.update(get_bin_details(item.item_code, item.s_warehouse))
|
||||
|
||||
def validate(self):
|
||||
self.pro_doc = None
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
{
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-08-20 15:08:10",
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.128918",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Items To Be Requested",
|
||||
"owner": "Administrator",
|
||||
"add_total_row": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-08-20 15:08:10",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2016-04-01 08:27:14.436178",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Items To Be Requested",
|
||||
"owner": "Administrator",
|
||||
"query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabItem.is_purchase_item = 1\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC",
|
||||
"ref_doctype": "Item",
|
||||
"report_name": "Items To Be Requested",
|
||||
"ref_doctype": "Item",
|
||||
"report_name": "Items To Be Requested",
|
||||
"report_type": "Query Report"
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-11-04 12:00:40.085130",
|
||||
"modified": "2016-04-01 08:27:03.318987",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Ordered Items To Be Delivered",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-11-04 12:01:22.108641",
|
||||
"modified": "2016-04-01 08:26:59.904034",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Purchase Order Items To Be Received",
|
||||
|
||||
@@ -94,7 +94,11 @@ class MaintenanceSchedule(TransactionBase):
|
||||
validated = False
|
||||
|
||||
employee = frappe.db.get_value("Sales Person", sales_person, "employee")
|
||||
holiday_list = get_holiday_list_for_employee(employee)
|
||||
if employee:
|
||||
holiday_list = get_holiday_list_for_employee(employee)
|
||||
else:
|
||||
holiday_list = frappe.db.get_value("Company", self.company, "default_holiday_list")
|
||||
|
||||
holidays = frappe.db.sql_list('''select holiday_date from `tabHoliday` where parent=%s''', holiday_list)
|
||||
|
||||
if not validated and holidays:
|
||||
|
||||
@@ -85,13 +85,18 @@ cur_frm.add_fetch('item_code', 'description', 'description');
|
||||
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
||||
if(doc.serial_no) {
|
||||
return{
|
||||
filters:{ 'serial_no': doc.serial_no}
|
||||
doctype: "Serial No",
|
||||
fields: "item_code",
|
||||
filters:{
|
||||
name: doc.serial_no
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
return{
|
||||
filters:[
|
||||
['Item', 'docstatus', '!=', 2]
|
||||
['Item', 'docstatus', '!=', 2],
|
||||
['Item', 'disabled', '=', 0]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user