Merge branch 'develop' of https://github.com/frappe/erpnext into develop
This commit is contained in:
commit
bc3e3458fa
8
.snyk
Normal file
8
.snyk
Normal file
@ -0,0 +1,8 @@
|
||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||
version: v1.14.0
|
||||
ignore: {}
|
||||
# patches apply the minimum changes required to fix a vulnerability
|
||||
patch:
|
||||
SNYK-JS-LODASH-450202:
|
||||
- cypress > getos > async > lodash:
|
||||
patched: '2020-01-31T01:35:12.802Z'
|
@ -30,7 +30,7 @@ def validate_service_stop_date(doc):
|
||||
frappe.throw(_("Service Stop Date cannot be after Service End Date"))
|
||||
|
||||
if old_stop_dates and old_stop_dates.get(item.name) and item.service_stop_date!=old_stop_dates.get(item.name):
|
||||
frappe.throw(_("Cannot change Service Stop Date for item in row {0}".format(item.idx)))
|
||||
frappe.throw(_("Cannot change Service Stop Date for item in row {0}").format(item.idx))
|
||||
|
||||
def convert_deferred_expense_to_expense(start_date=None, end_date=None):
|
||||
# book the expense/income on the last day, but it will be trigger on the 1st of month at 12:00 AM
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"creation": "2017-05-29 21:35:13.136357",
|
||||
@ -82,7 +83,7 @@
|
||||
"default": "0",
|
||||
"fieldname": "is_default",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is the Default Account"
|
||||
"label": "Is Default Account"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
@ -211,7 +212,8 @@
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"modified": "2019-10-02 01:34:12.417601",
|
||||
"links": [],
|
||||
"modified": "2020-01-29 20:42:26.458316",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Bank Account",
|
||||
|
@ -31,7 +31,7 @@ class TestBankAccount(unittest.TestCase):
|
||||
try:
|
||||
bank_account.validate_iban()
|
||||
except AttributeError:
|
||||
msg = _('BankAccount.validate_iban() failed for empty IBAN')
|
||||
msg = 'BankAccount.validate_iban() failed for empty IBAN'
|
||||
self.fail(msg=msg)
|
||||
|
||||
for iban in valid_ibans:
|
||||
@ -39,11 +39,11 @@ class TestBankAccount(unittest.TestCase):
|
||||
try:
|
||||
bank_account.validate_iban()
|
||||
except ValidationError:
|
||||
msg = _('BankAccount.validate_iban() failed for valid IBAN {}'.format(iban))
|
||||
msg = 'BankAccount.validate_iban() failed for valid IBAN {}'.format(iban)
|
||||
self.fail(msg=msg)
|
||||
|
||||
for not_iban in invalid_ibans:
|
||||
bank_account.iban = not_iban
|
||||
msg = _('BankAccount.validate_iban() accepted invalid IBAN {}'.format(not_iban))
|
||||
msg = 'BankAccount.validate_iban() accepted invalid IBAN {}'.format(not_iban)
|
||||
with self.assertRaises(ValidationError, msg=msg):
|
||||
bank_account.validate_iban()
|
||||
|
@ -314,7 +314,7 @@ class BankStatementTransactionEntry(Document):
|
||||
try:
|
||||
reconcile_against_document(lst)
|
||||
except:
|
||||
frappe.throw(_("Exception occurred while reconciling {0}".format(payment.reference_name)))
|
||||
frappe.throw(_("Exception occurred while reconciling {0}").format(payment.reference_name))
|
||||
|
||||
def submit_payment_entries(self):
|
||||
for payment in self.new_transaction_items:
|
||||
|
@ -49,7 +49,7 @@ class BankTransaction(StatusUpdater):
|
||||
|
||||
if paid_amount and allocated_amount:
|
||||
if flt(allocated_amount[0]["allocated_amount"]) > flt(paid_amount):
|
||||
frappe.throw(_("The total allocated amount ({0}) is greated than the paid amount ({1}).".format(flt(allocated_amount[0]["allocated_amount"]), flt(paid_amount))))
|
||||
frappe.throw(_("The total allocated amount ({0}) is greated than the paid amount ({1}).").format(flt(allocated_amount[0]["allocated_amount"]), flt(paid_amount)))
|
||||
else:
|
||||
if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]:
|
||||
self.clear_simple_entry(payment_entry)
|
||||
|
@ -18,7 +18,7 @@ class CForm(Document):
|
||||
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
|
||||
|
||||
if inv and inv[0][0] != 'Yes':
|
||||
frappe.throw(_("C-form is not applicable for Invoice: {0}".format(d.invoice_no)))
|
||||
frappe.throw(_("C-form is not applicable for Invoice: {0}").format(d.invoice_no))
|
||||
|
||||
elif inv and inv[0][1] and inv[0][1] != self.name:
|
||||
frappe.throw(_("""Invoice {0} is tagged in another C-form: {1}.
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_copy": 1,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
@ -123,7 +124,8 @@
|
||||
],
|
||||
"icon": "fa fa-money",
|
||||
"idx": 1,
|
||||
"modified": "2019-09-16 14:44:17.103548",
|
||||
"links": [],
|
||||
"modified": "2020-01-28 13:50:23.430434",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Cost Center",
|
||||
@ -162,7 +164,6 @@
|
||||
"role": "Purchase User"
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"search_fields": "parent_cost_center, is_group",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
|
@ -616,7 +616,7 @@ class JournalEntry(AccountsController):
|
||||
d.reference_name, ("total_sanctioned_amount", "total_amount_reimbursed"))
|
||||
pending_amount = flt(sanctioned_amount) - flt(reimbursed_amount)
|
||||
if d.debit > pending_amount:
|
||||
frappe.throw(_("Row No {0}: Amount cannot be greater than Pending Amount against Expense Claim {1}. Pending Amount is {2}".format(d.idx, d.reference_name, pending_amount)))
|
||||
frappe.throw(_("Row No {0}: Amount cannot be greater than Pending Amount against Expense Claim {1}. Pending Amount is {2}").format(d.idx, d.reference_name, pending_amount))
|
||||
|
||||
def validate_credit_debit_note(self):
|
||||
if self.stock_entry:
|
||||
@ -624,7 +624,7 @@ class JournalEntry(AccountsController):
|
||||
frappe.throw(_("Stock Entry {0} is not submitted").format(self.stock_entry))
|
||||
|
||||
if frappe.db.exists({"doctype": "Journal Entry", "stock_entry": self.stock_entry, "docstatus":1}):
|
||||
frappe.msgprint(_("Warning: Another {0} # {1} exists against stock entry {2}".format(self.voucher_type, self.name, self.stock_entry)))
|
||||
frappe.msgprint(_("Warning: Another {0} # {1} exists against stock entry {2}").format(self.voucher_type, self.name, self.stock_entry))
|
||||
|
||||
def validate_empty_accounts_table(self):
|
||||
if not self.get('accounts'):
|
||||
|
@ -102,7 +102,9 @@ class PaymentEntry(AccountsController):
|
||||
|
||||
self.bank = bank_data.bank
|
||||
self.bank_account_no = bank_data.bank_account_no
|
||||
self.set(field, bank_data.account)
|
||||
|
||||
if not self.get(field):
|
||||
self.set(field, bank_data.account)
|
||||
|
||||
def validate_allocated_amount(self):
|
||||
for d in self.get("references"):
|
||||
@ -1003,7 +1005,7 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
||||
|
||||
# only Purchase Invoice can be blocked individually
|
||||
if doc.doctype == "Purchase Invoice" and doc.invoice_is_blocked():
|
||||
frappe.msgprint(_('{0} is on hold till {1}'.format(doc.name, doc.release_date)))
|
||||
frappe.msgprint(_('{0} is on hold till {1}').format(doc.name, doc.release_date))
|
||||
else:
|
||||
pe.append("references", {
|
||||
'reference_doctype': dt,
|
||||
|
@ -39,8 +39,8 @@ class PaymentRequest(Document):
|
||||
ref_amount = get_amount(ref_doc)
|
||||
|
||||
if existing_payment_request_amount + flt(self.grand_total)> ref_amount:
|
||||
frappe.throw(_("Total Payment Request amount cannot be greater than {0} amount"
|
||||
.format(self.reference_doctype)))
|
||||
frappe.throw(_("Total Payment Request amount cannot be greater than {0} amount")
|
||||
.format(self.reference_doctype))
|
||||
|
||||
def validate_currency(self):
|
||||
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
||||
@ -53,14 +53,14 @@ class PaymentRequest(Document):
|
||||
for subscription_plan in self.subscription_plans:
|
||||
payment_gateway = frappe.db.get_value("Subscription Plan", subscription_plan.plan, "payment_gateway")
|
||||
if payment_gateway != self.payment_gateway_account:
|
||||
frappe.throw(_('The payment gateway account in plan {0} is different from the payment gateway account in this payment request'.format(subscription_plan.name)))
|
||||
frappe.throw(_('The payment gateway account in plan {0} is different from the payment gateway account in this payment request').format(subscription_plan.name))
|
||||
|
||||
rate = get_plan_rate(subscription_plan.plan, quantity=subscription_plan.qty)
|
||||
|
||||
amount += rate
|
||||
|
||||
if amount != self.grand_total:
|
||||
frappe.msgprint(_("The amount of {0} set in this payment request is different from the calculated amount of all payment plans: {1}. Make sure this is correct before submitting the document.".format(self.grand_total, amount)))
|
||||
frappe.msgprint(_("The amount of {0} set in this payment request is different from the calculated amount of all payment plans: {1}. Make sure this is correct before submitting the document.").format(self.grand_total, amount))
|
||||
|
||||
def on_submit(self):
|
||||
if self.payment_request_type == 'Outward':
|
||||
|
@ -3,6 +3,7 @@
|
||||
"autoname": "Prompt",
|
||||
"creation": "2013-05-24 12:15:51",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"disabled",
|
||||
"section_break_2",
|
||||
@ -50,6 +51,7 @@
|
||||
"income_account",
|
||||
"expense_account",
|
||||
"taxes_and_charges",
|
||||
"tax_category",
|
||||
"apply_discount_on",
|
||||
"accounting_dimensions_section",
|
||||
"cost_center",
|
||||
@ -381,11 +383,17 @@
|
||||
{
|
||||
"fieldname": "dimension_col_break",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "tax_category",
|
||||
"fieldtype": "Link",
|
||||
"label": "Tax Category",
|
||||
"options": "Tax Category"
|
||||
}
|
||||
],
|
||||
"icon": "icon-cog",
|
||||
"idx": 1,
|
||||
"modified": "2019-05-25 22:56:30.352693",
|
||||
"modified": "2020-01-24 15:52:03.797701",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Profile",
|
||||
|
@ -56,12 +56,12 @@ class PricingRule(Document):
|
||||
|
||||
if not self.selling and self.applicable_for in ["Customer", "Customer Group",
|
||||
"Territory", "Sales Partner", "Campaign"]:
|
||||
throw(_("Selling must be checked, if Applicable For is selected as {0}"
|
||||
.format(self.applicable_for)))
|
||||
throw(_("Selling must be checked, if Applicable For is selected as {0}")
|
||||
.format(self.applicable_for))
|
||||
|
||||
if not self.buying and self.applicable_for in ["Supplier", "Supplier Group"]:
|
||||
throw(_("Buying must be checked, if Applicable For is selected as {0}"
|
||||
.format(self.applicable_for)))
|
||||
throw(_("Buying must be checked, if Applicable For is selected as {0}")
|
||||
.format(self.applicable_for))
|
||||
|
||||
def validate_min_max_qty(self):
|
||||
if self.min_qty and self.max_qty and flt(self.min_qty) > flt(self.max_qty):
|
||||
@ -243,7 +243,7 @@ def get_pricing_rule_for_item(args, price_list_rate=0, doc=None, for_validate=Fa
|
||||
|
||||
if pricing_rule.coupon_code_based==1 and args.coupon_code==None:
|
||||
return item_details
|
||||
|
||||
|
||||
if not pricing_rule.validate_applied_rule:
|
||||
if pricing_rule.price_or_product_discount == "Price":
|
||||
apply_price_discount_rule(pricing_rule, item_details, args)
|
||||
|
@ -9,6 +9,8 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde
|
||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
|
||||
from erpnext.stock.get_item_details import get_item_details
|
||||
from frappe import MandatoryError
|
||||
from erpnext.stock.doctype.item.test_item import make_item
|
||||
from erpnext.healthcare.doctype.lab_test_template.lab_test_template import make_item_price
|
||||
|
||||
class TestPricingRule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@ -145,6 +147,52 @@ class TestPricingRule(unittest.TestCase):
|
||||
self.assertEquals(details.get("margin_type"), "Percentage")
|
||||
self.assertEquals(details.get("margin_rate_or_amount"), 10)
|
||||
|
||||
def test_mixed_conditions_for_item_group(self):
|
||||
for item in ["Mixed Cond Item 1", "Mixed Cond Item 2"]:
|
||||
make_item(item, {"item_group": "Products"})
|
||||
make_item_price(item, "_Test Price List", 100)
|
||||
|
||||
test_record = {
|
||||
"doctype": "Pricing Rule",
|
||||
"title": "_Test Pricing Rule for Item Group",
|
||||
"apply_on": "Item Group",
|
||||
"item_groups": [
|
||||
{
|
||||
"item_group": "Products",
|
||||
},
|
||||
{
|
||||
"item_group": "Seed",
|
||||
},
|
||||
],
|
||||
"selling": 1,
|
||||
"mixed_conditions": 1,
|
||||
"currency": "USD",
|
||||
"rate_or_discount": "Discount Percentage",
|
||||
"discount_percentage": 10,
|
||||
"applicable_for": "Customer Group",
|
||||
"customer_group": "All Customer Groups",
|
||||
"company": "_Test Company"
|
||||
}
|
||||
frappe.get_doc(test_record.copy()).insert()
|
||||
|
||||
args = frappe._dict({
|
||||
"item_code": "Mixed Cond Item 1",
|
||||
"item_group": "Products",
|
||||
"company": "_Test Company",
|
||||
"price_list": "_Test Price List",
|
||||
"currency": "_Test Currency",
|
||||
"doctype": "Sales Order",
|
||||
"conversion_rate": 1,
|
||||
"price_list_currency": "_Test Currency",
|
||||
"plc_conversion_rate": 1,
|
||||
"order_type": "Sales",
|
||||
"customer": "_Test Customer",
|
||||
"customer_group": "_Test Customer Group",
|
||||
"name": None
|
||||
})
|
||||
details = get_item_details(args)
|
||||
self.assertEquals(details.get("discount_percentage"), 10)
|
||||
|
||||
def test_pricing_rule_for_variants(self):
|
||||
from erpnext.stock.get_item_details import get_item_details
|
||||
from frappe import MandatoryError
|
||||
|
@ -489,7 +489,7 @@ def get_pricing_rule_items(pr_doc):
|
||||
|
||||
for d in pr_doc.get(pricing_rule_apply_on):
|
||||
if apply_on == 'item_group':
|
||||
get_child_item_groups(d.get(apply_on))
|
||||
apply_on_data.extend(get_child_item_groups(d.get(apply_on)))
|
||||
else:
|
||||
apply_on_data.append(d.get(apply_on))
|
||||
|
||||
|
@ -908,7 +908,7 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
if pi:
|
||||
pi = pi[0][0]
|
||||
frappe.throw(_("Supplier Invoice No exists in Purchase Invoice {0}".format(pi)))
|
||||
frappe.throw(_("Supplier Invoice No exists in Purchase Invoice {0}").format(pi))
|
||||
|
||||
def update_billing_status_in_pr(self, update_modified=True):
|
||||
updated_pr = []
|
||||
|
@ -25,7 +25,7 @@ frappe.ui.form.on("Sales Invoice", {
|
||||
if(frm.doc.docstatus == 1 && !frm.is_dirty()
|
||||
&& !frm.doc.is_return && !frm.doc.ewaybill) {
|
||||
|
||||
frm.add_custom_button('e-Way Bill JSON', () => {
|
||||
frm.add_custom_button('E-Way Bill JSON', () => {
|
||||
var w = window.open(
|
||||
frappe.urllib.get_full_url(
|
||||
"/api/method/erpnext.regional.india.utils.generate_ewb_json?"
|
||||
@ -36,7 +36,7 @@ frappe.ui.form.on("Sales Invoice", {
|
||||
if (!w) {
|
||||
frappe.msgprint(__("Please enable pop-ups")); return;
|
||||
}
|
||||
}, __("Make"));
|
||||
}, __("Create"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ frappe.listview_settings['Sales Invoice'].onload = function (doclist) {
|
||||
|
||||
for (let doc of selected_docs) {
|
||||
if (doc.docstatus !== 1) {
|
||||
frappe.throw(__("e-Way Bill JSON can only be generated from a submitted document"));
|
||||
frappe.throw(__("E-Way Bill JSON can only be generated from a submitted document"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,5 +29,5 @@ frappe.listview_settings['Sales Invoice'].onload = function (doclist) {
|
||||
|
||||
};
|
||||
|
||||
doclist.page.add_actions_menu_item(__('Generate e-Way Bill JSON'), action, false);
|
||||
doclist.page.add_actions_menu_item(__('Generate E-Way Bill JSON'), action, false);
|
||||
};
|
@ -225,7 +225,7 @@ class SalesInvoice(SellingController):
|
||||
total_amount_in_payments += payment.amount
|
||||
invoice_total = self.rounded_total or self.grand_total
|
||||
if total_amount_in_payments < invoice_total:
|
||||
frappe.throw(_("Total payments amount can't be greater than {}".format(-invoice_total)))
|
||||
frappe.throw(_("Total payments amount can't be greater than {}").format(-invoice_total))
|
||||
|
||||
def validate_pos_paid_amount(self):
|
||||
if len(self.payments) == 0 and self.is_pos:
|
||||
@ -420,6 +420,9 @@ class SalesInvoice(SellingController):
|
||||
|
||||
if pos:
|
||||
self.allow_print_before_pay = pos.allow_print_before_pay
|
||||
|
||||
if not for_validate:
|
||||
self.tax_category = pos.get("tax_category")
|
||||
|
||||
if not for_validate and not self.customer:
|
||||
self.customer = pos.customer
|
||||
@ -1041,11 +1044,11 @@ class SalesInvoice(SellingController):
|
||||
si_serial_nos = set(get_serial_nos(serial_nos))
|
||||
|
||||
if si_serial_nos - dn_serial_nos:
|
||||
frappe.throw(_("Serial Numbers in row {0} does not match with Delivery Note".format(item.idx)))
|
||||
frappe.throw(_("Serial Numbers in row {0} does not match with Delivery Note").format(item.idx))
|
||||
|
||||
if item.serial_no and cint(item.qty) != len(si_serial_nos):
|
||||
frappe.throw(_("Row {0}: {1} Serial numbers required for Item {2}. You have provided {3}.".format(
|
||||
item.idx, item.qty, item.item_code, len(si_serial_nos))))
|
||||
frappe.throw(_("Row {0}: {1} Serial numbers required for Item {2}. You have provided {3}.").format(
|
||||
item.idx, item.qty, item.item_code, len(si_serial_nos)))
|
||||
|
||||
def validate_serial_against_sales_invoice(self):
|
||||
""" check if serial number is already used in other sales invoice """
|
||||
@ -1064,8 +1067,8 @@ class SalesInvoice(SellingController):
|
||||
and self.name != serial_no_details.sales_invoice:
|
||||
sales_invoice_company = frappe.db.get_value("Sales Invoice", serial_no_details.sales_invoice, "company")
|
||||
if sales_invoice_company == self.company:
|
||||
frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}"
|
||||
.format(serial_no, serial_no_details.sales_invoice)))
|
||||
frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}")
|
||||
.format(serial_no, serial_no_details.sales_invoice))
|
||||
|
||||
def update_project(self):
|
||||
if self.project:
|
||||
|
@ -82,7 +82,7 @@ class ShippingRule(Document):
|
||||
if not shipping_country:
|
||||
frappe.throw(_('Shipping Address does not have country, which is required for this Shipping Rule'))
|
||||
if shipping_country not in [d.country for d in self.countries]:
|
||||
frappe.throw(_('Shipping rule not applicable for country {0}'.format(shipping_country)))
|
||||
frappe.throw(_('Shipping rule not applicable for country {0}').format(shipping_country))
|
||||
|
||||
def add_shipping_rule_to_tax_table(self, doc, shipping_amount):
|
||||
shipping_charge = {
|
||||
|
@ -195,7 +195,7 @@ class Subscription(Document):
|
||||
doc = frappe.get_doc('Sales Invoice', current.invoice)
|
||||
return doc
|
||||
else:
|
||||
frappe.throw(_('Invoice {0} no longer exists'.format(current.invoice)))
|
||||
frappe.throw(_('Invoice {0} no longer exists').format(current.invoice))
|
||||
|
||||
def is_new_subscription(self):
|
||||
"""
|
||||
@ -338,7 +338,7 @@ class Subscription(Document):
|
||||
|
||||
# Check invoice dates and make sure it doesn't have outstanding invoices
|
||||
return getdate(nowdate()) >= getdate(self.current_invoice_start) and not self.has_outstanding_invoice()
|
||||
|
||||
|
||||
def is_current_invoice_paid(self):
|
||||
if self.is_new_subscription():
|
||||
return False
|
||||
@ -346,7 +346,7 @@ class Subscription(Document):
|
||||
last_invoice = frappe.get_doc('Sales Invoice', self.invoices[-1].invoice)
|
||||
if getdate(last_invoice.posting_date) == getdate(self.current_invoice_start) and last_invoice.status == 'Paid':
|
||||
return True
|
||||
|
||||
|
||||
return False
|
||||
|
||||
def process_for_active(self):
|
||||
@ -388,7 +388,7 @@ class Subscription(Document):
|
||||
"""
|
||||
current_invoice = self.get_current_invoice()
|
||||
if not current_invoice:
|
||||
frappe.throw(_('Current invoice {0} is missing'.format(current_invoice.invoice)))
|
||||
frappe.throw(_('Current invoice {0} is missing').format(current_invoice.invoice))
|
||||
else:
|
||||
if self.is_not_outstanding(current_invoice):
|
||||
self.status = 'Active'
|
||||
|
@ -95,7 +95,7 @@ class TaxRule(Document):
|
||||
|
||||
if tax_rule:
|
||||
if tax_rule[0].priority == self.priority:
|
||||
frappe.throw(_("Tax Rule Conflicts with {0}".format(tax_rule[0].name)), ConflictingTaxRule)
|
||||
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'''
|
||||
|
@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cint
|
||||
from frappe.utils import cint, cstr
|
||||
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
|
||||
from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import get_net_profit_loss
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
@ -129,13 +129,13 @@ def get_account_type_based_gl_data(company, start_date, end_date, account_type,
|
||||
cond = ""
|
||||
filters = frappe._dict(filters)
|
||||
|
||||
if filters.finance_book:
|
||||
cond = " AND (finance_book in (%s, '') OR finance_book IS NULL)" %(frappe.db.escape(filters.finance_book))
|
||||
if filters.include_default_book_entries:
|
||||
company_fb = frappe.db.get_value("Company", company, 'default_finance_book')
|
||||
if filters.include_default_book_entries:
|
||||
company_fb = frappe.db.get_value("Company", company, 'default_finance_book')
|
||||
cond = """ AND (finance_book in (%s, %s, '') OR finance_book IS NULL)
|
||||
""" %(frappe.db.escape(filters.finance_book), frappe.db.escape(company_fb))
|
||||
else:
|
||||
cond = " AND (finance_book in (%s, '') OR finance_book IS NULL)" %(frappe.db.escape(cstr(filters.finance_book)))
|
||||
|
||||
cond = """ AND (finance_book in (%s, %s, '') OR finance_book IS NULL)
|
||||
""" %(frappe.db.escape(filters.finance_book), frappe.db.escape(company_fb))
|
||||
|
||||
gl_sum = frappe.db.sql_list("""
|
||||
select sum(credit) - sum(debit)
|
||||
|
@ -387,11 +387,10 @@ def get_additional_conditions(from_date, ignore_closing_entries, filters):
|
||||
if from_date:
|
||||
additional_conditions.append("gl.posting_date >= %(from_date)s")
|
||||
|
||||
if filters.get("finance_book"):
|
||||
if filters.get("include_default_book_entries"):
|
||||
additional_conditions.append("(finance_book in (%(finance_book)s, %(company_fb)s, '') OR finance_book IS NULL)")
|
||||
else:
|
||||
additional_conditions.append("(finance_book in (%(finance_book)s, '') OR finance_book IS NULL)")
|
||||
if filters.get("include_default_book_entries"):
|
||||
additional_conditions.append("(finance_book in (%(finance_book)s, %(company_fb)s, '') OR finance_book IS NULL)")
|
||||
else:
|
||||
additional_conditions.append("(finance_book in (%(finance_book)s, '') OR finance_book IS NULL)")
|
||||
|
||||
return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
|
||||
|
||||
|
@ -13,7 +13,7 @@ import frappe, erpnext
|
||||
from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from frappe import _
|
||||
from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, formatdate)
|
||||
from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, formatdate, cstr)
|
||||
|
||||
from six import itervalues
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
||||
@ -175,7 +175,7 @@ def calculate_values(
|
||||
d = accounts_by_name.get(entry.account)
|
||||
if not d:
|
||||
frappe.msgprint(
|
||||
_("Could not retrieve information for {0}.".format(entry.account)), title="Error",
|
||||
_("Could not retrieve information for {0}.").format(entry.account), title="Error",
|
||||
raise_exception=1
|
||||
)
|
||||
for period in period_list:
|
||||
@ -348,40 +348,42 @@ def set_gl_entries_by_account(
|
||||
additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters)
|
||||
|
||||
accounts = frappe.db.sql_list("""select name from `tabAccount`
|
||||
where lft >= %s and rgt <= %s""", (root_lft, root_rgt))
|
||||
additional_conditions += " and account in ({})"\
|
||||
.format(", ".join([frappe.db.escape(d) for d in accounts]))
|
||||
where lft >= %s and rgt <= %s and company = %s""", (root_lft, root_rgt, company))
|
||||
|
||||
gl_filters = {
|
||||
"company": company,
|
||||
"from_date": from_date,
|
||||
"to_date": to_date,
|
||||
"finance_book": filters.get("finance_book")
|
||||
}
|
||||
if accounts:
|
||||
additional_conditions += " and account in ({})"\
|
||||
.format(", ".join([frappe.db.escape(d) for d in accounts]))
|
||||
|
||||
if filters.get("include_default_book_entries"):
|
||||
gl_filters["company_fb"] = frappe.db.get_value("Company",
|
||||
company, 'default_finance_book')
|
||||
gl_filters = {
|
||||
"company": company,
|
||||
"from_date": from_date,
|
||||
"to_date": to_date,
|
||||
"finance_book": cstr(filters.get("finance_book"))
|
||||
}
|
||||
|
||||
for key, value in filters.items():
|
||||
if value:
|
||||
gl_filters.update({
|
||||
key: value
|
||||
})
|
||||
if filters.get("include_default_book_entries"):
|
||||
gl_filters["company_fb"] = frappe.db.get_value("Company",
|
||||
company, 'default_finance_book')
|
||||
|
||||
gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening, fiscal_year, debit_in_account_currency, credit_in_account_currency, account_currency from `tabGL Entry`
|
||||
where company=%(company)s
|
||||
{additional_conditions}
|
||||
and posting_date <= %(to_date)s
|
||||
order by account, posting_date""".format(additional_conditions=additional_conditions), gl_filters, as_dict=True) #nosec
|
||||
for key, value in filters.items():
|
||||
if value:
|
||||
gl_filters.update({
|
||||
key: value
|
||||
})
|
||||
|
||||
if filters and filters.get('presentation_currency'):
|
||||
convert_to_presentation_currency(gl_entries, get_currency(filters))
|
||||
gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening, fiscal_year, debit_in_account_currency, credit_in_account_currency, account_currency from `tabGL Entry`
|
||||
where company=%(company)s
|
||||
{additional_conditions}
|
||||
and posting_date <= %(to_date)s
|
||||
order by account, posting_date""".format(additional_conditions=additional_conditions), gl_filters, as_dict=True) #nosec
|
||||
|
||||
for entry in gl_entries:
|
||||
gl_entries_by_account.setdefault(entry.account, []).append(entry)
|
||||
if filters and filters.get('presentation_currency'):
|
||||
convert_to_presentation_currency(gl_entries, get_currency(filters))
|
||||
|
||||
return gl_entries_by_account
|
||||
for entry in gl_entries:
|
||||
gl_entries_by_account.setdefault(entry.account, []).append(entry)
|
||||
|
||||
return gl_entries_by_account
|
||||
|
||||
|
||||
def get_additional_conditions(from_date, ignore_closing_entries, filters):
|
||||
@ -406,12 +408,11 @@ def get_additional_conditions(from_date, ignore_closing_entries, filters):
|
||||
filters.cost_center = get_cost_centers_with_children(filters.cost_center)
|
||||
additional_conditions.append("cost_center in %(cost_center)s")
|
||||
|
||||
if filters.get("finance_book"):
|
||||
if filters.get("include_default_book_entries"):
|
||||
additional_conditions.append("(finance_book in (%(finance_book)s, %(company_fb)s, '') OR finance_book IS NULL)")
|
||||
else:
|
||||
additional_conditions.append("(finance_book in (%(finance_book)s, '') OR finance_book IS NULL)")
|
||||
|
||||
if filters.get("include_default_book_entries"):
|
||||
additional_conditions.append("(finance_book in (%(finance_book)s, %(company_fb)s, '') OR finance_book IS NULL)")
|
||||
else:
|
||||
additional_conditions.append("(finance_book in (%(finance_book)s, '') OR finance_book IS NULL)")
|
||||
|
||||
if accounting_dimensions:
|
||||
for dimension in accounting_dimensions:
|
||||
if filters.get(dimension):
|
||||
@ -430,7 +431,7 @@ def get_cost_centers_with_children(cost_centers):
|
||||
children = frappe.get_all("Cost Center", filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
|
||||
all_cost_centers += [c.name for c in children]
|
||||
else:
|
||||
frappe.throw(_("Cost Center: {0} does not exist".format(d)))
|
||||
frappe.throw(_("Cost Center: {0} does not exist").format(d))
|
||||
|
||||
return list(set(all_cost_centers))
|
||||
|
||||
|
@ -373,19 +373,19 @@ def get_columns(filters):
|
||||
"width": 180
|
||||
},
|
||||
{
|
||||
"label": _("Debit ({0})".format(currency)),
|
||||
"label": _("Debit ({0})").format(currency),
|
||||
"fieldname": "debit",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Credit ({0})".format(currency)),
|
||||
"label": _("Credit ({0})").format(currency),
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Balance ({0})".format(currency)),
|
||||
"label": _("Balance ({0})").format(currency),
|
||||
"fieldname": "balance",
|
||||
"fieldtype": "Float",
|
||||
"width": 130
|
||||
|
@ -34,6 +34,20 @@ frappe.query_reports["Item-wise Purchase Register"] = {
|
||||
"label": __("Mode of Payment"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Mode of Payment"
|
||||
},
|
||||
{
|
||||
"label": __("Group By"),
|
||||
"fieldname": "group_by",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Supplier", "Item Group", "Item", "Invoice"]
|
||||
}
|
||||
]
|
||||
],
|
||||
"formatter": function(value, row, column, data, default_formatter) {
|
||||
value = default_formatter(value, row, column, data);
|
||||
if (data && data.bold) {
|
||||
value = value.bold();
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register import get_tax_accounts
|
||||
from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register import (get_tax_accounts,
|
||||
get_grand_total, add_total_row, get_display_value, get_group_by_and_display_fields, add_sub_total_row,
|
||||
get_group_by_conditions)
|
||||
|
||||
def execute(filters=None):
|
||||
return _execute(filters)
|
||||
@ -13,7 +15,7 @@ def execute(filters=None):
|
||||
def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
|
||||
if not filters: filters = {}
|
||||
filters.update({"from_date": filters.get("date_range")[0], "to_date": filters.get("date_range")[1]})
|
||||
columns = get_columns(additional_table_columns)
|
||||
columns = get_columns(additional_table_columns, filters)
|
||||
|
||||
company_currency = erpnext.get_company_currency(filters.company)
|
||||
|
||||
@ -23,16 +25,16 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency,
|
||||
doctype="Purchase Invoice", tax_doctype="Purchase Taxes and Charges")
|
||||
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 80
|
||||
})
|
||||
|
||||
po_pr_map = get_purchase_receipts_against_purchase_order(item_list)
|
||||
|
||||
data = []
|
||||
total_row_map = {}
|
||||
skip_total_row = 0
|
||||
prev_group_by_value = ''
|
||||
|
||||
if filters.get('group_by'):
|
||||
grand_total = get_grand_total(filters, 'Purchase Invoice')
|
||||
|
||||
for d in item_list:
|
||||
if not d.stock_qty:
|
||||
continue
|
||||
@ -44,51 +46,243 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
purchase_receipt = ", ".join(po_pr_map.get(d.po_detail, []))
|
||||
|
||||
expense_account = d.expense_account or aii_account_map.get(d.company)
|
||||
row = [d.item_code, d.item_name, d.item_group, d.description, d.parent, d.posting_date, d.supplier,
|
||||
d.supplier_name]
|
||||
|
||||
row = {
|
||||
'item_code': d.item_code,
|
||||
'item_name': d.item_name,
|
||||
'item_group': d.item_group,
|
||||
'description': d.description,
|
||||
'invoice': d.parent,
|
||||
'posting_date': d.posting_date,
|
||||
'customer': d.supplier,
|
||||
'customer_name': d.supplier_name
|
||||
}
|
||||
|
||||
if additional_query_columns:
|
||||
for col in additional_query_columns:
|
||||
row.append(d.get(col))
|
||||
row.update({
|
||||
col: d.get(col)
|
||||
})
|
||||
|
||||
row += [
|
||||
d.credit_to, d.mode_of_payment, d.project, d.company, d.purchase_order,
|
||||
purchase_receipt, expense_account, d.stock_qty, d.stock_uom, d.base_net_amount / d.stock_qty, d.base_net_amount
|
||||
]
|
||||
row.update({
|
||||
'credit_to': d.credit_to,
|
||||
'mode_of_payment': d.mode_of_payment,
|
||||
'project': d.project,
|
||||
'company': d.company,
|
||||
'purchase_order': d.purchase_order,
|
||||
'purchase_receipt': d.purchase_receipt,
|
||||
'expense_account': expense_account,
|
||||
'stock_qty': d.stock_qty,
|
||||
'stock_uom': d.stock_uom,
|
||||
'rate': d.base_net_amount / d.stock_qty,
|
||||
'amount': d.base_net_amount
|
||||
})
|
||||
|
||||
total_tax = 0
|
||||
for tax in tax_columns:
|
||||
item_tax = itemised_tax.get(d.name, {}).get(tax, {})
|
||||
row += [item_tax.get("tax_rate", 0), item_tax.get("tax_amount", 0)]
|
||||
row.update({
|
||||
frappe.scrub(tax + ' Rate'): item_tax.get("tax_rate", 0),
|
||||
frappe.scrub(tax + ' Amount'): item_tax.get("tax_amount", 0),
|
||||
})
|
||||
total_tax += flt(item_tax.get("tax_amount"))
|
||||
|
||||
row += [total_tax, d.base_net_amount + total_tax, company_currency]
|
||||
row.update({
|
||||
'total_tax': total_tax,
|
||||
'total': d.base_net_amount + total_tax,
|
||||
'currency': company_currency
|
||||
})
|
||||
|
||||
if filters.get('group_by'):
|
||||
row.update({'percent_gt': flt(row['total']/grand_total) * 100})
|
||||
group_by_field, subtotal_display_field = get_group_by_and_display_fields(filters)
|
||||
data, prev_group_by_value = add_total_row(data, filters, prev_group_by_value, d, total_row_map,
|
||||
group_by_field, subtotal_display_field, grand_total, tax_columns)
|
||||
add_sub_total_row(row, total_row_map, d.get(group_by_field, ''), tax_columns)
|
||||
|
||||
data.append(row)
|
||||
|
||||
return columns, data
|
||||
if filters.get('group_by'):
|
||||
total_row = total_row_map.get(prev_group_by_value or d.get('item_name'))
|
||||
total_row['percent_gt'] = flt(total_row['total']/grand_total * 100)
|
||||
data.append(total_row)
|
||||
data.append({})
|
||||
add_sub_total_row(total_row, total_row_map, 'total_row', tax_columns)
|
||||
data.append(total_row_map.get('total_row'))
|
||||
skip_total_row = 1
|
||||
|
||||
return columns, data, None, None, None, skip_total_row
|
||||
|
||||
|
||||
def get_columns(additional_table_columns):
|
||||
columns = [
|
||||
_("Item Code") + ":Link/Item:120", _("Item Name") + "::120",
|
||||
_("Item Group") + ":Link/Item Group:100", "Description::150", _("Invoice") + ":Link/Purchase Invoice:120",
|
||||
_("Posting Date") + ":Date:80", _("Supplier") + ":Link/Supplier:120",
|
||||
"Supplier Name::120"
|
||||
]
|
||||
def get_columns(additional_table_columns, filters):
|
||||
|
||||
columns = []
|
||||
|
||||
if filters.get('group_by') != ('Item'):
|
||||
columns.extend(
|
||||
[
|
||||
{
|
||||
'label': _('Item Code'),
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'width': 120
|
||||
},
|
||||
{
|
||||
'label': _('Item Name'),
|
||||
'fieldname': 'item_name',
|
||||
'fieldtype': 'Data',
|
||||
'width': 120
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
if filters.get('group_by') not in ('Item', 'Item Group'):
|
||||
columns.extend([
|
||||
{
|
||||
'label': _('Item Group'),
|
||||
'fieldname': 'item_group',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Item Group',
|
||||
'width': 120
|
||||
}
|
||||
])
|
||||
|
||||
columns.extend([
|
||||
{
|
||||
'label': _('Description'),
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Data',
|
||||
'width': 150
|
||||
},
|
||||
{
|
||||
'label': _('Invoice'),
|
||||
'fieldname': 'invoice',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Purchase Invoice',
|
||||
'width': 120
|
||||
},
|
||||
{
|
||||
'label': _('Posting Date'),
|
||||
'fieldname': 'posting_date',
|
||||
'fieldtype': 'Date',
|
||||
'width': 120
|
||||
}
|
||||
])
|
||||
|
||||
if filters.get('group_by') != 'Supplier':
|
||||
columns.extend([
|
||||
{
|
||||
'label': _('Supplier'),
|
||||
'fieldname': 'supplier',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Supplier',
|
||||
'width': 120
|
||||
},
|
||||
{
|
||||
'label': _('Supplier Name'),
|
||||
'fieldname': 'supplier_name',
|
||||
'fieldtype': 'Data',
|
||||
'width': 120
|
||||
}
|
||||
])
|
||||
|
||||
if additional_table_columns:
|
||||
columns += additional_table_columns
|
||||
|
||||
columns += [
|
||||
"Payable Account:Link/Account:120",
|
||||
_("Mode of Payment") + ":Link/Mode of Payment:80", _("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",
|
||||
_("Stock Qty") + ":Float:120", _("Stock UOM") + "::100",
|
||||
_("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
|
||||
{
|
||||
'label': _('Payable Account'),
|
||||
'fieldname': 'credit_to',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Account',
|
||||
'width': 80
|
||||
},
|
||||
{
|
||||
'label': _('Mode Of Payment'),
|
||||
'fieldname': 'mode_of_payment',
|
||||
'fieldtype': 'Data',
|
||||
'width': 120
|
||||
},
|
||||
{
|
||||
'label': _('Project'),
|
||||
'fieldname': 'project',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Project',
|
||||
'width': 80
|
||||
},
|
||||
{
|
||||
'label': _('Company'),
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'width': 80
|
||||
},
|
||||
{
|
||||
'label': _('Purchase Order'),
|
||||
'fieldname': 'purchase_order',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Purchase Order',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _("Purchase Receipt"),
|
||||
'fieldname': 'Purchase Receipt',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Purchase Receipt',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Expense Account'),
|
||||
'fieldname': 'expense_account',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Account',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Stock Qty'),
|
||||
'fieldname': 'stock_qty',
|
||||
'fieldtype': 'Float',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Stock UOM'),
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'UOM',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Rate'),
|
||||
'fieldname': 'rate',
|
||||
'fieldtype': 'Float',
|
||||
'options': 'currency',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Amount'),
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'options': 'currency',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'fieldname': 'currency',
|
||||
'label': _('Currency'),
|
||||
'fieldtype': 'Currency',
|
||||
'width': 80,
|
||||
'hidden': 1
|
||||
}
|
||||
]
|
||||
|
||||
if filters.get('group_by'):
|
||||
columns.append({
|
||||
'label': _('% Of Grand Total'),
|
||||
'fieldname': 'percent_gt',
|
||||
'fieldtype': 'Float',
|
||||
'width': 80
|
||||
})
|
||||
|
||||
return columns
|
||||
|
||||
def get_conditions(filters):
|
||||
@ -103,6 +297,11 @@ def get_conditions(filters):
|
||||
if filters.get(opts[0]):
|
||||
conditions += opts[1]
|
||||
|
||||
if not filters.get("group_by"):
|
||||
conditions += "ORDER BY `tabPurchase Invoice`.posting_date desc, `tabPurchase Invoice Item`.item_code desc"
|
||||
else:
|
||||
conditions += get_group_by_conditions(filters, 'Purchase Invoice')
|
||||
|
||||
return conditions
|
||||
|
||||
def get_items(filters, additional_query_columns):
|
||||
@ -129,7 +328,6 @@ def get_items(filters, additional_query_columns):
|
||||
from `tabPurchase Invoice`, `tabPurchase Invoice Item`
|
||||
where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.`parent` and
|
||||
`tabPurchase Invoice`.docstatus = 1 %s %s
|
||||
order by `tabPurchase Invoice`.posting_date desc, `tabPurchase Invoice Item`.item_code desc
|
||||
""".format(additional_query_columns) % (conditions, match_conditions), filters, as_dict=1)
|
||||
|
||||
def get_aii_accounts():
|
||||
|
@ -4,48 +4,62 @@
|
||||
frappe.query_reports["Item-wise Sales Register"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"date_range",
|
||||
"fieldname": "date_range",
|
||||
"label": __("Date Range"),
|
||||
"fieldtype": "DateRange",
|
||||
"default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"customer",
|
||||
"fieldname": "customer",
|
||||
"label": __("Customer"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Customer"
|
||||
},
|
||||
{
|
||||
"fieldname":"company",
|
||||
"fieldname": "company",
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"mode_of_payment",
|
||||
"fieldname": "mode_of_payment",
|
||||
"label": __("Mode of Payment"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Mode of Payment"
|
||||
},
|
||||
{
|
||||
"fieldname":"warehouse",
|
||||
"fieldname": "warehouse",
|
||||
"label": __("Warehouse"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Warehouse"
|
||||
},
|
||||
{
|
||||
"fieldname":"brand",
|
||||
"fieldname": "brand",
|
||||
"label": __("Brand"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Brand"
|
||||
},
|
||||
{
|
||||
"fieldname":"item_group",
|
||||
"fieldname": "item_group",
|
||||
"label": __("Item Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Item Group"
|
||||
},
|
||||
{
|
||||
"label": __("Group By"),
|
||||
"fieldname": "group_by",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Customer Group", "Customer", "Item Group", "Item", "Territory", "Invoice"]
|
||||
}
|
||||
]
|
||||
],
|
||||
"formatter": function(value, row, column, data, default_formatter) {
|
||||
value = default_formatter(value, row, column, data);
|
||||
if (data && data.bold) {
|
||||
value = value.bold();
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from frappe.utils import flt, cstr
|
||||
from frappe.model.meta import get_field_precision
|
||||
from frappe.utils.xlsxutils import handle_html
|
||||
from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments
|
||||
@ -15,23 +15,25 @@ def execute(filters=None):
|
||||
def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
|
||||
if not filters: filters = {}
|
||||
filters.update({"from_date": filters.get("date_range") and filters.get("date_range")[0], "to_date": filters.get("date_range") and filters.get("date_range")[1]})
|
||||
columns = get_columns(additional_table_columns)
|
||||
columns = get_columns(additional_table_columns, filters)
|
||||
|
||||
company_currency = frappe.get_cached_value('Company', filters.get("company"), "default_currency")
|
||||
|
||||
item_list = get_items(filters, additional_query_columns)
|
||||
if item_list:
|
||||
itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency)
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 80
|
||||
})
|
||||
|
||||
mode_of_payments = get_mode_of_payments(set([d.parent for d in item_list]))
|
||||
so_dn_map = get_delivery_notes_against_sales_order(item_list)
|
||||
|
||||
data = []
|
||||
total_row_map = {}
|
||||
skip_total_row = 0
|
||||
prev_group_by_value = ''
|
||||
|
||||
if filters.get('group_by'):
|
||||
grand_total = get_grand_total(filters, 'Sales Invoice')
|
||||
|
||||
for d in item_list:
|
||||
delivery_note = None
|
||||
if d.delivery_note:
|
||||
@ -42,57 +44,285 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
if not delivery_note and d.update_stock:
|
||||
delivery_note = d.parent
|
||||
|
||||
row = [d.item_code, d.item_name, d.item_group, d.description, d.parent, d.posting_date, d.customer, d.customer_name]
|
||||
row = {
|
||||
'item_code': d.item_code,
|
||||
'item_name': d.item_name,
|
||||
'item_group': d.item_group,
|
||||
'description': d.description,
|
||||
'invoice': d.parent,
|
||||
'posting_date': d.posting_date,
|
||||
'customer': d.customer,
|
||||
'customer_name': d.customer_name,
|
||||
'customer_group': d.customer_group,
|
||||
}
|
||||
|
||||
if additional_query_columns:
|
||||
for col in additional_query_columns:
|
||||
row.append(d.get(col))
|
||||
row.update({
|
||||
col: d.get(col)
|
||||
})
|
||||
|
||||
row += [
|
||||
d.customer_group, d.debit_to, ", ".join(mode_of_payments.get(d.parent, [])),
|
||||
d.territory, d.project, d.company, d.sales_order,
|
||||
delivery_note, d.income_account, d.cost_center, d.stock_qty, d.stock_uom
|
||||
]
|
||||
row.update({
|
||||
'debit_to': d.debit_to,
|
||||
'mode_of_payment': ", ".join(mode_of_payments.get(d.parent, [])),
|
||||
'territory': d.territory,
|
||||
'project': d.project,
|
||||
'company': d.company,
|
||||
'sales_order': d.sales_order,
|
||||
'delivery_note': d.delivery_note,
|
||||
'income_account': d.income_account,
|
||||
'cost_center': d.cost_center,
|
||||
'stock_qty': d.stock_qty,
|
||||
'stock_uom': d.stock_uom
|
||||
})
|
||||
|
||||
if d.stock_uom != d.uom and d.stock_qty:
|
||||
row += [(d.base_net_rate * d.qty)/d.stock_qty, d.base_net_amount]
|
||||
row.update({
|
||||
'rate': (d.base_net_rate * d.qty)/d.stock_qty,
|
||||
'amount': d.base_net_amount
|
||||
})
|
||||
else:
|
||||
row += [d.base_net_rate, d.base_net_amount]
|
||||
row.update({
|
||||
'rate': d.base_net_rate,
|
||||
'amount': d.base_net_amount
|
||||
})
|
||||
|
||||
total_tax = 0
|
||||
for tax in tax_columns:
|
||||
item_tax = itemised_tax.get(d.name, {}).get(tax, {})
|
||||
row += [item_tax.get("tax_rate", 0), item_tax.get("tax_amount", 0)]
|
||||
row.update({
|
||||
frappe.scrub(tax + ' Rate'): item_tax.get("tax_rate", 0),
|
||||
frappe.scrub(tax + ' Amount'): item_tax.get("tax_amount", 0),
|
||||
})
|
||||
total_tax += flt(item_tax.get("tax_amount"))
|
||||
|
||||
row += [total_tax, d.base_net_amount + total_tax, company_currency]
|
||||
row.update({
|
||||
'total_tax': total_tax,
|
||||
'total': d.base_net_amount + total_tax,
|
||||
'currency': company_currency
|
||||
})
|
||||
|
||||
if filters.get('group_by'):
|
||||
row.update({'percent_gt': flt(row['total']/grand_total) * 100})
|
||||
group_by_field, subtotal_display_field = get_group_by_and_display_fields(filters)
|
||||
data, prev_group_by_value = add_total_row(data, filters, prev_group_by_value, d, total_row_map,
|
||||
group_by_field, subtotal_display_field, grand_total, tax_columns)
|
||||
add_sub_total_row(row, total_row_map, d.get(group_by_field, ''), tax_columns)
|
||||
|
||||
data.append(row)
|
||||
|
||||
return columns, data
|
||||
if filters.get('group_by'):
|
||||
total_row = total_row_map.get(prev_group_by_value or d.get('item_name'))
|
||||
total_row['percent_gt'] = flt(total_row['total']/grand_total * 100)
|
||||
data.append(total_row)
|
||||
data.append({})
|
||||
add_sub_total_row(total_row, total_row_map, 'total_row', tax_columns)
|
||||
data.append(total_row_map.get('total_row'))
|
||||
skip_total_row = 1
|
||||
|
||||
return columns, data, None, None, None, skip_total_row
|
||||
|
||||
def get_columns(additional_table_columns):
|
||||
columns = [
|
||||
_("Item Code") + ":Link/Item:120", _("Item Name") + "::120",
|
||||
_("Item Group") + ":Link/Item Group:100", "Description::150", _("Invoice") + ":Link/Sales Invoice:120",
|
||||
_("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
|
||||
_("Customer Name") + "::120"]
|
||||
def get_columns(additional_table_columns, filters):
|
||||
columns = []
|
||||
|
||||
if filters.get('group_by') != ('Item'):
|
||||
columns.extend(
|
||||
[
|
||||
{
|
||||
'label': _('Item Code'),
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'width': 120
|
||||
},
|
||||
{
|
||||
'label': _('Item Name'),
|
||||
'fieldname': 'item_name',
|
||||
'fieldtype': 'Data',
|
||||
'width': 120
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
if filters.get('group_by') not in ('Item', 'Item Group'):
|
||||
columns.extend([
|
||||
{
|
||||
'label': _('Item Group'),
|
||||
'fieldname': 'item_group',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Item Group',
|
||||
'width': 120
|
||||
}
|
||||
])
|
||||
|
||||
columns.extend([
|
||||
{
|
||||
'label': _('Description'),
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Data',
|
||||
'width': 150
|
||||
},
|
||||
{
|
||||
'label': _('Invoice'),
|
||||
'fieldname': 'invoice',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Sales Invoice',
|
||||
'width': 120
|
||||
},
|
||||
{
|
||||
'label': _('Posting Date'),
|
||||
'fieldname': 'posting_date',
|
||||
'fieldtype': 'Date',
|
||||
'width': 120
|
||||
}
|
||||
])
|
||||
|
||||
if filters.get('group_by') != 'Customer':
|
||||
columns.extend([
|
||||
{
|
||||
'label': _('Customer Group'),
|
||||
'fieldname': 'customer_group',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Customer Group',
|
||||
'width': 120
|
||||
}
|
||||
])
|
||||
|
||||
if filters.get('group_by') not in ('Customer', 'Customer Group'):
|
||||
columns.extend([
|
||||
{
|
||||
'label': _('Customer'),
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Customer',
|
||||
'width': 120
|
||||
},
|
||||
{
|
||||
'label': _('Customer Name'),
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'width': 120
|
||||
}
|
||||
])
|
||||
|
||||
if additional_table_columns:
|
||||
columns += additional_table_columns
|
||||
|
||||
columns += [
|
||||
_("Customer Group") + ":Link/Customer Group:120",
|
||||
_("Receivable Account") + ":Link/Account:120",
|
||||
_("Mode of Payment") + "::120", _("Territory") + ":Link/Territory:80",
|
||||
_("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", _("Cost Center") + ":Link/Cost Center:140",
|
||||
_("Stock Qty") + ":Float:120", _("Stock UOM") + "::100",
|
||||
_("Rate") + ":Currency/currency:120",
|
||||
_("Amount") + ":Currency/currency:120"
|
||||
{
|
||||
'label': _('Receivable Account'),
|
||||
'fieldname': 'debit_to',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Account',
|
||||
'width': 80
|
||||
},
|
||||
{
|
||||
'label': _('Mode Of Payment'),
|
||||
'fieldname': 'mode_of_payment',
|
||||
'fieldtype': 'Data',
|
||||
'width': 120
|
||||
}
|
||||
]
|
||||
|
||||
if filters.get('group_by') != 'Terriotory':
|
||||
columns.extend([
|
||||
{
|
||||
'label': _("Territory"),
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Territory',
|
||||
'width': 80
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
columns += [
|
||||
{
|
||||
'label': _('Project'),
|
||||
'fieldname': 'project',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Project',
|
||||
'width': 80
|
||||
},
|
||||
{
|
||||
'label': _('Company'),
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'width': 80
|
||||
},
|
||||
{
|
||||
'label': _('Sales Order'),
|
||||
'fieldname': 'sales_order',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Sales Order',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _("Delivery Note"),
|
||||
'fieldname': 'delivery_note',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Delivery Note',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Income Account'),
|
||||
'fieldname': 'income_account',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Account',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _("Cost Center"),
|
||||
'fieldname': 'cost_center',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Cost Center',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Stock Qty'),
|
||||
'fieldname': 'stock_qty',
|
||||
'fieldtype': 'Float',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Stock UOM'),
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'UOM',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Rate'),
|
||||
'fieldname': 'rate',
|
||||
'fieldtype': 'Float',
|
||||
'options': 'currency',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Amount'),
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'options': 'currency',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'fieldname': 'currency',
|
||||
'label': _('Currency'),
|
||||
'fieldtype': 'Currency',
|
||||
'width': 80,
|
||||
'hidden': 1
|
||||
}
|
||||
]
|
||||
|
||||
if filters.get('group_by'):
|
||||
columns.append({
|
||||
'label': _('% Of Grand Total'),
|
||||
'fieldname': 'percent_gt',
|
||||
'fieldtype': 'Float',
|
||||
'width': 80
|
||||
})
|
||||
|
||||
return columns
|
||||
|
||||
def get_conditions(filters):
|
||||
@ -112,24 +342,32 @@ def get_conditions(filters):
|
||||
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
|
||||
|
||||
if filters.get("warehouse"):
|
||||
conditions += """ and exists(select name from `tabSales Invoice Item`
|
||||
where parent=`tabSales Invoice`.name
|
||||
and ifnull(`tabSales Invoice Item`.warehouse, '') = %(warehouse)s)"""
|
||||
conditions += """and ifnull(`tabSales Invoice Item`.warehouse, '') = %(warehouse)s"""
|
||||
|
||||
|
||||
if filters.get("brand"):
|
||||
conditions += """ and exists(select name from `tabSales Invoice Item`
|
||||
where parent=`tabSales Invoice`.name
|
||||
and ifnull(`tabSales Invoice Item`.brand, '') = %(brand)s)"""
|
||||
conditions += """and ifnull(`tabSales Invoice Item`.brand, '') = %(brand)s"""
|
||||
|
||||
if filters.get("item_group"):
|
||||
conditions += """ and exists(select name from `tabSales Invoice Item`
|
||||
where parent=`tabSales Invoice`.name
|
||||
and ifnull(`tabSales Invoice Item`.item_group, '') = %(item_group)s)"""
|
||||
conditions += """and ifnull(`tabSales Invoice Item`.item_group, '') = %(item_group)s"""
|
||||
|
||||
if not filters.get("group_by"):
|
||||
conditions += "ORDER BY `tabSales Invoice`.posting_date desc, `tabSales Invoice Item`.item_group desc"
|
||||
else:
|
||||
conditions += get_group_by_conditions(filters, 'Sales Invoice')
|
||||
|
||||
return conditions
|
||||
|
||||
def get_group_by_conditions(filters, doctype):
|
||||
if filters.get("group_by") == 'Invoice':
|
||||
return "ORDER BY `tab{0} Item`.parent desc".format(doctype)
|
||||
elif filters.get("group_by") == 'Item':
|
||||
return "ORDER BY `tab{0} Item`.`item_code`".format(doctype)
|
||||
elif filters.get("group_by") == 'Item Group':
|
||||
return "ORDER BY `tab{0} Item`.{1}".format(doctype, frappe.scrub(filters.get('group_by')))
|
||||
elif filters.get("group_by") in ('Customer', 'Customer Group', 'Territory', 'Supplier'):
|
||||
return "ORDER BY `tab{0}`.{1}".format(doctype, frappe.scrub(filters.get('group_by')))
|
||||
|
||||
def get_items(filters, additional_query_columns):
|
||||
conditions = get_conditions(filters)
|
||||
match_conditions = frappe.build_match_conditions("Sales Invoice")
|
||||
@ -156,9 +394,8 @@ def get_items(filters, additional_query_columns):
|
||||
`tabSales Invoice`.update_stock, `tabSales Invoice Item`.uom, `tabSales Invoice Item`.qty {0}
|
||||
from `tabSales Invoice`, `tabSales Invoice Item`
|
||||
where `tabSales Invoice`.name = `tabSales Invoice Item`.parent
|
||||
and `tabSales Invoice`.docstatus = 1 %s %s
|
||||
order by `tabSales Invoice`.posting_date desc, `tabSales Invoice Item`.item_code desc
|
||||
""".format(additional_query_columns or '') % (conditions, match_conditions), filters, as_dict=1)
|
||||
and `tabSales Invoice`.docstatus = 1 {1} {2}
|
||||
""".format(additional_query_columns or '', conditions, match_conditions), filters, as_dict=1) #nosec
|
||||
|
||||
def get_delivery_notes_against_sales_order(item_list):
|
||||
so_dn_map = frappe._dict()
|
||||
@ -177,6 +414,15 @@ def get_delivery_notes_against_sales_order(item_list):
|
||||
|
||||
return so_dn_map
|
||||
|
||||
def get_grand_total(filters, doctype):
|
||||
|
||||
return frappe.db.sql(""" SELECT
|
||||
SUM(`tab{0}`.base_grand_total)
|
||||
FROM `tab{0}`
|
||||
WHERE `tab{0}`.docstatus = 1
|
||||
and posting_date between %s and %s
|
||||
""".format(doctype), (filters.get('from_date'), filters.get('to_date')))[0][0] #nosec
|
||||
|
||||
def get_deducted_taxes():
|
||||
return frappe.db.sql_list("select name from `tabPurchase Taxes and Charges` where add_deduct_tax = 'Deduct'")
|
||||
|
||||
@ -264,9 +510,117 @@ def get_tax_accounts(item_list, columns, company_currency,
|
||||
|
||||
tax_columns.sort()
|
||||
for desc in tax_columns:
|
||||
columns.append(desc + " Rate:Data:80")
|
||||
columns.append(desc + " Amount:Currency/currency:100")
|
||||
columns.append({
|
||||
'label': _(desc + ' Rate'),
|
||||
'fieldname': frappe.scrub(desc + ' Rate'),
|
||||
'fieldtype': 'Float',
|
||||
'width': 100
|
||||
})
|
||||
|
||||
columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:100"]
|
||||
columns.append({
|
||||
'label': _(desc + ' Amount'),
|
||||
'fieldname': frappe.scrub(desc + ' Amount'),
|
||||
'fieldtype': 'Currency',
|
||||
'options': 'currency',
|
||||
'width': 100
|
||||
})
|
||||
|
||||
columns += [
|
||||
{
|
||||
'label': _('Total Tax'),
|
||||
'fieldname': 'total_tax',
|
||||
'fieldtype': 'Currency',
|
||||
'options': 'currency',
|
||||
'width': 100
|
||||
},
|
||||
{
|
||||
'label': _('Total'),
|
||||
'fieldname': 'total',
|
||||
'fieldtype': 'Currency',
|
||||
'options': 'currency',
|
||||
'width': 100
|
||||
}
|
||||
]
|
||||
|
||||
return itemised_tax, tax_columns
|
||||
|
||||
def add_total_row(data, filters, prev_group_by_value, item, total_row_map,
|
||||
group_by_field, subtotal_display_field, grand_total, tax_columns):
|
||||
if prev_group_by_value != item.get(group_by_field, ''):
|
||||
if prev_group_by_value:
|
||||
total_row = total_row_map.get(prev_group_by_value)
|
||||
data.append(total_row)
|
||||
data.append({})
|
||||
add_sub_total_row(total_row, total_row_map, 'total_row', tax_columns)
|
||||
|
||||
prev_group_by_value = item.get(group_by_field, '')
|
||||
|
||||
total_row_map.setdefault(item.get(group_by_field, ''), {
|
||||
subtotal_display_field: get_display_value(filters, group_by_field, item),
|
||||
'stock_qty': 0.0,
|
||||
'amount': 0.0,
|
||||
'bold': 1,
|
||||
'total_tax': 0.0,
|
||||
'total': 0.0,
|
||||
'percent_gt': 0.0
|
||||
})
|
||||
|
||||
total_row_map.setdefault('total_row', {
|
||||
subtotal_display_field: "Total",
|
||||
'stock_qty': 0.0,
|
||||
'amount': 0.0,
|
||||
'bold': 1,
|
||||
'total_tax': 0.0,
|
||||
'total': 0.0,
|
||||
'percent_gt': 0.0
|
||||
})
|
||||
|
||||
return data, prev_group_by_value
|
||||
|
||||
def get_display_value(filters, group_by_field, item):
|
||||
if filters.get('group_by') == 'Item':
|
||||
if item.get('item_code') != item.get('item_name'):
|
||||
value = cstr(item.get('item_code')) + "<br><br>" + \
|
||||
"<span style='font-weight: normal'>" + cstr(item.get('item_name')) + "</span>"
|
||||
else:
|
||||
value = item.get('item_code', '')
|
||||
elif filters.get('group_by') in ('Customer', 'Supplier'):
|
||||
party = frappe.scrub(filters.get('group_by'))
|
||||
if item.get(party) != item.get(party+'_name'):
|
||||
value = item.get(party) + "<br><br>" + \
|
||||
"<span style='font-weight: normal'>" + item.get(party+'_name') + "</span>"
|
||||
else:
|
||||
value = item.get(party)
|
||||
else:
|
||||
value = item.get(group_by_field)
|
||||
|
||||
return value
|
||||
|
||||
def get_group_by_and_display_fields(filters):
|
||||
if filters.get('group_by') == 'Item':
|
||||
group_by_field = 'item_code'
|
||||
subtotal_display_field = 'invoice'
|
||||
elif filters.get('group_by') == 'Invoice':
|
||||
group_by_field = 'parent'
|
||||
subtotal_display_field = 'item_code'
|
||||
else:
|
||||
group_by_field = frappe.scrub(filters.get('group_by'))
|
||||
subtotal_display_field = 'item_code'
|
||||
|
||||
return group_by_field, subtotal_display_field
|
||||
|
||||
def add_sub_total_row(item, total_row_map, group_by_value, tax_columns):
|
||||
total_row = total_row_map.get(group_by_value)
|
||||
total_row['stock_qty'] += item['stock_qty']
|
||||
total_row['amount'] += item['amount']
|
||||
total_row['total_tax'] += item['total_tax']
|
||||
total_row['total'] += item['total']
|
||||
total_row['percent_gt'] += item['percent_gt']
|
||||
|
||||
for tax in tax_columns:
|
||||
total_row.setdefault(frappe.scrub(tax + ' Amount'), 0.0)
|
||||
total_row[frappe.scrub(tax + ' Amount')] += flt(item[frappe.scrub(tax + ' Amount')])
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -139,7 +139,7 @@ def get_columns(invoice_list, additional_table_columns):
|
||||
|
||||
columns +=[
|
||||
{
|
||||
'label': _("Custmer Group"),
|
||||
'label': _("Customer Group"),
|
||||
'fieldname': 'customer_group',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Customer Group',
|
||||
@ -175,7 +175,7 @@ def get_columns(invoice_list, additional_table_columns):
|
||||
'label': _("Project"),
|
||||
'fieldname': 'project',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'project',
|
||||
'options': 'Project',
|
||||
'width': 80
|
||||
},
|
||||
{
|
||||
|
@ -513,7 +513,7 @@ def remove_ref_doc_link_from_jv(ref_type, ref_no):
|
||||
where reference_type=%s and reference_name=%s
|
||||
and docstatus < 2""", (now(), frappe.session.user, ref_type, ref_no))
|
||||
|
||||
frappe.msgprint(_("Journal Entries {0} are un-linked".format("\n".join(linked_jv))))
|
||||
frappe.msgprint(_("Journal Entries {0} are un-linked").format("\n".join(linked_jv)))
|
||||
|
||||
def remove_ref_doc_link_from_pe(ref_type, ref_no):
|
||||
linked_pe = frappe.db.sql_list("""select parent from `tabPayment Entry Reference`
|
||||
@ -536,7 +536,7 @@ def remove_ref_doc_link_from_pe(ref_type, ref_no):
|
||||
where name=%s""", (pe_doc.total_allocated_amount, pe_doc.base_total_allocated_amount,
|
||||
pe_doc.unallocated_amount, now(), frappe.session.user, pe))
|
||||
|
||||
frappe.msgprint(_("Payment Entries {0} are un-linked".format("\n".join(linked_pe))))
|
||||
frappe.msgprint(_("Payment Entries {0} are un-linked").format("\n".join(linked_pe)))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_company_default(company, fieldname):
|
||||
|
@ -44,7 +44,7 @@ class CropCycle(Document):
|
||||
self.import_disease_tasks(disease.disease, disease.start_date)
|
||||
disease.tasks_created = True
|
||||
|
||||
frappe.msgprint(_("Tasks have been created for managing the {0} disease (on row {1})".format(disease.disease, disease.idx)))
|
||||
frappe.msgprint(_("Tasks have been created for managing the {0} disease (on row {1})").format(disease.disease, disease.idx))
|
||||
|
||||
def import_disease_tasks(self, disease, start_date):
|
||||
disease_doc = frappe.get_doc('Disease', disease)
|
||||
|
@ -589,7 +589,7 @@ def transfer_asset(args):
|
||||
|
||||
frappe.db.commit()
|
||||
|
||||
frappe.msgprint(_("Asset Movement record {0} created").format("<a href='#Form/Asset Movement/{0}'>{0}</a>".format(movement_entry.name)))
|
||||
frappe.msgprint(_("Asset Movement record {0} created").format("<a href='#Form/Asset Movement/{0}'>{0}</a>").format(movement_entry.name))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_item_details(item_code, asset_category):
|
||||
@ -611,7 +611,7 @@ def get_asset_account(account_name, asset=None, asset_category=None, company=Non
|
||||
if asset:
|
||||
account = get_asset_category_account(account_name, asset=asset,
|
||||
asset_category = asset_category, company = company)
|
||||
|
||||
|
||||
if not asset and not account:
|
||||
account = get_asset_category_account(account_name, asset_category = asset_category, company = company)
|
||||
|
||||
|
@ -1,580 +1,146 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:location_name",
|
||||
"beta": 0,
|
||||
"creation": "2018-05-07 12:49:22.595974",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"location_name",
|
||||
"parent_location",
|
||||
"cb_details",
|
||||
"is_container",
|
||||
"is_group",
|
||||
"sb_location_details",
|
||||
"latitude",
|
||||
"longitude",
|
||||
"cb_latlong",
|
||||
"area",
|
||||
"area_uom",
|
||||
"sb_geolocation",
|
||||
"location",
|
||||
"tree_details",
|
||||
"lft",
|
||||
"rgt",
|
||||
"old_parent"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "location_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Location Name",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "parent_location",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Parent Location",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Location",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cb_details",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"description": "Check if it is a hydroponic unit",
|
||||
"fieldname": "is_container",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Container",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "Is Container"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "Is Group"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sb_location_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Location Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "Location Details"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "parent_location.latitude",
|
||||
"fieldname": "latitude",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Latitude",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "Latitude"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "parent_location.longitude",
|
||||
"fieldname": "longitude",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Longitude",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "Longitude"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cb_latlong",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "area",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Area",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.area",
|
||||
"fieldname": "area_uom",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Area UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"options": "UOM"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sb_geolocation",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "location",
|
||||
"fieldtype": "Geolocation",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Location",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "Location"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "tree_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Tree Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "Tree Details"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "lft",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "rgt",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Old Parent",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-07-11 13:36:30.999405",
|
||||
"links": [],
|
||||
"modified": "2020-01-28 13:52:22.513425",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Location",
|
||||
@ -582,127 +148,78 @@
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Stock User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Stock Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Agriculture Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Agriculture User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
"track_changes": 1
|
||||
}
|
@ -9,7 +9,7 @@ cur_frm.add_fetch('contact', 'email_id', 'email_id')
|
||||
frappe.ui.form.on("Request for Quotation",{
|
||||
setup: function(frm) {
|
||||
frm.custom_make_buttons = {
|
||||
'Supplier Quotation': 'Supplier Quotation'
|
||||
'Supplier Quotation': 'Create'
|
||||
}
|
||||
|
||||
frm.fields_dict["suppliers"].grid.get_field("contact").get_query = function(doc, cdt, cdn) {
|
||||
|
@ -43,7 +43,7 @@ class SupplierScorecardPeriod(Document):
|
||||
try:
|
||||
crit.score = min(crit.max_score, max( 0 ,frappe.safe_eval(self.get_eval_statement(crit.formula), None, {'max':max, 'min': min})))
|
||||
except Exception:
|
||||
frappe.throw(_("Could not solve criteria score function for {0}. Make sure the formula is valid.".format(crit.criteria_name)),frappe.ValidationError)
|
||||
frappe.throw(_("Could not solve criteria score function for {0}. Make sure the formula is valid.").format(crit.criteria_name),frappe.ValidationError)
|
||||
crit.score = 0
|
||||
|
||||
def calculate_score(self):
|
||||
|
@ -141,13 +141,13 @@ def get_conditions(filters):
|
||||
conditions = ""
|
||||
|
||||
if filters.get("company"):
|
||||
conditions += " AND company='%s'"% filters.get('company')
|
||||
conditions += " AND company=%s"% frappe.db.escape(filters.get('company'))
|
||||
|
||||
if filters.get("cost_center") or filters.get("project"):
|
||||
conditions += """
|
||||
AND (cost_center='%s'
|
||||
OR project='%s')
|
||||
"""% (filters.get('cost_center'), filters.get('project'))
|
||||
AND (cost_center=%s
|
||||
OR project=%s)
|
||||
"""% (frappe.db.escape(filters.get('cost_center')), frappe.db.escape(filters.get('project')))
|
||||
|
||||
if filters.get("from_date"):
|
||||
conditions += " AND transaction_date>=%s"% filters.get('from_date')
|
||||
|
@ -117,6 +117,13 @@ def get_data():
|
||||
"name": "Lead Owner Efficiency",
|
||||
"doctype": "Lead",
|
||||
"dependencies": ["Lead"]
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Territory-wise Sales",
|
||||
"doctype": "Opportunity",
|
||||
"dependencies": ["Opportunity"]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -289,6 +289,10 @@ def get_data():
|
||||
"name": "Job Offer",
|
||||
"onboard": 1,
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Appointment Letter",
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Staffing Plan",
|
||||
|
@ -58,7 +58,7 @@ class AccountsController(TransactionBase):
|
||||
(is_supplier_payment and supplier.hold_type in ['All', 'Payments']):
|
||||
if not supplier.release_date or getdate(nowdate()) <= supplier.release_date:
|
||||
frappe.msgprint(
|
||||
_('{0} is blocked so this transaction cannot proceed'.format(supplier_name)), raise_exception=1)
|
||||
_('{0} is blocked so this transaction cannot proceed').format(supplier_name), raise_exception=1)
|
||||
|
||||
def validate(self):
|
||||
if not self.get('is_return'):
|
||||
@ -926,7 +926,7 @@ def validate_taxes_and_charges(tax):
|
||||
frappe.throw(
|
||||
_("Cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"))
|
||||
elif not tax.row_id:
|
||||
frappe.throw(_("Please specify a valid Row ID for row {0} in table {1}".format(tax.idx, _(tax.doctype))))
|
||||
frappe.throw(_("Please specify a valid Row ID for row {0} in table {1}").format(tax.idx, _(tax.doctype)))
|
||||
elif tax.row_id and cint(tax.row_id) >= cint(tax.idx):
|
||||
frappe.throw(_("Cannot refer row number greater than or equal to current row number for this Charge type"))
|
||||
|
||||
@ -1135,6 +1135,7 @@ def set_sales_order_defaults(parent_doctype, parent_doctype_name, child_docname,
|
||||
child_item.reqd_by_date = p_doctype.delivery_date
|
||||
child_item.uom = item.stock_uom
|
||||
child_item.conversion_factor = get_conversion_factor(item_code, item.stock_uom).get("conversion_factor") or 1.0
|
||||
child_item.warehouse = p_doctype.set_warehouse or p_doctype.items[0].warehouse
|
||||
return child_item
|
||||
|
||||
|
||||
@ -1173,7 +1174,7 @@ def check_and_delete_children(parent, data):
|
||||
|
||||
if parent.doctype == "Purchase Order" and flt(d.received_qty):
|
||||
frappe.throw(_("Row #{0}: Cannot delete item {1} which has already been received").format(d.idx, d.item_code))
|
||||
|
||||
|
||||
if flt(d.billed_amt):
|
||||
frappe.throw(_("Row #{0}: Cannot delete item {1} which has already been billed.").format(d.idx, d.item_code))
|
||||
|
||||
|
@ -168,7 +168,7 @@ class BuyingController(StockController):
|
||||
if item.item_code and item.qty and item.item_code in stock_and_asset_items:
|
||||
item_proportion = flt(item.base_net_amount) / stock_and_asset_items_amount if stock_and_asset_items_amount \
|
||||
else flt(item.qty) / stock_and_asset_items_qty
|
||||
|
||||
|
||||
if i == (last_item_idx - 1):
|
||||
item.item_tax_amount = flt(valuation_amount_adjustment,
|
||||
self.precision("item_tax_amount", item))
|
||||
@ -500,8 +500,8 @@ class BuyingController(StockController):
|
||||
item_row = item_row.as_dict()
|
||||
for fieldname in field_list:
|
||||
if flt(item_row[fieldname]) < 0:
|
||||
frappe.throw(_("Row #{0}: {1} can not be negative for item {2}".format(item_row['idx'],
|
||||
frappe.get_meta(item_row.doctype).get_label(fieldname), item_row['item_code'])))
|
||||
frappe.throw(_("Row #{0}: {1} can not be negative for item {2}").format(item_row['idx'],
|
||||
frappe.get_meta(item_row.doctype).get_label(fieldname), item_row['item_code']))
|
||||
|
||||
def check_for_on_hold_or_closed_status(self, ref_doctype, ref_fieldname):
|
||||
for d in self.get("items"):
|
||||
@ -699,7 +699,7 @@ class BuyingController(StockController):
|
||||
if delete_asset and is_auto_create_enabled:
|
||||
# need to delete movements to delete assets otherwise throws link exists error
|
||||
movements = frappe.db.sql(
|
||||
"""SELECT asm.name
|
||||
"""SELECT asm.name
|
||||
FROM `tabAsset Movement` asm, `tabAsset Movement Item` asm_item
|
||||
WHERE asm_item.parent=asm.name and asm_item.asset=%s""", asset.name, as_dict=1)
|
||||
for movement in movements:
|
||||
@ -872,9 +872,9 @@ def validate_item_type(doc, fieldname, message):
|
||||
items = ", ".join([d for d in invalid_items])
|
||||
|
||||
if len(invalid_items) > 1:
|
||||
error_message = _("Following items {0} are not marked as {1} item. You can enable them as {1} item from its Item master".format(items, message))
|
||||
error_message = _("Following items {0} are not marked as {1} item. You can enable them as {1} item from its Item master").format(items, message)
|
||||
else:
|
||||
error_message = _("Following item {0} is not marked as {1} item. You can enable them as {1} item from its Item master".format(items, message))
|
||||
error_message = _("Following item {0} is not marked as {1} item. You can enable them as {1} item from its Item master").format(items, message)
|
||||
|
||||
frappe.throw(error_message)
|
||||
|
||||
|
@ -13,5 +13,14 @@ frappe.ui.form.on('Appointment', {
|
||||
frappe.set_route("Form", "Event", frm.doc.calendar_event);
|
||||
});
|
||||
}
|
||||
},
|
||||
onload: function(frm){
|
||||
frm.set_query("appointment_with", function(){
|
||||
return {
|
||||
filters : {
|
||||
"name": ["in", ["Customer", "Lead"]]
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"autoname": "format:APMT-{customer_name}-{####}",
|
||||
"creation": "2019-08-27 10:48:27.926283",
|
||||
"doctype": "DocType",
|
||||
@ -15,7 +16,8 @@
|
||||
"col_br_2",
|
||||
"customer_details",
|
||||
"linked_docs_section",
|
||||
"lead",
|
||||
"appointment_with",
|
||||
"party",
|
||||
"col_br_3",
|
||||
"calendar_event"
|
||||
],
|
||||
@ -61,12 +63,6 @@
|
||||
"options": "Open\nUnverified\nClosed",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "lead",
|
||||
"fieldtype": "Link",
|
||||
"label": "Lead",
|
||||
"options": "Lead"
|
||||
},
|
||||
{
|
||||
"fieldname": "calendar_event",
|
||||
"fieldtype": "Link",
|
||||
@ -91,9 +87,22 @@
|
||||
{
|
||||
"fieldname": "col_br_3",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "appointment_with",
|
||||
"fieldtype": "Link",
|
||||
"label": "Appointment With",
|
||||
"options": "DocType"
|
||||
},
|
||||
{
|
||||
"fieldname": "party",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"label": "Party",
|
||||
"options": "appointment_with"
|
||||
}
|
||||
],
|
||||
"modified": "2019-10-14 15:23:54.630731",
|
||||
"links": [],
|
||||
"modified": "2020-01-28 16:16:45.447213",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Appointment",
|
||||
|
@ -24,6 +24,14 @@ class Appointment(Document):
|
||||
return lead_list[0].name
|
||||
return None
|
||||
|
||||
def find_customer_by_email(self):
|
||||
customer_list = frappe.get_list(
|
||||
'Customer', filters={'email_id': self.customer_email}, ignore_permissions=True
|
||||
)
|
||||
if customer_list:
|
||||
return customer_list[0].name
|
||||
return None
|
||||
|
||||
def before_insert(self):
|
||||
number_of_appointments_in_same_slot = frappe.db.count(
|
||||
'Appointment', filters={'scheduled_time': self.scheduled_time})
|
||||
@ -32,11 +40,18 @@ class Appointment(Document):
|
||||
if (number_of_appointments_in_same_slot >= number_of_agents):
|
||||
frappe.throw('Time slot is not available')
|
||||
# Link lead
|
||||
if not self.lead:
|
||||
self.lead = self.find_lead_by_email()
|
||||
if not self.party:
|
||||
lead = self.find_lead_by_email()
|
||||
customer = self.find_customer_by_email()
|
||||
if customer:
|
||||
self.appointment_with = "Customer"
|
||||
self.party = customer
|
||||
else:
|
||||
self.appointment_with = "Lead"
|
||||
self.party = lead
|
||||
|
||||
def after_insert(self):
|
||||
if self.lead:
|
||||
if self.party:
|
||||
# Create Calendar event
|
||||
self.auto_assign()
|
||||
self.create_calendar_event()
|
||||
@ -89,7 +104,7 @@ class Appointment(Document):
|
||||
|
||||
def create_lead_and_link(self):
|
||||
# Return if already linked
|
||||
if self.lead:
|
||||
if self.party:
|
||||
return
|
||||
lead = frappe.get_doc({
|
||||
'doctype': 'Lead',
|
||||
@ -100,7 +115,7 @@ class Appointment(Document):
|
||||
})
|
||||
lead.insert(ignore_permissions=True)
|
||||
# Link lead
|
||||
self.lead = lead.name
|
||||
self.party = lead.name
|
||||
|
||||
def auto_assign(self):
|
||||
from frappe.desk.form.assign_to import add as add_assignemnt
|
||||
@ -129,14 +144,14 @@ class Appointment(Document):
|
||||
break
|
||||
|
||||
def get_assignee_from_latest_opportunity(self):
|
||||
if not self.lead:
|
||||
if not self.party:
|
||||
return None
|
||||
if not frappe.db.exists('Lead', self.lead):
|
||||
if not frappe.db.exists('Lead', self.party):
|
||||
return None
|
||||
opporutnities = frappe.get_list(
|
||||
'Opportunity',
|
||||
filters={
|
||||
'party_name': self.lead,
|
||||
'party_name': self.party,
|
||||
},
|
||||
ignore_permissions=True,
|
||||
order_by='creation desc')
|
||||
@ -159,7 +174,7 @@ class Appointment(Document):
|
||||
'status': 'Open',
|
||||
'type': 'Public',
|
||||
'send_reminder': frappe.db.get_single_value('Appointment Booking Settings', 'email_reminders'),
|
||||
'event_participants': [dict(reference_doctype='Lead', reference_docname=self.lead)]
|
||||
'event_participants': [dict(reference_doctype=self.appointment_with, reference_docname=self.party)]
|
||||
})
|
||||
employee = _get_employee_from_user(self._assign)
|
||||
if employee:
|
||||
|
@ -22,6 +22,7 @@
|
||||
"sales_stage",
|
||||
"order_lost_reason",
|
||||
"mins_to_first_response",
|
||||
"expected_closing",
|
||||
"next_contact",
|
||||
"contact_by",
|
||||
"contact_date",
|
||||
@ -156,6 +157,11 @@
|
||||
"label": "Mins to first response",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "expected_closing",
|
||||
"fieldtype": "Date",
|
||||
"label": "Expected Closing Date"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"collapsible_depends_on": "contact_by",
|
||||
|
@ -37,7 +37,7 @@ class AssessmentPlan(Document):
|
||||
for d in self.assessment_criteria:
|
||||
max_score += d.maximum_score
|
||||
if self.maximum_assessment_score != max_score:
|
||||
frappe.throw(_("Sum of Scores of Assessment Criteria needs to be {0}.".format(self.maximum_assessment_score)))
|
||||
frappe.throw(_("Sum of Scores of Assessment Criteria needs to be {0}.").format(self.maximum_assessment_score))
|
||||
|
||||
def validate_assessment_criteria(self):
|
||||
assessment_criteria_list = frappe.db.sql_list(''' select apc.assessment_criteria
|
||||
|
@ -41,7 +41,7 @@ class AssessmentResult(Document):
|
||||
assessment_result = frappe.get_list("Assessment Result", filters={"name": ("not in", [self.name]),
|
||||
"student":self.student, "assessment_plan":self.assessment_plan, "docstatus":("!=", 2)})
|
||||
if assessment_result:
|
||||
frappe.throw(_("Assessment Result record {0} already exists.".format(getlink("Assessment Result",assessment_result[0].name))))
|
||||
frappe.throw(_("Assessment Result record {0} already exists.").format(getlink("Assessment Result",assessment_result[0].name)))
|
||||
|
||||
|
||||
|
||||
|
@ -16,4 +16,4 @@ class CourseActivity(Document):
|
||||
if frappe.db.exists("Course Enrollment", self.enrollment):
|
||||
return True
|
||||
else:
|
||||
frappe.throw(_("Course Enrollment {0} does not exists".format(self.enrollment)))
|
||||
frappe.throw(_("Course Enrollment {0} does not exists").format(self.enrollment))
|
@ -13,7 +13,7 @@ class GradingScale(Document):
|
||||
thresholds = []
|
||||
for d in self.intervals:
|
||||
if d.threshold in thresholds:
|
||||
frappe.throw(_("Treshold {0}% appears more than once".format(d.threshold)))
|
||||
frappe.throw(_("Treshold {0}% appears more than once").format(d.threshold))
|
||||
else:
|
||||
thresholds.append(cint(d.threshold))
|
||||
if 0 not in thresholds:
|
||||
|
@ -38,7 +38,7 @@ class Question(Document):
|
||||
options = self.options
|
||||
answers = [item.name for item in options if item.is_correct == True]
|
||||
if len(answers) == 0:
|
||||
frappe.throw(_("No correct answer is set for {0}".format(self.name)))
|
||||
frappe.throw(_("No correct answer is set for {0}").format(self.name))
|
||||
return None
|
||||
elif len(answers) == 1:
|
||||
return answers[0]
|
||||
|
@ -34,15 +34,15 @@ class StudentGroup(Document):
|
||||
students = [d.student for d in program_enrollment] if program_enrollment else []
|
||||
for d in self.students:
|
||||
if not frappe.db.get_value("Student", d.student, "enabled") and d.active and not self.disabled:
|
||||
frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name)))
|
||||
frappe.throw(_("{0} - {1} is inactive student").format(d.group_roll_number, d.student_name))
|
||||
|
||||
if (self.group_based_on == "Batch") and cint(frappe.defaults.get_defaults().validate_batch)\
|
||||
and d.student not in students:
|
||||
frappe.throw(_("{0} - {1} is not enrolled in the Batch {2}".format(d.group_roll_number, d.student_name, self.batch)))
|
||||
frappe.throw(_("{0} - {1} is not enrolled in the Batch {2}").format(d.group_roll_number, d.student_name, self.batch))
|
||||
|
||||
if (self.group_based_on == "Course") and cint(frappe.defaults.get_defaults().validate_course)\
|
||||
and (d.student not in students):
|
||||
frappe.throw(_("{0} - {1} is not enrolled in the Course {2}".format(d.group_roll_number, d.student_name, self.course)))
|
||||
frappe.throw(_("{0} - {1} is not enrolled in the Course {2}").format(d.group_roll_number, d.student_name, self.course))
|
||||
|
||||
def validate_and_set_child_table_fields(self):
|
||||
roll_numbers = [d.group_roll_number for d in self.students if d.group_roll_number]
|
||||
@ -55,7 +55,7 @@ class StudentGroup(Document):
|
||||
max_roll_no += 1
|
||||
d.group_roll_number = max_roll_no
|
||||
if d.group_roll_number in roll_no_list:
|
||||
frappe.throw(_("Duplicate roll number for student {0}".format(d.student_name)))
|
||||
frappe.throw(_("Duplicate roll number for student {0}").format(d.student_name))
|
||||
else:
|
||||
roll_no_list.append(d.group_roll_number)
|
||||
|
||||
@ -77,7 +77,7 @@ def get_students(academic_year, group_based_on, academic_term=None, program=None
|
||||
return []
|
||||
|
||||
def get_program_enrollment(academic_year, academic_term=None, program=None, batch=None, student_category=None, course=None):
|
||||
|
||||
|
||||
condition1 = " "
|
||||
condition2 = " "
|
||||
if academic_term:
|
||||
@ -93,9 +93,9 @@ def get_program_enrollment(academic_year, academic_term=None, program=None, batc
|
||||
condition2 = ", `tabProgram Enrollment Course` pec"
|
||||
|
||||
return frappe.db.sql('''
|
||||
select
|
||||
pe.student, pe.student_name
|
||||
from
|
||||
select
|
||||
pe.student, pe.student_name
|
||||
from
|
||||
`tabProgram Enrollment` pe {condition2}
|
||||
where
|
||||
pe.academic_year = %(academic_year)s {condition1}
|
||||
|
@ -74,4 +74,4 @@ class StudentGroupCreationTool(Document):
|
||||
student_group.append('students', student)
|
||||
student_group.save()
|
||||
|
||||
frappe.msgprint(_("{0} Student Groups created.".format(l)))
|
||||
frappe.msgprint(_("{0} Student Groups created.").format(l))
|
@ -185,7 +185,7 @@ def add_activity(course, content_type, content, program):
|
||||
|
||||
student = get_current_student()
|
||||
if not student:
|
||||
return frappe.throw(_("Student with email {0} does not exist".format(frappe.session.user)), frappe.DoesNotExistError)
|
||||
return frappe.throw(_("Student with email {0} does not exist").format(frappe.session.user), frappe.DoesNotExistError)
|
||||
|
||||
enrollment = get_or_create_course_enrollment(course, program)
|
||||
if content_type == 'Quiz':
|
||||
@ -220,7 +220,7 @@ def get_quiz(quiz_name, course):
|
||||
quiz = frappe.get_doc("Quiz", quiz_name)
|
||||
questions = quiz.get_questions()
|
||||
except:
|
||||
frappe.throw(_("Quiz {0} does not exist".format(quiz_name)))
|
||||
frappe.throw(_("Quiz {0} does not exist").format(quiz_name))
|
||||
return None
|
||||
|
||||
questions = [{
|
||||
@ -347,7 +347,7 @@ def get_or_create_course_enrollment(course, program):
|
||||
if not course_enrollment:
|
||||
program_enrollment = get_enrollment('program', program, student.name)
|
||||
if not program_enrollment:
|
||||
frappe.throw(_("You are not enrolled in program {0}".format(program)))
|
||||
frappe.throw(_("You are not enrolled in program {0}").format(program))
|
||||
return
|
||||
return student.enroll_in_course(course_name=course, program_enrollment=get_enrollment('program', program, student.name))
|
||||
else:
|
||||
|
@ -259,6 +259,6 @@ def get_tax_account_head(tax):
|
||||
{"parent": "Shopify Settings", "shopify_tax": tax_title}, "tax_account")
|
||||
|
||||
if not tax_account:
|
||||
frappe.throw(_("Tax Account not specified for Shopify Tax {0}".format(tax.get("title"))))
|
||||
frappe.throw(_("Tax Account not specified for Shopify Tax {0}").format(tax.get("title")))
|
||||
|
||||
return tax_account
|
||||
|
@ -63,7 +63,7 @@ def add_bank_accounts(response, bank, company):
|
||||
|
||||
default_gl_account = get_default_bank_cash_account(company, "Bank")
|
||||
if not default_gl_account:
|
||||
frappe.throw(_("Please setup a default bank account for company {0}".format(company)))
|
||||
frappe.throw(_("Please setup a default bank account for company {0}").format(company))
|
||||
|
||||
for account in response["accounts"]:
|
||||
acc_type = frappe.db.get_value("Account Type", account["type"])
|
||||
|
@ -102,7 +102,7 @@ def invoice_appointment(appointment_doc):
|
||||
|
||||
sales_invoice.save(ignore_permissions=True)
|
||||
sales_invoice.submit()
|
||||
frappe.msgprint(_("Sales Invoice {0} created as paid".format(sales_invoice.name)), alert=True)
|
||||
frappe.msgprint(_("Sales Invoice {0} created as paid").format(sales_invoice.name), alert=True)
|
||||
|
||||
def appointment_cancel(appointment_id):
|
||||
appointment = frappe.get_doc("Patient Appointment", appointment_id)
|
||||
@ -111,7 +111,7 @@ def appointment_cancel(appointment_id):
|
||||
sales_invoice = exists_sales_invoice(appointment)
|
||||
if sales_invoice and cancel_sales_invoice(sales_invoice):
|
||||
frappe.msgprint(
|
||||
_("Appointment {0} and Sales Invoice {1} cancelled".format(appointment.name, sales_invoice.name))
|
||||
_("Appointment {0} and Sales Invoice {1} cancelled").format(appointment.name, sales_invoice.name)
|
||||
)
|
||||
else:
|
||||
validity = validity_exists(appointment.practitioner, appointment.patient)
|
||||
@ -121,7 +121,7 @@ def appointment_cancel(appointment_id):
|
||||
visited = fee_validity.visited - 1
|
||||
frappe.db.set_value("Fee Validity", fee_validity.name, "visited", visited)
|
||||
frappe.msgprint(
|
||||
_("Appointment cancelled, Please review and cancel the invoice {0}".format(fee_validity.ref_invoice))
|
||||
_("Appointment cancelled, Please review and cancel the invoice {0}").format(fee_validity.ref_invoice)
|
||||
)
|
||||
else:
|
||||
frappe.msgprint(_("Appointment cancelled"))
|
||||
@ -203,7 +203,7 @@ def get_availability_data(date, practitioner):
|
||||
if employee:
|
||||
# Check if it is Holiday
|
||||
if is_holiday(employee, date):
|
||||
frappe.throw(_("{0} is a company holiday".format(date)))
|
||||
frappe.throw(_("{0} is a company holiday").format(date))
|
||||
|
||||
# Check if He/She on Leave
|
||||
leave_record = frappe.db.sql("""select half_day from `tabLeave Application`
|
||||
@ -221,7 +221,7 @@ def get_availability_data(date, practitioner):
|
||||
if schedule.schedule:
|
||||
practitioner_schedule = frappe.get_doc("Practitioner Schedule", schedule.schedule)
|
||||
else:
|
||||
frappe.throw(_("{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master".format(practitioner)))
|
||||
frappe.throw(_("{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master").format(practitioner))
|
||||
|
||||
if practitioner_schedule:
|
||||
available_slots = []
|
||||
@ -259,7 +259,7 @@ def get_availability_data(date, practitioner):
|
||||
"avail_slot":available_slots, 'appointments': appointments})
|
||||
|
||||
else:
|
||||
frappe.throw(_("{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master".format(practitioner)))
|
||||
frappe.throw(_("{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master").format(practitioner))
|
||||
|
||||
if not available_slots and not slot_details:
|
||||
# TODO: return available slots in nearby dates
|
||||
|
@ -32,8 +32,8 @@ class HotelRoomReservation(Document):
|
||||
+ d.qty + self.rooms_booked.get(d.item)
|
||||
total_rooms = self.get_total_rooms(d.item)
|
||||
if total_rooms < rooms_booked:
|
||||
frappe.throw(_("Hotel Rooms of type {0} are unavailable on {1}".format(d.item,
|
||||
frappe.format(day, dict(fieldtype="Date")))), exc=HotelRoomUnavailableError)
|
||||
frappe.throw(_("Hotel Rooms of type {0} are unavailable on {1}").format(d.item,
|
||||
frappe.format(day, dict(fieldtype="Date"))), exc=HotelRoomUnavailableError)
|
||||
|
||||
self.rooms_booked[d.item] += rooms_booked
|
||||
|
||||
@ -74,8 +74,8 @@ class HotelRoomReservation(Document):
|
||||
net_rate += day_rate[0][0]
|
||||
else:
|
||||
frappe.throw(
|
||||
_("Please set Hotel Room Rate on {}".format(
|
||||
frappe.format(day, dict(fieldtype="Date")))), exc=HotelRoomPricingNotSetError)
|
||||
_("Please set Hotel Room Rate on {}").format(
|
||||
frappe.format(day, dict(fieldtype="Date"))), exc=HotelRoomPricingNotSetError)
|
||||
d.rate = net_rate
|
||||
d.amount = net_rate * flt(d.qty)
|
||||
self.net_total += d.amount
|
||||
|
0
erpnext/hr/doctype/appointment_letter/__init__.py
Normal file
0
erpnext/hr/doctype/appointment_letter/__init__.py
Normal file
30
erpnext/hr/doctype/appointment_letter/appointment_letter.js
Normal file
30
erpnext/hr/doctype/appointment_letter/appointment_letter.js
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Appointment Letter', {
|
||||
appointment_letter_template: function(frm){
|
||||
if (frm.doc.appointment_letter_template){
|
||||
frappe.call({
|
||||
method: 'erpnext.hr.doctype.appointment_letter.appointment_letter.get_appointment_letter_details',
|
||||
args : {
|
||||
template : frm.doc.appointment_letter_template
|
||||
},
|
||||
callback: function(r){
|
||||
if(r.message){
|
||||
let message_body = r.message;
|
||||
frm.set_value("introduction", message_body[0].introduction);
|
||||
frm.set_value("closing_notes", message_body[0].closing_notes);
|
||||
frm.doc.terms = []
|
||||
for (var i in message_body[1].description){
|
||||
frm.add_child("terms");
|
||||
frm.fields_dict.terms.get_value()[i].title = message_body[1].description[i].title;
|
||||
frm.fields_dict.terms.get_value()[i].description = message_body[1].description[i].description;
|
||||
}
|
||||
frm.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
124
erpnext/hr/doctype/appointment_letter/appointment_letter.json
Normal file
124
erpnext/hr/doctype/appointment_letter/appointment_letter.json
Normal file
@ -0,0 +1,124 @@
|
||||
{
|
||||
"actions": [],
|
||||
"autoname": "HR-APP-LETTER-.#####",
|
||||
"creation": "2019-12-26 12:35:49.574828",
|
||||
"default_print_format": "Standard Appointment Letter",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"job_applicant",
|
||||
"applicant_name",
|
||||
"column_break_3",
|
||||
"company",
|
||||
"appointment_date",
|
||||
"appointment_letter_template",
|
||||
"body_section",
|
||||
"introduction",
|
||||
"terms",
|
||||
"closing_notes"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fetch_from": "job_applicant.applicant_name",
|
||||
"fieldname": "applicant_name",
|
||||
"fieldtype": "Data",
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Applicant Name",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "appointment_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Appointment Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "appointment_letter_template",
|
||||
"fieldtype": "Link",
|
||||
"label": "Appointment Letter Template",
|
||||
"options": "Appointment Letter Template",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "appointment_letter_template.introduction",
|
||||
"fieldname": "introduction",
|
||||
"fieldtype": "Long Text",
|
||||
"label": "Introduction",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "body_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Body"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "job_applicant",
|
||||
"fieldtype": "Link",
|
||||
"label": "Job Applicant",
|
||||
"options": "Job Applicant",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "closing_notes",
|
||||
"fieldtype": "Text",
|
||||
"label": "Closing Notes"
|
||||
},
|
||||
{
|
||||
"fieldname": "terms",
|
||||
"fieldtype": "Table",
|
||||
"label": "Terms",
|
||||
"options": "Appointment Letter content",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"links": [],
|
||||
"modified": "2020-01-21 17:30:36.334395",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Appointment Letter",
|
||||
"name_case": "Title Case",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "HR Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
25
erpnext/hr/doctype/appointment_letter/appointment_letter.py
Normal file
25
erpnext/hr/doctype/appointment_letter/appointment_letter.py
Normal file
@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AppointmentLetter(Document):
|
||||
pass
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_appointment_letter_details(template):
|
||||
body = []
|
||||
intro= frappe.get_list("Appointment Letter Template",
|
||||
fields = ['introduction', 'closing_notes'],
|
||||
filters={'name': template
|
||||
})[0]
|
||||
content = frappe.get_list("Appointment Letter content",
|
||||
fields = ['title', 'description'],
|
||||
filters={'parent': template
|
||||
})
|
||||
body.append(intro)
|
||||
body.append({'description': content})
|
||||
return body
|
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# import frappe
|
||||
import unittest
|
||||
|
||||
class TestAppointmentLetter(unittest.TestCase):
|
||||
pass
|
@ -0,0 +1,39 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2019-12-26 12:22:16.575767",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"title",
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Title",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Long Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2019-12-26 12:24:09.824084",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Appointment Letter content",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AppointmentLettercontent(Document):
|
||||
pass
|
@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Appointment Letter Template', {
|
||||
// refresh: function(frm) {
|
||||
|
||||
// }
|
||||
});
|
@ -0,0 +1,69 @@
|
||||
{
|
||||
"actions": [],
|
||||
"autoname": "HR-APP-LETTER-TEMP-.#####",
|
||||
"creation": "2019-12-26 12:20:14.219578",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"introduction",
|
||||
"terms",
|
||||
"closing_notes"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "introduction",
|
||||
"fieldtype": "Long Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Introduction",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "closing_notes",
|
||||
"fieldtype": "Text",
|
||||
"label": "Closing Notes"
|
||||
},
|
||||
{
|
||||
"fieldname": "terms",
|
||||
"fieldtype": "Table",
|
||||
"label": "Terms",
|
||||
"options": "Appointment Letter content",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"links": [],
|
||||
"modified": "2020-01-21 17:00:46.779420",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Appointment Letter Template",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "HR Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AppointmentLetterTemplate(Document):
|
||||
pass
|
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# import frappe
|
||||
import unittest
|
||||
|
||||
class TestAppointmentLetterTemplate(unittest.TestCase):
|
||||
pass
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"autoname": "naming_series:",
|
||||
"creation": "2013-01-10 16:34:13",
|
||||
@ -63,6 +64,14 @@
|
||||
"oldfieldname": "employee_name",
|
||||
"oldfieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"depends_on": "working_hours",
|
||||
"fieldname": "working_hours",
|
||||
"fieldtype": "Float",
|
||||
"label": "Working Hours",
|
||||
"precision": "1",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"default": "Present",
|
||||
"fieldname": "status",
|
||||
@ -72,7 +81,7 @@
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "status",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nPresent\nAbsent\nOn Leave\nHalf Day",
|
||||
"options": "\nPresent\nAbsent\nOn Leave\nHalf Day\nWork From Home",
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
@ -126,6 +135,12 @@
|
||||
"options": "Department",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "shift",
|
||||
"fieldtype": "Link",
|
||||
"label": "Shift",
|
||||
"options": "Shift Type"
|
||||
},
|
||||
{
|
||||
"fieldname": "attendance_request",
|
||||
"fieldtype": "Link",
|
||||
@ -143,20 +158,6 @@
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "working_hours",
|
||||
"fieldname": "working_hours",
|
||||
"fieldtype": "Float",
|
||||
"label": "Working Hours",
|
||||
"precision": "1",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "shift",
|
||||
"fieldtype": "Link",
|
||||
"label": "Shift",
|
||||
"options": "Shift Type"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "late_entry",
|
||||
@ -173,7 +174,8 @@
|
||||
"icon": "fa fa-ok",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"modified": "2019-07-29 20:35:40.845422",
|
||||
"links": [],
|
||||
"modified": "2020-01-27 20:25:29.572281",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Attendance",
|
||||
|
@ -52,7 +52,7 @@ class Attendance(Document):
|
||||
|
||||
def validate(self):
|
||||
from erpnext.controllers.status_updater import validate_status
|
||||
validate_status(self.status, ["Present", "Absent", "On Leave", "Half Day"])
|
||||
validate_status(self.status, ["Present", "Absent", "On Leave", "Half Day", "Work From Home"])
|
||||
self.validate_attendance_date()
|
||||
self.validate_duplicate_record()
|
||||
self.check_leave_record()
|
||||
|
@ -1,7 +1,13 @@
|
||||
frappe.listview_settings['Attendance'] = {
|
||||
add_fields: ["status", "attendance_date"],
|
||||
get_indicator: function(doc) {
|
||||
return [__(doc.status), doc.status=="Present" ? "green" : "darkgrey", "status,=," + doc.status];
|
||||
get_indicator: function (doc) {
|
||||
if (["Present", "Work From Home"].includes(doc.status)) {
|
||||
return [__(doc.status), "green", "status,=," + doc.status];
|
||||
} else if (["Absent", "On Leave"].includes(doc.status)) {
|
||||
return [__(doc.status), "red", "status,=," + doc.status];
|
||||
} else if (doc.status == "Half Day") {
|
||||
return [__(doc.status), "orange", "status,=," + doc.status];
|
||||
}
|
||||
},
|
||||
onload: function(list_view) {
|
||||
let me = this;
|
||||
@ -44,7 +50,7 @@ frappe.listview_settings['Attendance'] = {
|
||||
label: __("Status"),
|
||||
fieldtype: "Select",
|
||||
fieldname: "status",
|
||||
options: ["Present", "Absent", "Half Day"],
|
||||
options: ["Present", "Absent", "Half Day", "Work From Home"],
|
||||
hidden:1,
|
||||
reqd: 1,
|
||||
|
||||
@ -102,5 +108,4 @@ frappe.listview_settings['Attendance'] = {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -38,6 +38,8 @@ class AttendanceRequest(Document):
|
||||
attendance.employee_name = self.employee_name
|
||||
if self.half_day and date_diff(getdate(self.half_day_date), getdate(attendance_date)) == 0:
|
||||
attendance.status = "Half Day"
|
||||
elif self.reason == "Work From Home":
|
||||
attendance.status = "Work From Home"
|
||||
else:
|
||||
attendance.status = "Present"
|
||||
attendance.attendance_date = attendance_date
|
||||
|
@ -13,7 +13,28 @@ class TestAttendanceRequest(unittest.TestCase):
|
||||
for doctype in ["Attendance Request", "Attendance"]:
|
||||
frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype))
|
||||
|
||||
def test_attendance_request(self):
|
||||
def test_on_duty_attendance_request(self):
|
||||
today = nowdate()
|
||||
employee = get_employee()
|
||||
attendance_request = frappe.new_doc("Attendance Request")
|
||||
attendance_request.employee = employee.name
|
||||
attendance_request.from_date = date(date.today().year, 1, 1)
|
||||
attendance_request.to_date = date(date.today().year, 1, 2)
|
||||
attendance_request.reason = "On Duty"
|
||||
attendance_request.company = "_Test Company"
|
||||
attendance_request.insert()
|
||||
attendance_request.submit()
|
||||
attendance = frappe.get_doc('Attendance', {
|
||||
'employee': employee.name,
|
||||
'attendance_date': date(date.today().year, 1, 1),
|
||||
'docstatus': 1
|
||||
})
|
||||
self.assertEqual(attendance.status, 'Present')
|
||||
attendance_request.cancel()
|
||||
attendance.reload()
|
||||
self.assertEqual(attendance.docstatus, 2)
|
||||
|
||||
def test_work_from_home_attendance_request(self):
|
||||
today = nowdate()
|
||||
employee = get_employee()
|
||||
attendance_request = frappe.new_doc("Attendance Request")
|
||||
@ -29,7 +50,7 @@ class TestAttendanceRequest(unittest.TestCase):
|
||||
'attendance_date': date(date.today().year, 1, 1),
|
||||
'docstatus': 1
|
||||
})
|
||||
self.assertEqual(attendance.status, 'Present')
|
||||
self.assertEqual(attendance.status, 'Work From Home')
|
||||
attendance_request.cancel()
|
||||
attendance.reload()
|
||||
self.assertEqual(attendance.docstatus, 2)
|
||||
|
@ -97,9 +97,9 @@ class DailyWorkSummary(Document):
|
||||
|
||||
return dict(replies=replies,
|
||||
original_message=dws_group.message,
|
||||
title=_('Work Summary for {0}'.format(
|
||||
title=_('Work Summary for {0}').format(
|
||||
global_date_format(self.creation)
|
||||
)),
|
||||
),
|
||||
did_not_reply=', '.join(did_not_reply) or '',
|
||||
did_not_reply_title=_('No replies from'))
|
||||
|
||||
|
@ -124,8 +124,10 @@ erpnext.EmployeeSelector = Class.extend({
|
||||
|
||||
var mark_employee_toolbar = $('<div class="col-sm-12 bottom-toolbar">\
|
||||
<button class="btn btn-primary btn-mark-present btn-xs"></button>\
|
||||
<button class="btn btn-default btn-mark-absent btn-xs"></button>\
|
||||
<button class="btn btn-default btn-mark-half-day btn-xs"></button></div>')
|
||||
<button class="btn btn-primary btn-mark-work-from-home btn-xs"></button>\
|
||||
<button class="btn btn-warning btn-mark-half-day btn-xs"></button>\
|
||||
<button class="btn btn-danger btn-mark-absent btn-xs"></button>\
|
||||
</div>');
|
||||
|
||||
employee_toolbar.find(".btn-add")
|
||||
.html(__('Check all'))
|
||||
@ -224,6 +226,31 @@ erpnext.EmployeeSelector = Class.extend({
|
||||
});
|
||||
|
||||
|
||||
mark_employee_toolbar.find(".btn-mark-work-from-home")
|
||||
.html(__('Mark Work From Home'))
|
||||
.on("click", function() {
|
||||
var employee_work_from_home = [];
|
||||
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
||||
if($(check).is(":checked")) {
|
||||
employee_work_from_home.push(employee[i]);
|
||||
}
|
||||
});
|
||||
frappe.call({
|
||||
method: "erpnext.hr.doctype.employee_attendance_tool.employee_attendance_tool.mark_employee_attendance",
|
||||
args:{
|
||||
"employee_list":employee_work_from_home,
|
||||
"status":"Work From Home",
|
||||
"date":frm.doc.date,
|
||||
"company":frm.doc.company
|
||||
},
|
||||
|
||||
callback: function(r) {
|
||||
erpnext.employee_attendance_tool.load_employees(frm);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var row;
|
||||
$.each(employee, function(i, m) {
|
||||
if (i===0 || (i % 4) === 0) {
|
||||
|
@ -84,7 +84,7 @@ def get_benefit_pro_rata_ratio_amount(employee, on_date, sal_struct):
|
||||
pay_against_benefit_claim, max_benefit_amount = frappe.db.get_value("Salary Component", sal_struct_row.salary_component, ["pay_against_benefit_claim", "max_benefit_amount"])
|
||||
except TypeError:
|
||||
# show the error in tests?
|
||||
frappe.throw(_("Unable to find Salary Component {0}".format(sal_struct_row.salary_component)))
|
||||
frappe.throw(_("Unable to find Salary Component {0}").format(sal_struct_row.salary_component))
|
||||
if sal_struct_row.is_flexible_benefit == 1 and pay_against_benefit_claim != 1:
|
||||
total_pro_rata_max += max_benefit_amount
|
||||
if total_pro_rata_max > 0:
|
||||
|
@ -104,11 +104,16 @@ frappe.ui.form.on("Leave Application", {
|
||||
},
|
||||
|
||||
half_day: function(frm) {
|
||||
if (frm.doc.from_date == frm.doc.to_date) {
|
||||
frm.set_value("half_day_date", frm.doc.from_date);
|
||||
if (frm.doc.half_day) {
|
||||
if (frm.doc.from_date == frm.doc.to_date) {
|
||||
frm.set_value("half_day_date", frm.doc.from_date);
|
||||
}
|
||||
else {
|
||||
frm.trigger("half_day_datepicker");
|
||||
}
|
||||
}
|
||||
else {
|
||||
frm.trigger("half_day_datepicker");
|
||||
frm.set_value("half_day_date", "");
|
||||
}
|
||||
frm.trigger("calculate_total_days");
|
||||
},
|
||||
|
@ -364,11 +364,11 @@ class SalarySlip(TransactionBase):
|
||||
return amount
|
||||
|
||||
except NameError as err:
|
||||
frappe.throw(_("Name error: {0}".format(err)))
|
||||
frappe.throw(_("Name error: {0}").format(err))
|
||||
except SyntaxError as err:
|
||||
frappe.throw(_("Syntax error in formula or condition: {0}".format(err)))
|
||||
frappe.throw(_("Syntax error in formula or condition: {0}").format(err))
|
||||
except Exception as e:
|
||||
frappe.throw(_("Error in formula or condition: {0}".format(e)))
|
||||
frappe.throw(_("Error in formula or condition: {0}").format(e))
|
||||
raise
|
||||
|
||||
def add_employee_benefits(self, payroll_period):
|
||||
@ -705,11 +705,11 @@ class SalarySlip(TransactionBase):
|
||||
if condition:
|
||||
return frappe.safe_eval(condition, self.whitelisted_globals, data)
|
||||
except NameError as err:
|
||||
frappe.throw(_("Name error: {0}".format(err)))
|
||||
frappe.throw(_("Name error: {0}").format(err))
|
||||
except SyntaxError as err:
|
||||
frappe.throw(_("Syntax error in condition: {0}".format(err)))
|
||||
frappe.throw(_("Syntax error in condition: {0}").format(err))
|
||||
except Exception as e:
|
||||
frappe.throw(_("Error in formula or condition: {0}".format(e)))
|
||||
frappe.throw(_("Error in formula or condition: {0}").format(e))
|
||||
raise
|
||||
|
||||
def get_salary_slip_row(self, salary_component):
|
||||
|
@ -57,8 +57,8 @@ class StaffingPlan(Document):
|
||||
and sp.to_date >= %s and sp.from_date <= %s and sp.company = %s
|
||||
""", (staffing_plan_detail.designation, self.from_date, self.to_date, self.company))
|
||||
if overlap and overlap [0][0]:
|
||||
frappe.throw(_("Staffing Plan {0} already exist for designation {1}"
|
||||
.format(overlap[0][0], staffing_plan_detail.designation)))
|
||||
frappe.throw(_("Staffing Plan {0} already exist for designation {1}")
|
||||
.format(overlap[0][0], staffing_plan_detail.designation))
|
||||
|
||||
def validate_with_parent_plan(self, staffing_plan_detail):
|
||||
if not frappe.get_cached_value('Company', self.company, "parent_company"):
|
||||
|
@ -0,0 +1,38 @@
|
||||
{%- from "templates/print_formats/standard_macros.html" import add_header -%}
|
||||
|
||||
<div class="text-center" style="margin-bottom: 10%;"><h3>Appointment Letter</h3></div>
|
||||
<div class ='row' style="margin-bottom: 5%;">
|
||||
<div class = "col-sm-6">
|
||||
<b>{{ doc.applicant_name }},</b>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<span style = "float: right;"><b> Date: </b>{{ doc.appointment_date }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-bottom: 5%;">
|
||||
{{ doc.introduction }}
|
||||
</div>
|
||||
<div style="margin-bottom: 5%;">
|
||||
<ul>
|
||||
{% for content in doc.terms %}
|
||||
<li style="padding-bottom: 3%;">
|
||||
<span>
|
||||
<span><b>{{ content.title }}: </b></span> {{ content.description }}
|
||||
</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div style="margin-bottom: 5%;">
|
||||
<span>Your sincerely,</span><br>
|
||||
<span><b>For {{ doc.company }}</b></span>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 5%;">
|
||||
<span>{{ doc.closing_notes }}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span><b>________________</b></span><br>
|
||||
<span><b>{{ doc.applicant_name }}</b></span>
|
||||
</div>
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"align_labels_right": 0,
|
||||
"creation": "2019-12-26 15:22:44.200332",
|
||||
"custom_format": 0,
|
||||
"default_print_language": "en",
|
||||
"disabled": 0,
|
||||
"doc_type": "Appointment Letter",
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"font": "Default",
|
||||
"idx": 0,
|
||||
"line_breaks": 0,
|
||||
"modified": "2020-01-21 17:24:16.705082",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Standard Appointment Letter",
|
||||
"owner": "Administrator",
|
||||
"print_format_builder": 0,
|
||||
"print_format_type": "Jinja",
|
||||
"raw_printing": 0,
|
||||
"show_section_headings": 0,
|
||||
"standard": "Yes"
|
||||
}
|
@ -37,13 +37,22 @@ def execute(filters=None):
|
||||
|
||||
total_p = total_a = total_l = 0.0
|
||||
for day in range(filters["total_days_in_month"]):
|
||||
status = att_map.get(emp).get(day + 1, "None")
|
||||
status_map = {"Present": "P", "Absent": "A", "Half Day": "HD", "On Leave": "L", "None": "", "Holiday":"<b>H</b>"}
|
||||
if status == "None" and holiday_map:
|
||||
status = att_map.get(emp).get(day + 1)
|
||||
status_map = {
|
||||
"Absent": "A",
|
||||
"Half Day": "HD",
|
||||
"Holiday":"<b>H</b>",
|
||||
"On Leave": "L",
|
||||
"Present": "P",
|
||||
"Work From Home": "WFH"
|
||||
}
|
||||
|
||||
if status is None and holiday_map:
|
||||
emp_holiday_list = emp_det.holiday_list if emp_det.holiday_list else default_holiday_list
|
||||
if emp_holiday_list in holiday_map and (day+1) in holiday_map[emp_holiday_list]:
|
||||
status = "Holiday"
|
||||
row.append(status_map[status])
|
||||
|
||||
row.append(status_map.get(status, ""))
|
||||
|
||||
if status == "Present":
|
||||
total_p += 1
|
||||
@ -66,7 +75,7 @@ def execute(filters=None):
|
||||
|
||||
leave_details = frappe.db.sql("""select leave_type, status, count(*) as count from `tabAttendance`\
|
||||
where leave_type is not NULL %s group by leave_type, status""" % conditions, filters, as_dict=1)
|
||||
|
||||
|
||||
time_default_counts = frappe.db.sql("""select (select count(*) from `tabAttendance` where \
|
||||
late_entry = 1 %s) as late_entry_count, (select count(*) from tabAttendance where \
|
||||
early_exit = 1 %s) as early_exit_count""" % (conditions, conditions), filters)
|
||||
@ -85,7 +94,7 @@ def execute(filters=None):
|
||||
row.append(leaves[d])
|
||||
else:
|
||||
row.append("0.0")
|
||||
|
||||
|
||||
row.extend([time_default_counts[0][0],time_default_counts[0][1]])
|
||||
data.append(row)
|
||||
return columns, data
|
||||
|
@ -54,7 +54,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
email_map[d.sales_person] = sp.get_email_id()
|
||||
except frappe.ValidationError:
|
||||
no_email_sp.append(d.sales_person)
|
||||
|
||||
|
||||
if no_email_sp:
|
||||
frappe.msgprint(
|
||||
frappe._("Setting Events to {0}, since the Employee attached to the below Sales Persons does not have a User ID{1}").format(
|
||||
@ -66,7 +66,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
parent=%s""", (d.sales_person, d.item_code, self.name), as_dict=1)
|
||||
|
||||
for key in scheduled_date:
|
||||
description =frappe._("Reference: {0}, Item Code: {1} and Customer: {2}").format(self.name, d.item_code, self.customer)
|
||||
description =frappe._("Reference: {0}, Item Code: {1} and Customer: {2}").format(self.name, d.item_code, self.customer)
|
||||
frappe.get_doc({
|
||||
"doctype": "Event",
|
||||
"owner": email_map.get(d.sales_person, self.owner),
|
||||
@ -146,11 +146,11 @@ class MaintenanceSchedule(TransactionBase):
|
||||
if not d.item_code:
|
||||
throw(_("Please select item code"))
|
||||
elif not d.start_date or not d.end_date:
|
||||
throw(_("Please select Start Date and End Date for Item {0}".format(d.item_code)))
|
||||
throw(_("Please select Start Date and End Date for Item {0}").format(d.item_code))
|
||||
elif not d.no_of_visits:
|
||||
throw(_("Please mention no of visits required"))
|
||||
elif not d.sales_person:
|
||||
throw(_("Please select a Sales Person for item: {0}".format(d.item_name)))
|
||||
throw(_("Please select a Sales Person for item: {0}").format(d.item_name))
|
||||
|
||||
if getdate(d.start_date) >= getdate(d.end_date):
|
||||
throw(_("Start date should be less than end date for Item {0}").format(d.item_code))
|
||||
@ -193,7 +193,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
|
||||
if sr_details.amc_expiry_date and getdate(sr_details.amc_expiry_date) >= getdate(amc_start_date):
|
||||
throw(_("Serial No {0} is under maintenance contract upto {1}")
|
||||
.format(serial_no, sr_details.amc_start_date))
|
||||
.format(serial_no, sr_details.amc_expiry_date))
|
||||
|
||||
if not sr_details.warehouse and sr_details.delivery_date and \
|
||||
getdate(sr_details.delivery_date) >= getdate(amc_start_date):
|
||||
|
@ -8,7 +8,7 @@ import datetime
|
||||
from frappe import _
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import (flt, cint, time_diff_in_hours, get_datetime, getdate,
|
||||
from frappe.utils import (flt, cint, time_diff_in_hours, get_datetime, getdate,
|
||||
get_time, add_to_date, time_diff, add_days, get_datetime_str)
|
||||
|
||||
from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
|
||||
@ -43,7 +43,7 @@ class JobCard(Document):
|
||||
|
||||
def get_overlap_for(self, args, check_next_available_slot=False):
|
||||
production_capacity = 1
|
||||
|
||||
|
||||
if self.workstation:
|
||||
production_capacity = frappe.get_cached_value("Workstation",
|
||||
self.workstation, 'production_capacity') or 1
|
||||
@ -195,8 +195,8 @@ class JobCard(Document):
|
||||
frappe.throw(_("Total completed qty must be greater than zero"))
|
||||
|
||||
if self.total_completed_qty != self.for_quantity:
|
||||
frappe.throw(_("The total completed qty({0}) must be equal to qty to manufacture({1})"
|
||||
.format(frappe.bold(self.total_completed_qty),frappe.bold(self.for_quantity))))
|
||||
frappe.throw(_("The total completed qty({0}) must be equal to qty to manufacture({1})")
|
||||
.format(frappe.bold(self.total_completed_qty),frappe.bold(self.for_quantity)))
|
||||
|
||||
def update_work_order(self):
|
||||
if not self.work_order:
|
||||
@ -372,7 +372,7 @@ def get_job_details(start, end, filters=None):
|
||||
conditions = get_filters_cond("Job Card", filters, [])
|
||||
|
||||
job_cards = frappe.db.sql(""" SELECT `tabJob Card`.name, `tabJob Card`.work_order,
|
||||
`tabJob Card`.employee_name, `tabJob Card`.status, ifnull(`tabJob Card`.remarks, ''),
|
||||
`tabJob Card`.employee_name, `tabJob Card`.status, ifnull(`tabJob Card`.remarks, ''),
|
||||
min(`tabJob Card Time Log`.from_time) as from_time,
|
||||
max(`tabJob Card Time Log`.to_time) as to_time
|
||||
FROM `tabJob Card` , `tabJob Card Time Log`
|
||||
|
@ -22,7 +22,7 @@ class ProductionPlan(Document):
|
||||
def validate_data(self):
|
||||
for d in self.get('po_items'):
|
||||
if not d.bom_no:
|
||||
frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx)))
|
||||
frappe.throw(_("Please select BOM for Item in Row {0}").format(d.idx))
|
||||
else:
|
||||
validate_bom_no(d.item_code, d.bom_no)
|
||||
|
||||
|
@ -121,6 +121,15 @@ frappe.ui.form.on("Work Order", {
|
||||
}
|
||||
},
|
||||
|
||||
source_warehouse: function(frm) {
|
||||
if (frm.doc.source_warehouse) {
|
||||
frm.doc.required_items.forEach(d => {
|
||||
frappe.model.set_value(d.doctype, d.name,
|
||||
"source_warehouse", frm.doc.source_warehouse);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
erpnext.toggle_naming_series();
|
||||
erpnext.work_order.set_custom_buttons(frm);
|
||||
|
@ -29,9 +29,10 @@
|
||||
"from_wip_warehouse",
|
||||
"update_consumed_material_cost_in_project",
|
||||
"warehouses",
|
||||
"source_warehouse",
|
||||
"wip_warehouse",
|
||||
"fg_warehouse",
|
||||
"column_break_12",
|
||||
"fg_warehouse",
|
||||
"scrap_warehouse",
|
||||
"required_items_section",
|
||||
"required_items",
|
||||
@ -226,12 +227,14 @@
|
||||
"options": "fa fa-building"
|
||||
},
|
||||
{
|
||||
"description": "This is a location where operations are executed.",
|
||||
"fieldname": "wip_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"label": "Work-in-Progress Warehouse",
|
||||
"options": "Warehouse"
|
||||
},
|
||||
{
|
||||
"description": "This is a location where final product stored.",
|
||||
"fieldname": "fg_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"label": "Target Warehouse",
|
||||
@ -242,6 +245,7 @@
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"description": "This is a location where scraped materials are stored.",
|
||||
"fieldname": "scrap_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"label": "Scrap Warehouse",
|
||||
@ -463,6 +467,13 @@
|
||||
"fieldname": "update_consumed_material_cost_in_project",
|
||||
"fieldtype": "Check",
|
||||
"label": "Update Consumed Material Cost In Project"
|
||||
},
|
||||
{
|
||||
"description": "This is a location where raw materials are available.",
|
||||
"fieldname": "source_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"label": "Source Warehouse",
|
||||
"options": "Warehouse"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-cogs",
|
||||
@ -470,7 +481,7 @@
|
||||
"image_field": "image",
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2019-12-04 11:20:04.695123",
|
||||
"modified": "2020-01-31 12:46:23.636033",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Work Order",
|
||||
|
@ -461,7 +461,7 @@ class WorkOrder(Document):
|
||||
def validate_operation_time(self):
|
||||
for d in self.operations:
|
||||
if not d.time_in_mins > 0:
|
||||
frappe.throw(_("Operation Time must be greater than 0 for Operation {0}".format(d.operation)))
|
||||
frappe.throw(_("Operation Time must be greater than 0 for Operation {0}").format(d.operation))
|
||||
|
||||
def update_required_items(self):
|
||||
'''
|
||||
|
@ -656,3 +656,4 @@ erpnext.patches.v12_0.set_lead_title_field
|
||||
erpnext.patches.v12_0.set_permission_einvoicing
|
||||
erpnext.patches.v12_0.set_published_in_hub_tracked_item
|
||||
erpnext.patches.v12_0.set_job_offer_applicant_email
|
||||
erpnext.patches.v12_0.create_irs_1099_field_united_states
|
10
erpnext/patches/v12_0/create_irs_1099_field_united_states.py
Normal file
10
erpnext/patches/v12_0/create_irs_1099_field_united_states.py
Normal file
@ -0,0 +1,10 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.regional.united_states.setup import make_custom_fields
|
||||
|
||||
def execute():
|
||||
company = frappe.get_all('Company', filters = {'country': 'United States'})
|
||||
if not company:
|
||||
return
|
||||
|
||||
make_custom_fields()
|
@ -188,7 +188,7 @@ class Project(Document):
|
||||
def send_welcome_email(self):
|
||||
url = get_url("/project/?name={0}".format(self.name))
|
||||
messages = (
|
||||
_("You have been invited to collaborate on the project: {0}".format(self.name)),
|
||||
_("You have been invited to collaborate on the project: {0}").format(self.name),
|
||||
url,
|
||||
_("Join")
|
||||
)
|
||||
|
@ -50,7 +50,7 @@ $.extend(frappe.breadcrumbs.preferred, {
|
||||
"Territory": "Selling",
|
||||
"Sales Person": "Selling",
|
||||
"Sales Partner": "Selling",
|
||||
"Brand": "Selling"
|
||||
"Brand": "Stock"
|
||||
});
|
||||
|
||||
$.extend(frappe.breadcrumbs.module_map, {
|
||||
|
@ -15,7 +15,7 @@ class QualityProcedure(NestedSet):
|
||||
if process.procedure:
|
||||
doc = frappe.get_doc("Quality Procedure", process.procedure)
|
||||
if doc.parent_quality_procedure:
|
||||
frappe.throw(_("{0} already has a Parent Procedure {1}.".format(process.procedure, doc.parent_quality_procedure)))
|
||||
frappe.throw(_("{0} already has a Parent Procedure {1}.").format(process.procedure, doc.parent_quality_procedure))
|
||||
self.is_group = 1
|
||||
|
||||
def on_update(self):
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"autoname": "format:REV-{#####}",
|
||||
"creation": "2018-10-02 11:45:16.301955",
|
||||
"doctype": "DocType",
|
||||
@ -73,7 +74,8 @@
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"modified": "2019-05-26 23:12:47.302189",
|
||||
"links": [],
|
||||
"modified": "2020-02-01 10:59:38.933115",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Quality Management",
|
||||
"name": "Quality Review",
|
||||
@ -102,6 +104,18 @@
|
||||
"role": "All",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Quality Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
|
@ -1,24 +1,28 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"creation": "2018-10-16 12:28:43.651915",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2018-10-16 15:23:25.667237",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Quality Management",
|
||||
"name": "Review",
|
||||
"owner": "Administrator",
|
||||
"prepared_report": 0,
|
||||
"query": "SELECT\n `tabQuality Action`.name as \"Name:Data:200\",\n `tabQuality Action`.action as \"Action:Select/[corrective,Preventive]:200\",\n `tabQuality Action`.review as \"Review:Link/Quality Review:200\",\n `tabQuality Action`.date as \"Date:Date:120\",\n `tabQuality Action`.status as \"Status:Select/Planned:150\"\nFROM\n `tabQuality Action`\nWHERE\n `tabQuality Action`.type='Quality Review'\n \n ",
|
||||
"ref_doctype": "Quality Action",
|
||||
"report_name": "Review",
|
||||
"report_type": "Query Report",
|
||||
"add_total_row": 0,
|
||||
"creation": "2018-10-16 12:28:43.651915",
|
||||
"disable_prepared_report": 0,
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2020-02-01 11:03:23.816448",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Quality Management",
|
||||
"name": "Review",
|
||||
"owner": "Administrator",
|
||||
"prepared_report": 0,
|
||||
"query": "SELECT\n `tabQuality Action`.name as \"Name:Data:200\",\n `tabQuality Action`.corrective_preventive as \"Action:Select/[Corrective,Preventive]:200\",\n `tabQuality Action`.document_type as \"Document Type:Select/[Quality Review, Quality Feedback]:200\",\n `tabQuality Action`.date as \"Date:Date:120\",\n `tabQuality Action`.status as \"Status:Select/Planned:150\"\nFROM\n `tabQuality Action`\nWHERE\n `tabQuality Action`.document_type='Quality Review'\n \n ",
|
||||
"ref_doctype": "Quality Action",
|
||||
"report_name": "Review",
|
||||
"report_type": "Query Report",
|
||||
"roles": [
|
||||
{
|
||||
"role": "System Manager"
|
||||
},
|
||||
{
|
||||
"role": "Quality Manager"
|
||||
}
|
||||
]
|
||||
}
|
@ -9,7 +9,7 @@ from erpnext import get_region
|
||||
def check_deletion_permission(doc, method):
|
||||
region = get_region(doc.company)
|
||||
if region in ["Nepal", "France"] and doc.docstatus != 0:
|
||||
frappe.throw(_("Deletion is not permitted for country {0}".format(region)))
|
||||
frappe.throw(_("Deletion is not permitted for country {0}").format(region))
|
||||
|
||||
def create_transaction_log(doc, method):
|
||||
"""
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user