Merge branch 'develop' into fix-hsn_wise
This commit is contained in:
commit
e5ca9f3c1b
@ -8,6 +8,7 @@
|
|||||||
[](https://github.com/frappe/erpnext/actions/workflows/server-tests.yml)
|
[](https://github.com/frappe/erpnext/actions/workflows/server-tests.yml)
|
||||||
[](https://www.codetriage.com/frappe/erpnext)
|
[](https://www.codetriage.com/frappe/erpnext)
|
||||||
[](https://codecov.io/gh/frappe/erpnext)
|
[](https://codecov.io/gh/frappe/erpnext)
|
||||||
|
[](https://hub.docker.com/r/frappe/erpnext-worker)
|
||||||
|
|
||||||
[https://erpnext.com](https://erpnext.com)
|
[https://erpnext.com](https://erpnext.com)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import frappe
|
|||||||
|
|
||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
|
|
||||||
__version__ = '13.9.0'
|
__version__ = '14.0.0-dev'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -78,6 +78,7 @@ frappe.treeview_settings["Account"] = {
|
|||||||
const format = (value, currency) => format_currency(Math.abs(value), currency);
|
const format = (value, currency) => format_currency(Math.abs(value), currency);
|
||||||
|
|
||||||
if (account.balance!==undefined) {
|
if (account.balance!==undefined) {
|
||||||
|
node.parent && node.parent.find('.balance-area').remove();
|
||||||
$('<span class="balance-area pull-right">'
|
$('<span class="balance-area pull-right">'
|
||||||
+ (account.balance_in_account_currency ?
|
+ (account.balance_in_account_currency ?
|
||||||
(format(account.balance_in_account_currency, account.account_currency) + " / ") : "")
|
(format(account.balance_in_account_currency, account.account_currency) + " / ") : "")
|
||||||
@ -175,7 +176,7 @@ frappe.treeview_settings["Account"] = {
|
|||||||
&& node.expandable && !node.hide_add;
|
&& node.expandable && !node.hide_add;
|
||||||
},
|
},
|
||||||
click: function() {
|
click: function() {
|
||||||
var me = frappe.treeview_settings['Account'].treeview;
|
var me = frappe.views.trees['Account'];
|
||||||
me.new_node();
|
me.new_node();
|
||||||
},
|
},
|
||||||
btnClass: "hidden-xs"
|
btnClass: "hidden-xs"
|
||||||
|
@ -8,7 +8,7 @@ frappe.ui.form.on('Accounting Dimension Filter', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let help_content =
|
let help_content =
|
||||||
`<table class="table table-bordered" style="background-color: #f9f9f9;">
|
`<table class="table table-bordered" style="background-color: var(--scrollbar-track-color);">
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<p>
|
<p>
|
||||||
<i class="fa fa-hand-right"></i>
|
<i class="fa fa-hand-right"></i>
|
||||||
|
@ -19,6 +19,9 @@ class AccountsSettings(Document):
|
|||||||
frappe.db.set_default("add_taxes_from_item_tax_template",
|
frappe.db.set_default("add_taxes_from_item_tax_template",
|
||||||
self.get("add_taxes_from_item_tax_template", 0))
|
self.get("add_taxes_from_item_tax_template", 0))
|
||||||
|
|
||||||
|
frappe.db.set_default("enable_common_party_accounting",
|
||||||
|
self.get("enable_common_party_accounting", 0))
|
||||||
|
|
||||||
self.validate_stale_days()
|
self.validate_stale_days()
|
||||||
self.enable_payment_schedule_in_print()
|
self.enable_payment_schedule_in_print()
|
||||||
self.toggle_discount_accounting_fields()
|
self.toggle_discount_accounting_fields()
|
||||||
|
0
erpnext/accounts/doctype/advance_tax/__init__.py
Normal file
0
erpnext/accounts/doctype/advance_tax/__init__.py
Normal file
56
erpnext/accounts/doctype/advance_tax/advance_tax.json
Normal file
56
erpnext/accounts/doctype/advance_tax/advance_tax.json
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"allow_rename": 1,
|
||||||
|
"creation": "2021-11-25 10:24:39.836195",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"reference_type",
|
||||||
|
"reference_name",
|
||||||
|
"reference_detail",
|
||||||
|
"account_head",
|
||||||
|
"allocated_amount"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "reference_type",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Reference Type",
|
||||||
|
"options": "DocType"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "reference_name",
|
||||||
|
"fieldtype": "Dynamic Link",
|
||||||
|
"label": "Reference Name",
|
||||||
|
"options": "reference_type"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "reference_detail",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Reference Detail"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "account_head",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Account Head",
|
||||||
|
"options": "Account"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "allocated_amount",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"label": "Allocated Amount",
|
||||||
|
"options": "party_account_currency"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"index_web_pages_for_search": 1,
|
||||||
|
"istable": 1,
|
||||||
|
"links": [],
|
||||||
|
"modified": "2021-11-25 10:27:51.712286",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Accounts",
|
||||||
|
"name": "Advance Tax",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"permissions": [],
|
||||||
|
"sort_field": "modified",
|
||||||
|
"sort_order": "DESC"
|
||||||
|
}
|
9
erpnext/accounts/doctype/advance_tax/advance_tax.py
Normal file
9
erpnext/accounts/doctype/advance_tax/advance_tax.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
# import frappe
|
||||||
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
|
||||||
|
class AdvanceTax(Document):
|
||||||
|
pass
|
@ -25,8 +25,7 @@
|
|||||||
"allocated_amount",
|
"allocated_amount",
|
||||||
"column_break_13",
|
"column_break_13",
|
||||||
"base_tax_amount",
|
"base_tax_amount",
|
||||||
"base_total",
|
"base_total"
|
||||||
"base_allocated_amount"
|
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@ -168,12 +167,6 @@
|
|||||||
"label": "Allocated Amount",
|
"label": "Allocated Amount",
|
||||||
"options": "currency"
|
"options": "currency"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "base_allocated_amount",
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"label": "Allocated Amount (Company Currency)",
|
|
||||||
"options": "Company:company:default_currency"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fetch_from": "account_head.account_currency",
|
"fetch_from": "account_head.account_currency",
|
||||||
"fieldname": "currency",
|
"fieldname": "currency",
|
||||||
@ -186,7 +179,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-06-09 11:46:58.373170",
|
"modified": "2021-11-25 11:10:10.945027",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Advance Taxes and Charges",
|
"name": "Advance Taxes and Charges",
|
||||||
|
@ -434,7 +434,7 @@ def get_pi_matching_query(amount_condition):
|
|||||||
|
|
||||||
def get_ec_matching_query(bank_account, company, amount_condition):
|
def get_ec_matching_query(bank_account, company, amount_condition):
|
||||||
# get matching Expense Claim query
|
# get matching Expense Claim query
|
||||||
mode_of_payments = [x["parent"] for x in frappe.db.get_list("Mode of Payment Account",
|
mode_of_payments = [x["parent"] for x in frappe.db.get_all("Mode of Payment Account",
|
||||||
filters={"default_account": bank_account}, fields=["parent"])]
|
filters={"default_account": bank_account}, fields=["parent"])]
|
||||||
mode_of_payments = '(\'' + '\', \''.join(mode_of_payments) + '\' )'
|
mode_of_payments = '(\'' + '\', \''.join(mode_of_payments) + '\' )'
|
||||||
company_currency = get_company_currency(company)
|
company_currency = get_company_currency(company)
|
||||||
|
@ -6,7 +6,7 @@ frappe.provide("erpnext.accounts.dimensions");
|
|||||||
frappe.ui.form.on('Loyalty Program', {
|
frappe.ui.form.on('Loyalty Program', {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
var help_content =
|
var help_content =
|
||||||
`<table class="table table-bordered" style="background-color: #f9f9f9;">
|
`<table class="table table-bordered" style="background-color: var(--scrollbar-track-color);">
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<h4>
|
<h4>
|
||||||
<i class="fa fa-hand-right"></i>
|
<i class="fa fa-hand-right"></i>
|
||||||
|
@ -25,3 +25,17 @@ class PartyLink(Document):
|
|||||||
if existing_party_link:
|
if existing_party_link:
|
||||||
frappe.throw(_('{} {} is already linked with another {}')
|
frappe.throw(_('{} {} is already linked with another {}')
|
||||||
.format(self.primary_role, self.primary_party, existing_party_link[0]))
|
.format(self.primary_role, self.primary_party, existing_party_link[0]))
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def create_party_link(primary_role, primary_party, secondary_party):
|
||||||
|
party_link = frappe.new_doc('Party Link')
|
||||||
|
party_link.primary_role = primary_role
|
||||||
|
party_link.primary_party = primary_party
|
||||||
|
party_link.secondary_role = 'Customer' if primary_role == 'Supplier' else 'Supplier'
|
||||||
|
party_link.secondary_party = secondary_party
|
||||||
|
|
||||||
|
party_link.save(ignore_permissions=True)
|
||||||
|
|
||||||
|
return party_link
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@
|
|||||||
"taxes_and_charges_section",
|
"taxes_and_charges_section",
|
||||||
"purchase_taxes_and_charges_template",
|
"purchase_taxes_and_charges_template",
|
||||||
"sales_taxes_and_charges_template",
|
"sales_taxes_and_charges_template",
|
||||||
"advance_tax_account",
|
|
||||||
"column_break_55",
|
"column_break_55",
|
||||||
"apply_tax_withholding_amount",
|
"apply_tax_withholding_amount",
|
||||||
"tax_withholding_category",
|
"tax_withholding_category",
|
||||||
@ -685,15 +684,6 @@
|
|||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hide_border": 1
|
"hide_border": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"depends_on": "eval:doc.apply_tax_withholding_amount",
|
|
||||||
"description": "Provisional tax account for advance tax. Taxes are parked in this account until payments are allocated to invoices",
|
|
||||||
"fieldname": "advance_tax_account",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"label": "Advance Tax Account",
|
|
||||||
"mandatory_depends_on": "eval:doc.apply_tax_withholding_amount",
|
|
||||||
"options": "Account"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.received_amount && doc.payment_type != 'Internal Transfer'",
|
"depends_on": "eval:doc.received_amount && doc.payment_type != 'Internal Transfer'",
|
||||||
"fieldname": "received_amount_after_tax",
|
"fieldname": "received_amount_after_tax",
|
||||||
@ -730,7 +720,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-10-22 17:50:24.632806",
|
"modified": "2021-11-24 18:58:24.919764",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Entry",
|
"name": "Payment Entry",
|
||||||
|
@ -20,7 +20,7 @@ from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_ban
|
|||||||
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
|
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
|
||||||
get_party_tax_withholding_details,
|
get_party_tax_withholding_details,
|
||||||
)
|
)
|
||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries, process_gl_map
|
||||||
from erpnext.accounts.party import get_party_account
|
from erpnext.accounts.party import get_party_account
|
||||||
from erpnext.accounts.utils import get_account_currency, get_balance_on, get_outstanding_invoices
|
from erpnext.accounts.utils import get_account_currency, get_balance_on, get_outstanding_invoices
|
||||||
from erpnext.controllers.accounts_controller import (
|
from erpnext.controllers.accounts_controller import (
|
||||||
@ -339,7 +339,7 @@ class PaymentEntry(AccountsController):
|
|||||||
for k, v in no_oustanding_refs.items():
|
for k, v in no_oustanding_refs.items():
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_("{} - {} now have {} as they had no outstanding amount left before submitting the Payment Entry.")
|
_("{} - {} now have {} as they had no outstanding amount left before submitting the Payment Entry.")
|
||||||
.format(k, frappe.bold(", ".join(d.reference_name for d in v)), frappe.bold("negative outstanding amount"))
|
.format(_(k), frappe.bold(", ".join(d.reference_name for d in v)), frappe.bold(_("negative outstanding amount")))
|
||||||
+ "<br><br>" + _("If this is undesirable please cancel the corresponding Payment Entry."),
|
+ "<br><br>" + _("If this is undesirable please cancel the corresponding Payment Entry."),
|
||||||
title=_("Warning"), indicator="orange")
|
title=_("Warning"), indicator="orange")
|
||||||
|
|
||||||
@ -433,23 +433,12 @@ class PaymentEntry(AccountsController):
|
|||||||
if not self.apply_tax_withholding_amount:
|
if not self.apply_tax_withholding_amount:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.advance_tax_account:
|
|
||||||
frappe.throw(_("Advance TDS account is mandatory for advance TDS deduction"))
|
|
||||||
|
|
||||||
net_total = self.paid_amount
|
net_total = self.paid_amount
|
||||||
|
|
||||||
for reference in self.get("references"):
|
|
||||||
net_total_for_tds = 0
|
|
||||||
if reference.reference_doctype == 'Purchase Order':
|
|
||||||
net_total_for_tds += flt(frappe.db.get_value('Purchase Order', reference.reference_name, 'net_total'))
|
|
||||||
|
|
||||||
if net_total_for_tds:
|
|
||||||
net_total = net_total_for_tds
|
|
||||||
|
|
||||||
# Adding args as purchase invoice to get TDS amount
|
# Adding args as purchase invoice to get TDS amount
|
||||||
args = frappe._dict({
|
args = frappe._dict({
|
||||||
'company': self.company,
|
'company': self.company,
|
||||||
'doctype': 'Purchase Invoice',
|
'doctype': 'Payment Entry',
|
||||||
'supplier': self.party,
|
'supplier': self.party,
|
||||||
'posting_date': self.posting_date,
|
'posting_date': self.posting_date,
|
||||||
'net_total': net_total
|
'net_total': net_total
|
||||||
@ -461,7 +450,6 @@ class PaymentEntry(AccountsController):
|
|||||||
return
|
return
|
||||||
|
|
||||||
tax_withholding_details.update({
|
tax_withholding_details.update({
|
||||||
'add_deduct_tax': 'Add',
|
|
||||||
'cost_center': self.cost_center or erpnext.get_default_cost_center(self.company)
|
'cost_center': self.cost_center or erpnext.get_default_cost_center(self.company)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -623,7 +611,7 @@ class PaymentEntry(AccountsController):
|
|||||||
|
|
||||||
if not total_negative_outstanding:
|
if not total_negative_outstanding:
|
||||||
frappe.throw(_("Cannot {0} {1} {2} without any negative outstanding invoice")
|
frappe.throw(_("Cannot {0} {1} {2} without any negative outstanding invoice")
|
||||||
.format(self.payment_type, ("to" if self.party_type=="Customer" else "from"),
|
.format(_(self.payment_type), (_("to") if self.party_type=="Customer" else _("from")),
|
||||||
self.party_type), InvalidPaymentEntry)
|
self.party_type), InvalidPaymentEntry)
|
||||||
|
|
||||||
elif paid_amount - additional_charges > total_negative_outstanding:
|
elif paid_amount - additional_charges > total_negative_outstanding:
|
||||||
@ -689,6 +677,7 @@ class PaymentEntry(AccountsController):
|
|||||||
self.add_deductions_gl_entries(gl_entries)
|
self.add_deductions_gl_entries(gl_entries)
|
||||||
self.add_tax_gl_entries(gl_entries)
|
self.add_tax_gl_entries(gl_entries)
|
||||||
|
|
||||||
|
gl_entries = process_gl_map(gl_entries)
|
||||||
make_gl_entries(gl_entries, cancel=cancel, adv_adj=adv_adj)
|
make_gl_entries(gl_entries, cancel=cancel, adv_adj=adv_adj)
|
||||||
|
|
||||||
def add_party_gl_entries(self, gl_entries):
|
def add_party_gl_entries(self, gl_entries):
|
||||||
@ -752,7 +741,8 @@ class PaymentEntry(AccountsController):
|
|||||||
"against": self.party if self.payment_type=="Pay" else self.paid_to,
|
"against": self.party if self.payment_type=="Pay" else self.paid_to,
|
||||||
"credit_in_account_currency": self.paid_amount,
|
"credit_in_account_currency": self.paid_amount,
|
||||||
"credit": self.base_paid_amount,
|
"credit": self.base_paid_amount,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center,
|
||||||
|
"post_net_value": True
|
||||||
}, item=self)
|
}, item=self)
|
||||||
)
|
)
|
||||||
if self.payment_type in ("Receive", "Internal Transfer"):
|
if self.payment_type in ("Receive", "Internal Transfer"):
|
||||||
@ -782,14 +772,10 @@ class PaymentEntry(AccountsController):
|
|||||||
rev_dr_or_cr = "credit" if dr_or_cr == "debit" else "debit"
|
rev_dr_or_cr = "credit" if dr_or_cr == "debit" else "debit"
|
||||||
against = self.party or self.paid_to
|
against = self.party or self.paid_to
|
||||||
|
|
||||||
payment_or_advance_account = self.get_party_account_for_taxes()
|
payment_account = self.get_party_account_for_taxes()
|
||||||
tax_amount = d.tax_amount
|
tax_amount = d.tax_amount
|
||||||
base_tax_amount = d.base_tax_amount
|
base_tax_amount = d.base_tax_amount
|
||||||
|
|
||||||
if self.advance_tax_account:
|
|
||||||
tax_amount = -1 * tax_amount
|
|
||||||
base_tax_amount = -1 * base_tax_amount
|
|
||||||
|
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": d.account_head,
|
"account": d.account_head,
|
||||||
@ -798,19 +784,21 @@ class PaymentEntry(AccountsController):
|
|||||||
dr_or_cr + "_in_account_currency": base_tax_amount
|
dr_or_cr + "_in_account_currency": base_tax_amount
|
||||||
if account_currency==self.company_currency
|
if account_currency==self.company_currency
|
||||||
else d.tax_amount,
|
else d.tax_amount,
|
||||||
"cost_center": d.cost_center
|
"cost_center": d.cost_center,
|
||||||
|
"post_net_value": True,
|
||||||
}, account_currency, item=d))
|
}, account_currency, item=d))
|
||||||
|
|
||||||
if not d.included_in_paid_amount or self.advance_tax_account:
|
if not d.included_in_paid_amount:
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": payment_or_advance_account,
|
"account": payment_account,
|
||||||
"against": against,
|
"against": against,
|
||||||
rev_dr_or_cr: tax_amount,
|
rev_dr_or_cr: tax_amount,
|
||||||
rev_dr_or_cr + "_in_account_currency": base_tax_amount
|
rev_dr_or_cr + "_in_account_currency": base_tax_amount
|
||||||
if account_currency==self.company_currency
|
if account_currency==self.company_currency
|
||||||
else d.tax_amount,
|
else d.tax_amount,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
|
"post_net_value": True,
|
||||||
}, account_currency, item=d))
|
}, account_currency, item=d))
|
||||||
|
|
||||||
def add_deductions_gl_entries(self, gl_entries):
|
def add_deductions_gl_entries(self, gl_entries):
|
||||||
@ -832,9 +820,7 @@ class PaymentEntry(AccountsController):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_party_account_for_taxes(self):
|
def get_party_account_for_taxes(self):
|
||||||
if self.advance_tax_account:
|
if self.payment_type == 'Receive':
|
||||||
return self.advance_tax_account
|
|
||||||
elif self.payment_type == 'Receive':
|
|
||||||
return self.paid_to
|
return self.paid_to
|
||||||
elif self.payment_type in ('Pay', 'Internal Transfer'):
|
elif self.payment_type in ('Pay', 'Internal Transfer'):
|
||||||
return self.paid_from
|
return self.paid_from
|
||||||
@ -1106,7 +1092,7 @@ def get_outstanding_reference_documents(args):
|
|||||||
|
|
||||||
if not data:
|
if not data:
|
||||||
frappe.msgprint(_("No outstanding invoices found for the {0} {1} which qualify the filters you have specified.")
|
frappe.msgprint(_("No outstanding invoices found for the {0} {1} which qualify the filters you have specified.")
|
||||||
.format(args.get("party_type").lower(), frappe.bold(args.get("party"))))
|
.format(_(args.get("party_type")).lower(), frappe.bold(args.get("party"))))
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@ -1599,13 +1585,6 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
|||||||
})
|
})
|
||||||
pe.set_difference_amount()
|
pe.set_difference_amount()
|
||||||
|
|
||||||
if doc.doctype == 'Purchase Order' and doc.apply_tds:
|
|
||||||
pe.apply_tax_withholding_amount = 1
|
|
||||||
pe.tax_withholding_category = doc.tax_withholding_category
|
|
||||||
|
|
||||||
if not pe.advance_tax_account:
|
|
||||||
pe.advance_tax_account = frappe.db.get_value('Company', pe.company, 'unrealized_profit_loss_account')
|
|
||||||
|
|
||||||
return pe
|
return pe
|
||||||
|
|
||||||
def get_bank_cash_account(doc, bank_account):
|
def get_bank_cash_account(doc, bank_account):
|
||||||
|
@ -548,10 +548,14 @@ def make_payment_order(source_name, target_doc=None):
|
|||||||
|
|
||||||
return doclist
|
return doclist
|
||||||
|
|
||||||
def validate_payment(doc, method=""):
|
def validate_payment(doc, method=None):
|
||||||
if not frappe.db.has_column(doc.reference_doctype, 'status'):
|
if doc.reference_doctype != "Payment Request" or (
|
||||||
|
frappe.db.get_value(doc.reference_doctype, doc.reference_docname, 'status')
|
||||||
|
!= "Paid"
|
||||||
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
status = frappe.db.get_value(doc.reference_doctype, doc.reference_docname, 'status')
|
frappe.throw(
|
||||||
if status == 'Paid':
|
_("The Payment Request {0} is already paid, cannot process payment twice")
|
||||||
frappe.throw(_("The Payment Request {0} is already paid, cannot process payment twice").format(doc.reference_docname))
|
.format(doc.reference_docname)
|
||||||
|
)
|
||||||
|
@ -88,9 +88,10 @@ class PeriodClosingVoucher(AccountsController):
|
|||||||
|
|
||||||
for acc in pl_accounts:
|
for acc in pl_accounts:
|
||||||
if flt(acc.bal_in_company_currency):
|
if flt(acc.bal_in_company_currency):
|
||||||
|
cost_center = acc.cost_center if self.cost_center_wise_pnl else company_cost_center
|
||||||
gl_entry = self.get_gl_dict({
|
gl_entry = self.get_gl_dict({
|
||||||
"account": self.closing_account_head,
|
"account": self.closing_account_head,
|
||||||
"cost_center": acc.cost_center or company_cost_center,
|
"cost_center": cost_center,
|
||||||
"finance_book": acc.finance_book,
|
"finance_book": acc.finance_book,
|
||||||
"account_currency": acc.account_currency,
|
"account_currency": acc.account_currency,
|
||||||
"debit_in_account_currency": abs(flt(acc.bal_in_account_currency)) if flt(acc.bal_in_account_currency) > 0 else 0,
|
"debit_in_account_currency": abs(flt(acc.bal_in_account_currency)) if flt(acc.bal_in_account_currency) > 0 else 0,
|
||||||
|
@ -66,8 +66,8 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
|||||||
company = create_company()
|
company = create_company()
|
||||||
surplus_account = create_account()
|
surplus_account = create_account()
|
||||||
|
|
||||||
cost_center1 = create_cost_center("Test Cost Center 1")
|
cost_center1 = create_cost_center("Main")
|
||||||
cost_center2 = create_cost_center("Test Cost Center 2")
|
cost_center2 = create_cost_center("Western Branch")
|
||||||
|
|
||||||
create_sales_invoice(
|
create_sales_invoice(
|
||||||
company=company,
|
company=company,
|
||||||
@ -86,7 +86,10 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
|||||||
debit_to="Debtors - TPC"
|
debit_to="Debtors - TPC"
|
||||||
)
|
)
|
||||||
|
|
||||||
pcv = self.make_period_closing_voucher()
|
pcv = self.make_period_closing_voucher(submit=False)
|
||||||
|
pcv.cost_center_wise_pnl = 1
|
||||||
|
pcv.save()
|
||||||
|
pcv.submit()
|
||||||
surplus_account = pcv.closing_account_head
|
surplus_account = pcv.closing_account_head
|
||||||
|
|
||||||
expected_gle = (
|
expected_gle = (
|
||||||
@ -149,7 +152,7 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(pcv_gle, expected_gle)
|
self.assertEqual(pcv_gle, expected_gle)
|
||||||
|
|
||||||
def make_period_closing_voucher(self):
|
def make_period_closing_voucher(self, submit=True):
|
||||||
surplus_account = create_account()
|
surplus_account = create_account()
|
||||||
cost_center = create_cost_center("Test Cost Center 1")
|
cost_center = create_cost_center("Test Cost Center 1")
|
||||||
pcv = frappe.get_doc({
|
pcv = frappe.get_doc({
|
||||||
@ -163,7 +166,8 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
|||||||
"remarks": "test"
|
"remarks": "test"
|
||||||
})
|
})
|
||||||
pcv.insert()
|
pcv.insert()
|
||||||
pcv.submit()
|
if submit:
|
||||||
|
pcv.submit()
|
||||||
|
|
||||||
return pcv
|
return pcv
|
||||||
|
|
||||||
|
@ -110,9 +110,15 @@ class POSInvoiceMergeLog(Document):
|
|||||||
|
|
||||||
def merge_pos_invoice_into(self, invoice, data):
|
def merge_pos_invoice_into(self, invoice, data):
|
||||||
items, payments, taxes = [], [], []
|
items, payments, taxes = [], [], []
|
||||||
|
|
||||||
loyalty_amount_sum, loyalty_points_sum = 0, 0
|
loyalty_amount_sum, loyalty_points_sum = 0, 0
|
||||||
|
|
||||||
rounding_adjustment, base_rounding_adjustment = 0, 0
|
rounding_adjustment, base_rounding_adjustment = 0, 0
|
||||||
rounded_total, base_rounded_total = 0, 0
|
rounded_total, base_rounded_total = 0, 0
|
||||||
|
|
||||||
|
loyalty_amount_sum, loyalty_points_sum, idx = 0, 0, 1
|
||||||
|
|
||||||
|
|
||||||
for doc in data:
|
for doc in data:
|
||||||
map_doc(doc, invoice, table_map={ "doctype": invoice.doctype })
|
map_doc(doc, invoice, table_map={ "doctype": invoice.doctype })
|
||||||
|
|
||||||
@ -146,6 +152,8 @@ class POSInvoiceMergeLog(Document):
|
|||||||
found = True
|
found = True
|
||||||
if not found:
|
if not found:
|
||||||
tax.charge_type = 'Actual'
|
tax.charge_type = 'Actual'
|
||||||
|
tax.idx = idx
|
||||||
|
idx += 1
|
||||||
tax.included_in_print_rate = 0
|
tax.included_in_print_rate = 0
|
||||||
tax.tax_amount = tax.tax_amount_after_discount_amount
|
tax.tax_amount = tax.tax_amount_after_discount_amount
|
||||||
tax.base_tax_amount = tax.base_tax_amount_after_discount_amount
|
tax.base_tax_amount = tax.base_tax_amount_after_discount_amount
|
||||||
@ -163,8 +171,8 @@ class POSInvoiceMergeLog(Document):
|
|||||||
payments.append(payment)
|
payments.append(payment)
|
||||||
rounding_adjustment += doc.rounding_adjustment
|
rounding_adjustment += doc.rounding_adjustment
|
||||||
rounded_total += doc.rounded_total
|
rounded_total += doc.rounded_total
|
||||||
base_rounding_adjustment += doc.rounding_adjustment
|
base_rounding_adjustment += doc.base_rounding_adjustment
|
||||||
base_rounded_total += doc.rounded_total
|
base_rounded_total += doc.base_rounded_total
|
||||||
|
|
||||||
|
|
||||||
if loyalty_points_sum:
|
if loyalty_points_sum:
|
||||||
@ -176,9 +184,9 @@ class POSInvoiceMergeLog(Document):
|
|||||||
invoice.set('payments', payments)
|
invoice.set('payments', payments)
|
||||||
invoice.set('taxes', taxes)
|
invoice.set('taxes', taxes)
|
||||||
invoice.set('rounding_adjustment',rounding_adjustment)
|
invoice.set('rounding_adjustment',rounding_adjustment)
|
||||||
invoice.set('rounding_adjustment',base_rounding_adjustment)
|
invoice.set('base_rounding_adjustment',base_rounding_adjustment)
|
||||||
invoice.set('base_rounded_total',base_rounded_total)
|
|
||||||
invoice.set('rounded_total',rounded_total)
|
invoice.set('rounded_total',rounded_total)
|
||||||
|
invoice.set('base_rounded_total',base_rounded_total)
|
||||||
invoice.additional_discount_percentage = 0
|
invoice.additional_discount_percentage = 0
|
||||||
invoice.discount_amount = 0.0
|
invoice.discount_amount = 0.0
|
||||||
invoice.taxes_and_charges = None
|
invoice.taxes_and_charges = None
|
||||||
|
@ -38,7 +38,7 @@ frappe.ui.form.on('Pricing Rule', {
|
|||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
var help_content =
|
var help_content =
|
||||||
`<table class="table table-bordered" style="background-color: #f9f9f9;">
|
`<table class="table table-bordered" style="background-color: var(--scrollbar-track-color);">
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<h4>
|
<h4>
|
||||||
<i class="fa fa-hand-right"></i>
|
<i class="fa fa-hand-right"></i>
|
||||||
|
@ -543,6 +543,75 @@ class TestPricingRule(unittest.TestCase):
|
|||||||
frappe.get_doc("Item Price", {"item_code": "Water Flask"}).delete()
|
frappe.get_doc("Item Price", {"item_code": "Water Flask"}).delete()
|
||||||
item.delete()
|
item.delete()
|
||||||
|
|
||||||
|
def test_pricing_rule_for_different_currency(self):
|
||||||
|
make_item("Test Sanitizer Item")
|
||||||
|
|
||||||
|
pricing_rule_record = {
|
||||||
|
"doctype": "Pricing Rule",
|
||||||
|
"title": "_Test Sanitizer Rule",
|
||||||
|
"apply_on": "Item Code",
|
||||||
|
"items": [{
|
||||||
|
"item_code": "Test Sanitizer Item",
|
||||||
|
}],
|
||||||
|
"selling": 1,
|
||||||
|
"currency": "INR",
|
||||||
|
"rate_or_discount": "Rate",
|
||||||
|
"rate": 0,
|
||||||
|
"priority": 2,
|
||||||
|
"margin_type": "Percentage",
|
||||||
|
"margin_rate_or_amount": 0.0,
|
||||||
|
"company": "_Test Company"
|
||||||
|
}
|
||||||
|
|
||||||
|
rule = frappe.get_doc(pricing_rule_record)
|
||||||
|
rule.rate_or_discount = 'Rate'
|
||||||
|
rule.rate = 100.0
|
||||||
|
rule.insert()
|
||||||
|
|
||||||
|
rule1 = frappe.get_doc(pricing_rule_record)
|
||||||
|
rule1.currency = 'USD'
|
||||||
|
rule1.rate_or_discount = 'Rate'
|
||||||
|
rule1.rate = 2.0
|
||||||
|
rule1.priority = 1
|
||||||
|
rule1.insert()
|
||||||
|
|
||||||
|
args = frappe._dict({
|
||||||
|
"item_code": "Test Sanitizer Item",
|
||||||
|
"company": "_Test Company",
|
||||||
|
"price_list": "_Test Price List",
|
||||||
|
"currency": "USD",
|
||||||
|
"doctype": "Sales Invoice",
|
||||||
|
"conversion_rate": 1,
|
||||||
|
"price_list_currency": "_Test Currency",
|
||||||
|
"plc_conversion_rate": 1,
|
||||||
|
"order_type": "Sales",
|
||||||
|
"customer": "_Test Customer",
|
||||||
|
"name": None,
|
||||||
|
"transaction_date": frappe.utils.nowdate()
|
||||||
|
})
|
||||||
|
|
||||||
|
details = get_item_details(args)
|
||||||
|
self.assertEqual(details.price_list_rate, 2.0)
|
||||||
|
|
||||||
|
|
||||||
|
args = frappe._dict({
|
||||||
|
"item_code": "Test Sanitizer Item",
|
||||||
|
"company": "_Test Company",
|
||||||
|
"price_list": "_Test Price List",
|
||||||
|
"currency": "INR",
|
||||||
|
"doctype": "Sales Invoice",
|
||||||
|
"conversion_rate": 1,
|
||||||
|
"price_list_currency": "_Test Currency",
|
||||||
|
"plc_conversion_rate": 1,
|
||||||
|
"order_type": "Sales",
|
||||||
|
"customer": "_Test Customer",
|
||||||
|
"name": None,
|
||||||
|
"transaction_date": frappe.utils.nowdate()
|
||||||
|
})
|
||||||
|
|
||||||
|
details = get_item_details(args)
|
||||||
|
self.assertEqual(details.price_list_rate, 100.0)
|
||||||
|
|
||||||
def test_pricing_rule_for_transaction(self):
|
def test_pricing_rule_for_transaction(self):
|
||||||
make_item("Water Flask 1")
|
make_item("Water Flask 1")
|
||||||
frappe.delete_doc_if_exists('Pricing Rule', '_Test Pricing Rule')
|
frappe.delete_doc_if_exists('Pricing Rule', '_Test Pricing Rule')
|
||||||
|
@ -264,6 +264,11 @@ def filter_pricing_rules(args, pricing_rules, doc=None):
|
|||||||
else:
|
else:
|
||||||
p.variant_of = None
|
p.variant_of = None
|
||||||
|
|
||||||
|
if len(pricing_rules) > 1:
|
||||||
|
filtered_rules = list(filter(lambda x: x.currency==args.get('currency'), pricing_rules))
|
||||||
|
if filtered_rules:
|
||||||
|
pricing_rules = filtered_rules
|
||||||
|
|
||||||
# find pricing rule with highest priority
|
# find pricing rule with highest priority
|
||||||
if pricing_rules:
|
if pricing_rules:
|
||||||
max_priority = max(cint(p.priority) for p in pricing_rules)
|
max_priority = max(cint(p.priority) for p in pricing_rules)
|
||||||
|
@ -20,6 +20,9 @@ price_discount_fields = ['rate_or_discount', 'apply_discount_on', 'apply_discoun
|
|||||||
product_discount_fields = ['free_item', 'free_qty', 'free_item_uom',
|
product_discount_fields = ['free_item', 'free_qty', 'free_item_uom',
|
||||||
'free_item_rate', 'same_item', 'is_recursive', 'apply_multiple_pricing_rules']
|
'free_item_rate', 'same_item', 'is_recursive', 'apply_multiple_pricing_rules']
|
||||||
|
|
||||||
|
class TransactionExists(frappe.ValidationError):
|
||||||
|
pass
|
||||||
|
|
||||||
class PromotionalScheme(Document):
|
class PromotionalScheme(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if not self.selling and not self.buying:
|
if not self.selling and not self.buying:
|
||||||
@ -28,6 +31,40 @@ class PromotionalScheme(Document):
|
|||||||
or self.product_discount_slabs):
|
or self.product_discount_slabs):
|
||||||
frappe.throw(_("Price or product discount slabs are required"))
|
frappe.throw(_("Price or product discount slabs are required"))
|
||||||
|
|
||||||
|
self.validate_applicable_for()
|
||||||
|
self.validate_pricing_rules()
|
||||||
|
|
||||||
|
def validate_applicable_for(self):
|
||||||
|
if self.applicable_for:
|
||||||
|
applicable_for = frappe.scrub(self.applicable_for)
|
||||||
|
|
||||||
|
if not self.get(applicable_for):
|
||||||
|
msg = (f'The field {frappe.bold(self.applicable_for)} is required')
|
||||||
|
frappe.throw(_(msg))
|
||||||
|
|
||||||
|
def validate_pricing_rules(self):
|
||||||
|
if self.is_new():
|
||||||
|
return
|
||||||
|
|
||||||
|
transaction_exists = False
|
||||||
|
docnames = []
|
||||||
|
|
||||||
|
# If user has changed applicable for
|
||||||
|
if self._doc_before_save.applicable_for == self.applicable_for:
|
||||||
|
return
|
||||||
|
|
||||||
|
docnames = frappe.get_all('Pricing Rule',
|
||||||
|
filters= {'promotional_scheme': self.name})
|
||||||
|
|
||||||
|
for docname in docnames:
|
||||||
|
if frappe.db.exists('Pricing Rule Detail',
|
||||||
|
{'pricing_rule': docname.name, 'docstatus': ('<', 2)}):
|
||||||
|
raise_for_transaction_exists(self.name)
|
||||||
|
|
||||||
|
if docnames and not transaction_exists:
|
||||||
|
for docname in docnames:
|
||||||
|
frappe.delete_doc('Pricing Rule', docname.name)
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
pricing_rules = frappe.get_all(
|
pricing_rules = frappe.get_all(
|
||||||
'Pricing Rule',
|
'Pricing Rule',
|
||||||
@ -67,6 +104,13 @@ class PromotionalScheme(Document):
|
|||||||
{'promotional_scheme': self.name}):
|
{'promotional_scheme': self.name}):
|
||||||
frappe.delete_doc('Pricing Rule', rule.name)
|
frappe.delete_doc('Pricing Rule', rule.name)
|
||||||
|
|
||||||
|
def raise_for_transaction_exists(name):
|
||||||
|
msg = (f"""You can't change the {frappe.bold(_('Applicable For'))}
|
||||||
|
because transactions are present against the Promotional Scheme {frappe.bold(name)}. """)
|
||||||
|
msg += 'Kindly disable this Promotional Scheme and create new for new Applicable For.'
|
||||||
|
|
||||||
|
frappe.throw(_(msg), TransactionExists)
|
||||||
|
|
||||||
def get_pricing_rules(doc, rules=None):
|
def get_pricing_rules(doc, rules=None):
|
||||||
if rules is None:
|
if rules is None:
|
||||||
rules = {}
|
rules = {}
|
||||||
@ -84,45 +128,59 @@ def _get_pricing_rules(doc, child_doc, discount_fields, rules=None):
|
|||||||
new_doc = []
|
new_doc = []
|
||||||
args = get_args_for_pricing_rule(doc)
|
args = get_args_for_pricing_rule(doc)
|
||||||
applicable_for = frappe.scrub(doc.get('applicable_for'))
|
applicable_for = frappe.scrub(doc.get('applicable_for'))
|
||||||
|
|
||||||
for idx, d in enumerate(doc.get(child_doc)):
|
for idx, d in enumerate(doc.get(child_doc)):
|
||||||
if d.name in rules:
|
if d.name in rules:
|
||||||
for applicable_for_value in args.get(applicable_for):
|
if not args.get(applicable_for):
|
||||||
temp_args = args.copy()
|
docname = get_pricing_rule_docname(d)
|
||||||
docname = frappe.get_all(
|
pr = prepare_pricing_rule(args, doc, child_doc, discount_fields, d, docname)
|
||||||
'Pricing Rule',
|
|
||||||
fields = ["promotional_scheme_id", "name", applicable_for],
|
|
||||||
filters = {
|
|
||||||
'promotional_scheme_id': d.name,
|
|
||||||
applicable_for: applicable_for_value
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if docname:
|
|
||||||
pr = frappe.get_doc('Pricing Rule', docname[0].get('name'))
|
|
||||||
temp_args[applicable_for] = applicable_for_value
|
|
||||||
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
|
||||||
else:
|
|
||||||
pr = frappe.new_doc("Pricing Rule")
|
|
||||||
pr.title = doc.name
|
|
||||||
temp_args[applicable_for] = applicable_for_value
|
|
||||||
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
|
||||||
|
|
||||||
new_doc.append(pr)
|
new_doc.append(pr)
|
||||||
|
else:
|
||||||
|
for applicable_for_value in args.get(applicable_for):
|
||||||
|
docname = get_pricing_rule_docname(d, applicable_for, applicable_for_value)
|
||||||
|
pr = prepare_pricing_rule(args, doc, child_doc, discount_fields,
|
||||||
|
d, docname, applicable_for, applicable_for_value)
|
||||||
|
new_doc.append(pr)
|
||||||
|
|
||||||
else:
|
elif args.get(applicable_for):
|
||||||
applicable_for_values = args.get(applicable_for) or []
|
applicable_for_values = args.get(applicable_for) or []
|
||||||
for applicable_for_value in applicable_for_values:
|
for applicable_for_value in applicable_for_values:
|
||||||
pr = frappe.new_doc("Pricing Rule")
|
pr = prepare_pricing_rule(args, doc, child_doc, discount_fields,
|
||||||
pr.title = doc.name
|
d, applicable_for=applicable_for, value= applicable_for_value)
|
||||||
temp_args = args.copy()
|
|
||||||
temp_args[applicable_for] = applicable_for_value
|
|
||||||
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
|
||||||
new_doc.append(pr)
|
new_doc.append(pr)
|
||||||
|
else:
|
||||||
|
pr = prepare_pricing_rule(args, doc, child_doc, discount_fields, d)
|
||||||
|
new_doc.append(pr)
|
||||||
|
|
||||||
return new_doc
|
return new_doc
|
||||||
|
|
||||||
|
def get_pricing_rule_docname(row: dict, applicable_for: str = None, applicable_for_value: str = None) -> str:
|
||||||
|
fields = ['promotional_scheme_id', 'name']
|
||||||
|
filters = {
|
||||||
|
'promotional_scheme_id': row.name
|
||||||
|
}
|
||||||
|
|
||||||
|
if applicable_for:
|
||||||
|
fields.append(applicable_for)
|
||||||
|
filters[applicable_for] = applicable_for_value
|
||||||
|
|
||||||
|
docname = frappe.get_all('Pricing Rule', fields = fields, filters = filters)
|
||||||
|
return docname[0].name if docname else ''
|
||||||
|
|
||||||
|
def prepare_pricing_rule(args, doc, child_doc, discount_fields, d, docname=None, applicable_for=None, value=None):
|
||||||
|
if docname:
|
||||||
|
pr = frappe.get_doc("Pricing Rule", docname)
|
||||||
|
else:
|
||||||
|
pr = frappe.new_doc("Pricing Rule")
|
||||||
|
|
||||||
|
pr.title = doc.name
|
||||||
|
temp_args = args.copy()
|
||||||
|
|
||||||
|
if value:
|
||||||
|
temp_args[applicable_for] = value
|
||||||
|
|
||||||
|
return set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
||||||
|
|
||||||
def set_args(args, pr, doc, child_doc, discount_fields, child_doc_fields):
|
def set_args(args, pr, doc, child_doc, discount_fields, child_doc_fields):
|
||||||
pr.update(args)
|
pr.update(args)
|
||||||
@ -145,6 +203,7 @@ def set_args(args, pr, doc, child_doc, discount_fields, child_doc_fields):
|
|||||||
apply_on: d.get(apply_on),
|
apply_on: d.get(apply_on),
|
||||||
'uom': d.uom
|
'uom': d.uom
|
||||||
})
|
})
|
||||||
|
|
||||||
return pr
|
return pr
|
||||||
|
|
||||||
def get_args_for_pricing_rule(doc):
|
def get_args_for_pricing_rule(doc):
|
||||||
|
@ -5,10 +5,17 @@ import unittest
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
|
from erpnext.accounts.doctype.promotional_scheme.promotional_scheme import TransactionExists
|
||||||
|
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
||||||
|
|
||||||
|
|
||||||
class TestPromotionalScheme(unittest.TestCase):
|
class TestPromotionalScheme(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
if frappe.db.exists('Promotional Scheme', '_Test Scheme'):
|
||||||
|
frappe.delete_doc('Promotional Scheme', '_Test Scheme')
|
||||||
|
|
||||||
def test_promotional_scheme(self):
|
def test_promotional_scheme(self):
|
||||||
ps = make_promotional_scheme()
|
ps = make_promotional_scheme(applicable_for='Customer', customer='_Test Customer')
|
||||||
price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", "creation"],
|
price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", "creation"],
|
||||||
filters = {'promotional_scheme': ps.name})
|
filters = {'promotional_scheme': ps.name})
|
||||||
self.assertTrue(len(price_rules),1)
|
self.assertTrue(len(price_rules),1)
|
||||||
@ -39,22 +46,62 @@ class TestPromotionalScheme(unittest.TestCase):
|
|||||||
filters = {'promotional_scheme': ps.name})
|
filters = {'promotional_scheme': ps.name})
|
||||||
self.assertEqual(price_rules, [])
|
self.assertEqual(price_rules, [])
|
||||||
|
|
||||||
def make_promotional_scheme():
|
def test_promotional_scheme_without_applicable_for(self):
|
||||||
|
ps = make_promotional_scheme()
|
||||||
|
price_rules = frappe.get_all('Pricing Rule', filters = {'promotional_scheme': ps.name})
|
||||||
|
|
||||||
|
self.assertTrue(len(price_rules), 1)
|
||||||
|
frappe.delete_doc('Promotional Scheme', ps.name)
|
||||||
|
|
||||||
|
price_rules = frappe.get_all('Pricing Rule', filters = {'promotional_scheme': ps.name})
|
||||||
|
self.assertEqual(price_rules, [])
|
||||||
|
|
||||||
|
def test_change_applicable_for_in_promotional_scheme(self):
|
||||||
|
ps = make_promotional_scheme()
|
||||||
|
price_rules = frappe.get_all('Pricing Rule', filters = {'promotional_scheme': ps.name})
|
||||||
|
self.assertTrue(len(price_rules), 1)
|
||||||
|
|
||||||
|
so = make_sales_order(qty=5, currency='USD', do_not_save=True)
|
||||||
|
so.set_missing_values()
|
||||||
|
so.save()
|
||||||
|
self.assertEqual(price_rules[0].name, so.pricing_rules[0].pricing_rule)
|
||||||
|
|
||||||
|
ps.applicable_for = 'Customer'
|
||||||
|
ps.append('customer', {
|
||||||
|
'customer': '_Test Customer'
|
||||||
|
})
|
||||||
|
|
||||||
|
self.assertRaises(TransactionExists, ps.save)
|
||||||
|
|
||||||
|
frappe.delete_doc('Sales Order', so.name)
|
||||||
|
frappe.delete_doc('Promotional Scheme', ps.name)
|
||||||
|
price_rules = frappe.get_all('Pricing Rule', filters = {'promotional_scheme': ps.name})
|
||||||
|
self.assertEqual(price_rules, [])
|
||||||
|
|
||||||
|
def make_promotional_scheme(**args):
|
||||||
|
args = frappe._dict(args)
|
||||||
|
|
||||||
ps = frappe.new_doc('Promotional Scheme')
|
ps = frappe.new_doc('Promotional Scheme')
|
||||||
ps.name = '_Test Scheme'
|
ps.name = '_Test Scheme'
|
||||||
ps.append('items',{
|
ps.append('items',{
|
||||||
'item_code': '_Test Item'
|
'item_code': '_Test Item'
|
||||||
})
|
})
|
||||||
|
|
||||||
ps.selling = 1
|
ps.selling = 1
|
||||||
ps.append('price_discount_slabs',{
|
ps.append('price_discount_slabs',{
|
||||||
'min_qty': 4,
|
'min_qty': 4,
|
||||||
|
'validate_applied_rule': 0,
|
||||||
'discount_percentage': 20,
|
'discount_percentage': 20,
|
||||||
'rule_description': 'Test'
|
'rule_description': 'Test'
|
||||||
})
|
})
|
||||||
ps.applicable_for = 'Customer'
|
|
||||||
ps.append('customer',{
|
ps.company = '_Test Company'
|
||||||
'customer': "_Test Customer"
|
if args.applicable_for:
|
||||||
})
|
ps.applicable_for = args.applicable_for
|
||||||
|
ps.append(frappe.scrub(args.applicable_for), {
|
||||||
|
frappe.scrub(args.applicable_for): args.get(frappe.scrub(args.applicable_for))
|
||||||
|
})
|
||||||
|
|
||||||
ps.save()
|
ps.save()
|
||||||
|
|
||||||
return ps
|
return ps
|
||||||
|
@ -136,7 +136,7 @@
|
|||||||
"label": "Threshold for Suggestion"
|
"label": "Threshold for Suggestion"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "1",
|
"default": "0",
|
||||||
"fieldname": "validate_applied_rule",
|
"fieldname": "validate_applied_rule",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Validate Applied Rule"
|
"label": "Validate Applied Rule"
|
||||||
@ -169,7 +169,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-08-19 15:49:29.598727",
|
"modified": "2021-11-16 00:25:33.843996",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Promotional Scheme Price Discount",
|
"name": "Promotional Scheme Price Discount",
|
||||||
|
@ -130,6 +130,7 @@
|
|||||||
"allocate_advances_automatically",
|
"allocate_advances_automatically",
|
||||||
"get_advances",
|
"get_advances",
|
||||||
"advances",
|
"advances",
|
||||||
|
"advance_tax",
|
||||||
"payment_schedule_section",
|
"payment_schedule_section",
|
||||||
"payment_terms_template",
|
"payment_terms_template",
|
||||||
"ignore_default_payment_terms_template",
|
"ignore_default_payment_terms_template",
|
||||||
@ -1408,13 +1409,21 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "column_break_147",
|
"fieldname": "column_break_147",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "advance_tax",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Advance Tax",
|
||||||
|
"options": "Advance Tax",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
"idx": 204,
|
"idx": 204,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-10-12 20:55:16.145651",
|
"modified": "2021-11-25 13:31:02.716727",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Invoice",
|
"name": "Purchase Invoice",
|
||||||
|
@ -427,6 +427,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
self.update_project()
|
self.update_project()
|
||||||
update_linked_doc(self.doctype, self.name, self.inter_company_invoice_reference)
|
update_linked_doc(self.doctype, self.name, self.inter_company_invoice_reference)
|
||||||
|
self.update_advance_tax_references()
|
||||||
|
|
||||||
self.process_common_party_accounting()
|
self.process_common_party_accounting()
|
||||||
|
|
||||||
@ -472,8 +473,6 @@ class PurchaseInvoice(BuyingController):
|
|||||||
self.make_exchange_gain_loss_gl_entries(gl_entries)
|
self.make_exchange_gain_loss_gl_entries(gl_entries)
|
||||||
self.make_internal_transfer_gl_entries(gl_entries)
|
self.make_internal_transfer_gl_entries(gl_entries)
|
||||||
|
|
||||||
self.allocate_advance_taxes(gl_entries)
|
|
||||||
|
|
||||||
gl_entries = make_regional_gl_entries(gl_entries, self)
|
gl_entries = make_regional_gl_entries(gl_entries, self)
|
||||||
|
|
||||||
gl_entries = merge_similar_entries(gl_entries)
|
gl_entries = merge_similar_entries(gl_entries)
|
||||||
@ -729,7 +728,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"account": self.stock_received_but_not_billed,
|
"account": self.stock_received_but_not_billed,
|
||||||
"against": self.supplier,
|
"against": self.supplier,
|
||||||
"debit": flt(item.item_tax_amount, item.precision("item_tax_amount")),
|
"debit": flt(item.item_tax_amount, item.precision("item_tax_amount")),
|
||||||
"remarks": self.remarks or "Accounting Entry for Stock",
|
"remarks": self.remarks or _("Accounting Entry for Stock"),
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
"project": item.project or self.project
|
"project": item.project or self.project
|
||||||
}, item=item)
|
}, item=item)
|
||||||
@ -937,7 +936,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"cost_center": tax.cost_center,
|
"cost_center": tax.cost_center,
|
||||||
"against": self.supplier,
|
"against": self.supplier,
|
||||||
"credit": valuation_tax[tax.name],
|
"credit": valuation_tax[tax.name],
|
||||||
"remarks": self.remarks or "Accounting Entry for Stock"
|
"remarks": self.remarks or _("Accounting Entry for Stock")
|
||||||
}, item=tax))
|
}, item=tax))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1074,6 +1073,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
unlink_inter_company_doc(self.doctype, self.name, self.inter_company_invoice_reference)
|
unlink_inter_company_doc(self.doctype, self.name, self.inter_company_invoice_reference)
|
||||||
self.ignore_linked_doctypes = ('GL Entry', 'Stock Ledger Entry', 'Repost Item Valuation')
|
self.ignore_linked_doctypes = ('GL Entry', 'Stock Ledger Entry', 'Repost Item Valuation')
|
||||||
|
self.update_advance_tax_references(cancel=1)
|
||||||
|
|
||||||
def update_project(self):
|
def update_project(self):
|
||||||
project_list = []
|
project_list = []
|
||||||
@ -1150,7 +1150,10 @@ class PurchaseInvoice(BuyingController):
|
|||||||
if not self.tax_withholding_category:
|
if not self.tax_withholding_category:
|
||||||
return
|
return
|
||||||
|
|
||||||
tax_withholding_details = get_party_tax_withholding_details(self, self.tax_withholding_category)
|
tax_withholding_details, advance_taxes = get_party_tax_withholding_details(self, self.tax_withholding_category)
|
||||||
|
|
||||||
|
# Adjust TDS paid on advances
|
||||||
|
self.allocate_advance_tds(tax_withholding_details, advance_taxes)
|
||||||
|
|
||||||
if not tax_withholding_details:
|
if not tax_withholding_details:
|
||||||
return
|
return
|
||||||
@ -1174,6 +1177,39 @@ class PurchaseInvoice(BuyingController):
|
|||||||
# calculate totals again after applying TDS
|
# calculate totals again after applying TDS
|
||||||
self.calculate_taxes_and_totals()
|
self.calculate_taxes_and_totals()
|
||||||
|
|
||||||
|
def allocate_advance_tds(self, tax_withholding_details, advance_taxes):
|
||||||
|
self.set('advance_tax', [])
|
||||||
|
for tax in advance_taxes:
|
||||||
|
allocated_amount = 0
|
||||||
|
pending_amount = flt(tax.tax_amount - tax.allocated_amount)
|
||||||
|
if flt(tax_withholding_details.get('tax_amount')) >= pending_amount:
|
||||||
|
tax_withholding_details['tax_amount'] -= pending_amount
|
||||||
|
allocated_amount = pending_amount
|
||||||
|
elif flt(tax_withholding_details.get('tax_amount')) and flt(tax_withholding_details.get('tax_amount')) < pending_amount:
|
||||||
|
allocated_amount = tax_withholding_details['tax_amount']
|
||||||
|
tax_withholding_details['tax_amount'] = 0
|
||||||
|
|
||||||
|
self.append('advance_tax', {
|
||||||
|
'reference_type': 'Payment Entry',
|
||||||
|
'reference_name': tax.parent,
|
||||||
|
'reference_detail': tax.name,
|
||||||
|
'account_head': tax.account_head,
|
||||||
|
'allocated_amount': allocated_amount
|
||||||
|
})
|
||||||
|
|
||||||
|
def update_advance_tax_references(self, cancel=0):
|
||||||
|
for tax in self.get('advance_tax'):
|
||||||
|
at = frappe.qb.DocType("Advance Taxes and Charges").as_("at")
|
||||||
|
|
||||||
|
if cancel:
|
||||||
|
frappe.qb.update(at).set(
|
||||||
|
at.allocated_amount, at.allocated_amount - tax.allocated_amount
|
||||||
|
).where(at.name == tax.reference_detail).run()
|
||||||
|
else:
|
||||||
|
frappe.qb.update(at).set(
|
||||||
|
at.allocated_amount, at.allocated_amount + tax.allocated_amount
|
||||||
|
).where(at.name == tax.reference_detail).run()
|
||||||
|
|
||||||
def set_status(self, update=False, status=None, update_modified=True):
|
def set_status(self, update=False, status=None, update_modified=True):
|
||||||
if self.is_new():
|
if self.is_new():
|
||||||
if self.get('amended_from'):
|
if self.get('amended_from'):
|
||||||
|
@ -13,6 +13,7 @@ from erpnext.accounts.doctype.account.test_account import create_account, get_in
|
|||||||
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
|
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
|
||||||
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
|
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
|
||||||
from erpnext.controllers.accounts_controller import get_payment_terms
|
from erpnext.controllers.accounts_controller import get_payment_terms
|
||||||
|
from erpnext.controllers.buying_controller import QtyMismatchError
|
||||||
from erpnext.exceptions import InvalidCurrency
|
from erpnext.exceptions import InvalidCurrency
|
||||||
from erpnext.projects.doctype.project.test_project import make_project
|
from erpnext.projects.doctype.project.test_project import make_project
|
||||||
from erpnext.stock.doctype.item.test_item import create_item
|
from erpnext.stock.doctype.item.test_item import create_item
|
||||||
@ -35,6 +36,27 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
def tearDownClass(self):
|
def tearDownClass(self):
|
||||||
unlink_payment_on_cancel_of_invoice(0)
|
unlink_payment_on_cancel_of_invoice(0)
|
||||||
|
|
||||||
|
def test_purchase_invoice_received_qty(self):
|
||||||
|
"""
|
||||||
|
1. Test if received qty is validated against accepted + rejected
|
||||||
|
2. Test if received qty is auto set on save
|
||||||
|
"""
|
||||||
|
pi = make_purchase_invoice(
|
||||||
|
qty=1,
|
||||||
|
rejected_qty=1,
|
||||||
|
received_qty=3,
|
||||||
|
item_code="_Test Item Home Desktop 200",
|
||||||
|
rejected_warehouse = "_Test Rejected Warehouse - _TC",
|
||||||
|
update_stock=True, do_not_save=True)
|
||||||
|
self.assertRaises(QtyMismatchError, pi.save)
|
||||||
|
|
||||||
|
pi.items[0].received_qty = 0
|
||||||
|
pi.save()
|
||||||
|
self.assertEqual(pi.items[0].received_qty, 2)
|
||||||
|
|
||||||
|
# teardown
|
||||||
|
pi.delete()
|
||||||
|
|
||||||
def test_gl_entries_without_perpetual_inventory(self):
|
def test_gl_entries_without_perpetual_inventory(self):
|
||||||
frappe.db.set_value("Company", "_Test Company", "round_off_account", "Round Off - _TC")
|
frappe.db.set_value("Company", "_Test Company", "round_off_account", "Round Off - _TC")
|
||||||
pi = frappe.copy_doc(test_records[0])
|
pi = frappe.copy_doc(test_records[0])
|
||||||
@ -811,29 +833,12 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
pi.shipping_rule = shipping_rule.name
|
pi.shipping_rule = shipping_rule.name
|
||||||
pi.insert()
|
pi.insert()
|
||||||
|
|
||||||
shipping_amount = 0.0
|
|
||||||
for condition in shipping_rule.get("conditions"):
|
|
||||||
if not condition.to_value or (flt(condition.from_value) <= pi.net_total <= flt(condition.to_value)):
|
|
||||||
shipping_amount = condition.shipping_amount
|
|
||||||
|
|
||||||
shipping_charge = {
|
|
||||||
"doctype": "Purchase Taxes and Charges",
|
|
||||||
"category": "Valuation and Total",
|
|
||||||
"charge_type": "Actual",
|
|
||||||
"account_head": shipping_rule.account,
|
|
||||||
"cost_center": shipping_rule.cost_center,
|
|
||||||
"tax_amount": shipping_amount,
|
|
||||||
"description": shipping_rule.name,
|
|
||||||
"add_deduct_tax": "Add"
|
|
||||||
}
|
|
||||||
pi.append("taxes", shipping_charge)
|
|
||||||
pi.save()
|
pi.save()
|
||||||
|
|
||||||
self.assertEqual(pi.net_total, 1250)
|
self.assertEqual(pi.net_total, 1250)
|
||||||
|
|
||||||
self.assertEqual(pi.total_taxes_and_charges, 462.3)
|
self.assertEqual(pi.total_taxes_and_charges, 354.1)
|
||||||
self.assertEqual(pi.grand_total, 1712.3)
|
self.assertEqual(pi.grand_total, 1604.1)
|
||||||
|
|
||||||
def test_make_pi_without_terms(self):
|
def test_make_pi_without_terms(self):
|
||||||
pi = make_purchase_invoice(do_not_save=1)
|
pi = make_purchase_invoice(do_not_save=1)
|
||||||
@ -1155,25 +1160,21 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
# Create Purchase Order with TDS applied
|
# Create Purchase Order with TDS applied
|
||||||
po = create_purchase_order(do_not_save=1, supplier=supplier.name, rate=3000, item='_Test Non Stock Item',
|
po = create_purchase_order(do_not_save=1, supplier=supplier.name, rate=3000, item='_Test Non Stock Item',
|
||||||
posting_date='2021-09-15')
|
posting_date='2021-09-15')
|
||||||
po.apply_tds = 1
|
|
||||||
po.tax_withholding_category = 'TDS - 194 - Dividends - Individual'
|
|
||||||
po.save()
|
po.save()
|
||||||
po.submit()
|
po.submit()
|
||||||
|
|
||||||
# Update Unrealized Profit / Loss Account which is used as default advance tax account
|
|
||||||
frappe.db.set_value('Company', '_Test Company', 'unrealized_profit_loss_account', '_Test Account Excise Duty - _TC')
|
|
||||||
|
|
||||||
# Create Payment Entry Against the order
|
# Create Payment Entry Against the order
|
||||||
payment_entry = get_payment_entry(dt='Purchase Order', dn=po.name)
|
payment_entry = get_payment_entry(dt='Purchase Order', dn=po.name)
|
||||||
payment_entry.paid_from = 'Cash - _TC'
|
payment_entry.paid_from = 'Cash - _TC'
|
||||||
|
payment_entry.apply_tax_withholding_amount = 1
|
||||||
|
payment_entry.tax_withholding_category = 'TDS - 194 - Dividends - Individual'
|
||||||
payment_entry.save()
|
payment_entry.save()
|
||||||
payment_entry.submit()
|
payment_entry.submit()
|
||||||
|
|
||||||
# Check GLE for Payment Entry
|
# Check GLE for Payment Entry
|
||||||
expected_gle = [
|
expected_gle = [
|
||||||
['_Test Account Excise Duty - _TC', 3000, 0],
|
|
||||||
['Cash - _TC', 0, 27000],
|
['Cash - _TC', 0, 27000],
|
||||||
['Creditors - _TC', 27000, 0],
|
['Creditors - _TC', 30000, 0],
|
||||||
['TDS Payable - _TC', 0, 3000],
|
['TDS Payable - _TC', 0, 3000],
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1199,9 +1200,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
# Zero net effect on final TDS Payable on invoice
|
# Zero net effect on final TDS Payable on invoice
|
||||||
expected_gle = [
|
expected_gle = [
|
||||||
['_Test Account Cost for Goods Sold - _TC', 30000],
|
['_Test Account Cost for Goods Sold - _TC', 30000],
|
||||||
['_Test Account Excise Duty - _TC', -3000],
|
['Creditors - _TC', -30000]
|
||||||
['Creditors - _TC', -27000],
|
|
||||||
['TDS Payable - _TC', 0]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
gl_entries = frappe.db.sql("""select account, sum(debit - credit) as amount
|
gl_entries = frappe.db.sql("""select account, sum(debit - credit) as amount
|
||||||
@ -1214,6 +1213,14 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
self.assertEqual(expected_gle[i][0], gle.account)
|
self.assertEqual(expected_gle[i][0], gle.account)
|
||||||
self.assertEqual(expected_gle[i][1], gle.amount)
|
self.assertEqual(expected_gle[i][1], gle.amount)
|
||||||
|
|
||||||
|
payment_entry.load_from_db()
|
||||||
|
self.assertEqual(payment_entry.taxes[0].allocated_amount, 3000)
|
||||||
|
|
||||||
|
purchase_invoice.cancel()
|
||||||
|
|
||||||
|
payment_entry.load_from_db()
|
||||||
|
self.assertEqual(payment_entry.taxes[0].allocated_amount, 0)
|
||||||
|
|
||||||
def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
|
def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
|
||||||
gl_entries = frappe.db.sql("""select account, debit, credit, posting_date
|
gl_entries = frappe.db.sql("""select account, debit, credit, posting_date
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
"received_qty",
|
"received_qty",
|
||||||
"qty",
|
"qty",
|
||||||
"rejected_qty",
|
"rejected_qty",
|
||||||
"stock_uom",
|
|
||||||
"col_break2",
|
"col_break2",
|
||||||
"uom",
|
"uom",
|
||||||
"conversion_factor",
|
"conversion_factor",
|
||||||
|
"stock_uom",
|
||||||
"stock_qty",
|
"stock_qty",
|
||||||
"sec_break1",
|
"sec_break1",
|
||||||
"price_list_rate",
|
"price_list_rate",
|
||||||
@ -175,7 +175,8 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "received_qty",
|
"fieldname": "received_qty",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"label": "Received Qty"
|
"label": "Received Qty",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"bold": 1,
|
"bold": 1,
|
||||||
@ -223,7 +224,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "stock_qty",
|
"fieldname": "stock_qty",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"label": "Stock Qty",
|
"label": "Accepted Qty in Stock UOM",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
@ -870,10 +871,11 @@
|
|||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-09-01 16:04:03.538643",
|
"modified": "2021-11-15 17:04:07.191013",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Invoice Item",
|
"name": "Purchase Invoice Item",
|
||||||
|
"naming_rule": "Random",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
@ -978,7 +978,7 @@ frappe.ui.form.on('Sales Invoice', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (frm.doc.is_debit_note) {
|
if (frm.doc.is_debit_note) {
|
||||||
frm.set_df_property('return_against', 'label', 'Adjustment Against');
|
frm.set_df_property('return_against', 'label', __('Adjustment Against'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frappe.boot.active_domains.includes("Healthcare")) {
|
if (frappe.boot.active_domains.includes("Healthcare")) {
|
||||||
@ -988,10 +988,10 @@ frappe.ui.form.on('Sales Invoice', {
|
|||||||
if (cint(frm.doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !frm.doc.is_return) {
|
if (cint(frm.doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !frm.doc.is_return) {
|
||||||
frm.add_custom_button(__('Healthcare Services'), function() {
|
frm.add_custom_button(__('Healthcare Services'), function() {
|
||||||
get_healthcare_services_to_invoice(frm);
|
get_healthcare_services_to_invoice(frm);
|
||||||
},"Get Items From");
|
},__("Get Items From"));
|
||||||
frm.add_custom_button(__('Prescriptions'), function() {
|
frm.add_custom_button(__('Prescriptions'), function() {
|
||||||
get_drugs_to_invoice(frm);
|
get_drugs_to_invoice(frm);
|
||||||
},"Get Items From");
|
},__("Get Items From"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -842,8 +842,6 @@ class SalesInvoice(SellingController):
|
|||||||
self.make_exchange_gain_loss_gl_entries(gl_entries)
|
self.make_exchange_gain_loss_gl_entries(gl_entries)
|
||||||
self.make_internal_transfer_gl_entries(gl_entries)
|
self.make_internal_transfer_gl_entries(gl_entries)
|
||||||
|
|
||||||
self.allocate_advance_taxes(gl_entries)
|
|
||||||
|
|
||||||
self.make_item_gl_entries(gl_entries)
|
self.make_item_gl_entries(gl_entries)
|
||||||
self.make_discount_gl_entries(gl_entries)
|
self.make_discount_gl_entries(gl_entries)
|
||||||
|
|
||||||
|
@ -1603,28 +1603,12 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
si.shipping_rule = shipping_rule.name
|
si.shipping_rule = shipping_rule.name
|
||||||
si.insert()
|
si.insert()
|
||||||
|
|
||||||
shipping_amount = 0.0
|
|
||||||
for condition in shipping_rule.get("conditions"):
|
|
||||||
if not condition.to_value or (flt(condition.from_value) <= si.net_total <= flt(condition.to_value)):
|
|
||||||
shipping_amount = condition.shipping_amount
|
|
||||||
|
|
||||||
shipping_charge = {
|
|
||||||
"doctype": "Sales Taxes and Charges",
|
|
||||||
"category": "Valuation and Total",
|
|
||||||
"charge_type": "Actual",
|
|
||||||
"account_head": shipping_rule.account,
|
|
||||||
"cost_center": shipping_rule.cost_center,
|
|
||||||
"tax_amount": shipping_amount,
|
|
||||||
"description": shipping_rule.name
|
|
||||||
}
|
|
||||||
si.append("taxes", shipping_charge)
|
|
||||||
si.save()
|
si.save()
|
||||||
|
|
||||||
self.assertEqual(si.net_total, 1250)
|
self.assertEqual(si.net_total, 1250)
|
||||||
|
|
||||||
self.assertEqual(si.total_taxes_and_charges, 577.05)
|
self.assertEqual(si.total_taxes_and_charges, 468.85)
|
||||||
self.assertEqual(si.grand_total, 1827.05)
|
self.assertEqual(si.grand_total, 1718.85)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2316,6 +2300,7 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (
|
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (
|
||||||
make_customer,
|
make_customer,
|
||||||
)
|
)
|
||||||
|
from erpnext.accounts.doctype.party_link.party_link import create_party_link
|
||||||
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
|
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
|
||||||
|
|
||||||
# create a customer
|
# create a customer
|
||||||
@ -2324,13 +2309,7 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
supplier = create_supplier(supplier_name="_Test Common Supplier").name
|
supplier = create_supplier(supplier_name="_Test Common Supplier").name
|
||||||
|
|
||||||
# create a party link between customer & supplier
|
# create a party link between customer & supplier
|
||||||
# set primary role as supplier
|
party_link = create_party_link("Supplier", supplier, customer)
|
||||||
party_link = frappe.new_doc("Party Link")
|
|
||||||
party_link.primary_role = "Supplier"
|
|
||||||
party_link.primary_party = supplier
|
|
||||||
party_link.secondary_role = "Customer"
|
|
||||||
party_link.secondary_party = customer
|
|
||||||
party_link.save()
|
|
||||||
|
|
||||||
# enable common party accounting
|
# enable common party accounting
|
||||||
frappe.db.set_value('Accounts Settings', None, 'enable_common_party_accounting', 1)
|
frappe.db.set_value('Accounts Settings', None, 'enable_common_party_accounting', 1)
|
||||||
@ -2418,6 +2397,32 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
frappe.db.set_value('Accounts Settings', None, 'acc_frozen_upto', None)
|
frappe.db.set_value('Accounts Settings', None, 'acc_frozen_upto', None)
|
||||||
|
|
||||||
|
def test_over_billing_case_against_delivery_note(self):
|
||||||
|
'''
|
||||||
|
Test a case where duplicating the item with qty = 1 in the invoice
|
||||||
|
allows overbilling even if it is disabled
|
||||||
|
'''
|
||||||
|
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
|
||||||
|
|
||||||
|
over_billing_allowance = frappe.db.get_single_value('Accounts Settings', 'over_billing_allowance')
|
||||||
|
frappe.db.set_value('Accounts Settings', None, 'over_billing_allowance', 0)
|
||||||
|
|
||||||
|
dn = create_delivery_note()
|
||||||
|
dn.submit()
|
||||||
|
|
||||||
|
si = make_sales_invoice(dn.name)
|
||||||
|
# make a copy of first item and add it to invoice
|
||||||
|
item_copy = frappe.copy_doc(si.items[0])
|
||||||
|
si.append('items', item_copy)
|
||||||
|
si.save()
|
||||||
|
|
||||||
|
with self.assertRaises(frappe.ValidationError) as err:
|
||||||
|
si.submit()
|
||||||
|
|
||||||
|
self.assertTrue("cannot overbill" in str(err.exception).lower())
|
||||||
|
|
||||||
|
frappe.db.set_value('Accounts Settings', None, 'over_billing_allowance', over_billing_allowance)
|
||||||
|
|
||||||
def get_sales_invoice_for_e_invoice():
|
def get_sales_invoice_for_e_invoice():
|
||||||
si = make_sales_invoice_for_ewaybill()
|
si = make_sales_invoice_for_ewaybill()
|
||||||
si.naming_series = 'INV-2020-.#####'
|
si.naming_series = 'INV-2020-.#####'
|
||||||
|
@ -95,7 +95,7 @@ def get_party_tax_withholding_details(inv, tax_withholding_category=None):
|
|||||||
frappe.throw(_('Tax Withholding Category {} against Company {} for Customer {} should have Cumulative Threshold value.')
|
frappe.throw(_('Tax Withholding Category {} against Company {} for Customer {} should have Cumulative Threshold value.')
|
||||||
.format(tax_withholding_category, inv.company, party))
|
.format(tax_withholding_category, inv.company, party))
|
||||||
|
|
||||||
tax_amount, tax_deducted = get_tax_amount(
|
tax_amount, tax_deducted, tax_deducted_on_advances = get_tax_amount(
|
||||||
party_type, parties,
|
party_type, parties,
|
||||||
inv, tax_details,
|
inv, tax_details,
|
||||||
posting_date, pan_no
|
posting_date, pan_no
|
||||||
@ -106,7 +106,10 @@ def get_party_tax_withholding_details(inv, tax_withholding_category=None):
|
|||||||
else:
|
else:
|
||||||
tax_row = get_tax_row_for_tcs(inv, tax_details, tax_amount, tax_deducted)
|
tax_row = get_tax_row_for_tcs(inv, tax_details, tax_amount, tax_deducted)
|
||||||
|
|
||||||
return tax_row
|
if inv.doctype == 'Purchase Invoice':
|
||||||
|
return tax_row, tax_deducted_on_advances
|
||||||
|
else:
|
||||||
|
return tax_row
|
||||||
|
|
||||||
def get_tax_withholding_details(tax_withholding_category, posting_date, company):
|
def get_tax_withholding_details(tax_withholding_category, posting_date, company):
|
||||||
tax_withholding = frappe.get_doc("Tax Withholding Category", tax_withholding_category)
|
tax_withholding = frappe.get_doc("Tax Withholding Category", tax_withholding_category)
|
||||||
@ -194,6 +197,10 @@ def get_tax_amount(party_type, parties, inv, tax_details, posting_date, pan_no=N
|
|||||||
advance_vouchers = get_advance_vouchers(parties, company=inv.company, from_date=tax_details.from_date,
|
advance_vouchers = get_advance_vouchers(parties, company=inv.company, from_date=tax_details.from_date,
|
||||||
to_date=tax_details.to_date, party_type=party_type)
|
to_date=tax_details.to_date, party_type=party_type)
|
||||||
taxable_vouchers = vouchers + advance_vouchers
|
taxable_vouchers = vouchers + advance_vouchers
|
||||||
|
tax_deducted_on_advances = 0
|
||||||
|
|
||||||
|
if inv.doctype == 'Purchase Invoice':
|
||||||
|
tax_deducted_on_advances = get_taxes_deducted_on_advances_allocated(inv, tax_details)
|
||||||
|
|
||||||
tax_deducted = 0
|
tax_deducted = 0
|
||||||
if taxable_vouchers:
|
if taxable_vouchers:
|
||||||
@ -223,7 +230,7 @@ def get_tax_amount(party_type, parties, inv, tax_details, posting_date, pan_no=N
|
|||||||
if cint(tax_details.round_off_tax_amount):
|
if cint(tax_details.round_off_tax_amount):
|
||||||
tax_amount = round(tax_amount)
|
tax_amount = round(tax_amount)
|
||||||
|
|
||||||
return tax_amount, tax_deducted
|
return tax_amount, tax_deducted, tax_deducted_on_advances
|
||||||
|
|
||||||
def get_invoice_vouchers(parties, tax_details, company, party_type='Supplier'):
|
def get_invoice_vouchers(parties, tax_details, company, party_type='Supplier'):
|
||||||
dr_or_cr = 'credit' if party_type == 'Supplier' else 'debit'
|
dr_or_cr = 'credit' if party_type == 'Supplier' else 'debit'
|
||||||
@ -281,6 +288,29 @@ def get_advance_vouchers(parties, company=None, from_date=None, to_date=None, pa
|
|||||||
|
|
||||||
return frappe.get_all('GL Entry', filters=filters, distinct=1, pluck='voucher_no') or [""]
|
return frappe.get_all('GL Entry', filters=filters, distinct=1, pluck='voucher_no') or [""]
|
||||||
|
|
||||||
|
def get_taxes_deducted_on_advances_allocated(inv, tax_details):
|
||||||
|
advances = [d.reference_name for d in inv.get('advances')]
|
||||||
|
tax_info = []
|
||||||
|
|
||||||
|
if advances:
|
||||||
|
pe = frappe.qb.DocType("Payment Entry").as_("pe")
|
||||||
|
at = frappe.qb.DocType("Advance Taxes and Charges").as_("at")
|
||||||
|
|
||||||
|
tax_info = frappe.qb.from_(at).inner_join(pe).on(
|
||||||
|
pe.name == at.parent
|
||||||
|
).select(
|
||||||
|
at.parent, at.name, at.tax_amount, at.allocated_amount
|
||||||
|
).where(
|
||||||
|
pe.tax_withholding_category == tax_details.get('tax_withholding_category')
|
||||||
|
).where(
|
||||||
|
at.parent.isin(advances)
|
||||||
|
).where(
|
||||||
|
at.account_head == tax_details.account_head
|
||||||
|
).run(as_dict=True)
|
||||||
|
|
||||||
|
return tax_info
|
||||||
|
|
||||||
|
|
||||||
def get_deducted_tax(taxable_vouchers, tax_details):
|
def get_deducted_tax(taxable_vouchers, tax_details):
|
||||||
# check if TDS / TCS account is already charged on taxable vouchers
|
# check if TDS / TCS account is already charged on taxable vouchers
|
||||||
filters = {
|
filters = {
|
||||||
|
@ -73,8 +73,28 @@ def process_gl_map(gl_map, merge_entries=True, precision=None):
|
|||||||
flt(entry.debit_in_account_currency) - flt(entry.credit_in_account_currency)
|
flt(entry.debit_in_account_currency) - flt(entry.credit_in_account_currency)
|
||||||
entry.credit_in_account_currency = 0.0
|
entry.credit_in_account_currency = 0.0
|
||||||
|
|
||||||
|
update_net_values(entry)
|
||||||
|
|
||||||
return gl_map
|
return gl_map
|
||||||
|
|
||||||
|
def update_net_values(entry):
|
||||||
|
# In some scenarios net value needs to be shown in the ledger
|
||||||
|
# This method updates net values as debit or credit
|
||||||
|
if entry.post_net_value and entry.debit and entry.credit:
|
||||||
|
if entry.debit > entry.credit:
|
||||||
|
entry.debit = entry.debit - entry.credit
|
||||||
|
entry.debit_in_account_currency = entry.debit_in_account_currency \
|
||||||
|
- entry.credit_in_account_currency
|
||||||
|
entry.credit = 0
|
||||||
|
entry.credit_in_account_currency = 0
|
||||||
|
else:
|
||||||
|
entry.credit = entry.credit - entry.debit
|
||||||
|
entry.credit_in_account_currency = entry.credit_in_account_currency \
|
||||||
|
- entry.debit_in_account_currency
|
||||||
|
|
||||||
|
entry.debit = 0
|
||||||
|
entry.debit_in_account_currency = 0
|
||||||
|
|
||||||
def merge_similar_entries(gl_map, precision=None):
|
def merge_similar_entries(gl_map, precision=None):
|
||||||
merged_gl_map = []
|
merged_gl_map = []
|
||||||
accounting_dimensions = get_accounting_dimensions()
|
accounting_dimensions = get_accounting_dimensions()
|
||||||
|
@ -44,7 +44,7 @@ frappe.query_reports["Gross Profit"] = {
|
|||||||
"formatter": function(value, row, column, data, default_formatter) {
|
"formatter": function(value, row, column, data, default_formatter) {
|
||||||
value = default_formatter(value, row, column, data);
|
value = default_formatter(value, row, column, data);
|
||||||
|
|
||||||
if (data && data.indent == 0.0) {
|
if (data && (data.indent == 0.0 || row[1].content == "Total")) {
|
||||||
value = $(`<span>${value}</span>`);
|
value = $(`<span>${value}</span>`);
|
||||||
var $value = $(value).css("font-weight", "bold");
|
var $value = $(value).css("font-weight", "bold");
|
||||||
value = $value.wrap("<p></p>").parent().html();
|
value = $value.wrap("<p></p>").parent().html();
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"filters": [],
|
"filters": [],
|
||||||
"idx": 3,
|
"idx": 3,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2021-08-19 18:57:07.468202",
|
"modified": "2021-11-13 19:14:23.730198",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Gross Profit",
|
"name": "Gross Profit",
|
||||||
|
@ -19,7 +19,7 @@ def execute(filters=None):
|
|||||||
data = []
|
data = []
|
||||||
|
|
||||||
group_wise_columns = frappe._dict({
|
group_wise_columns = frappe._dict({
|
||||||
"invoice": ["parent", "customer", "customer_group", "posting_date","item_code", "item_name","item_group", "brand", "description", \
|
"invoice": ["invoice_or_item", "customer", "customer_group", "posting_date","item_code", "item_name","item_group", "brand", "description",
|
||||||
"warehouse", "qty", "base_rate", "buying_rate", "base_amount",
|
"warehouse", "qty", "base_rate", "buying_rate", "base_amount",
|
||||||
"buying_amount", "gross_profit", "gross_profit_percent", "project"],
|
"buying_amount", "gross_profit", "gross_profit_percent", "project"],
|
||||||
"item_code": ["item_code", "item_name", "brand", "description", "qty", "base_rate",
|
"item_code": ["item_code", "item_name", "brand", "description", "qty", "base_rate",
|
||||||
@ -77,13 +77,15 @@ def get_data_when_not_grouped_by_invoice(gross_profit_data, filters, group_wise_
|
|||||||
|
|
||||||
row.append(filters.currency)
|
row.append(filters.currency)
|
||||||
if idx == len(gross_profit_data.grouped_data)-1:
|
if idx == len(gross_profit_data.grouped_data)-1:
|
||||||
row[0] = frappe.bold("Total")
|
row[0] = "Total"
|
||||||
|
|
||||||
data.append(row)
|
data.append(row)
|
||||||
|
|
||||||
def get_columns(group_wise_columns, filters):
|
def get_columns(group_wise_columns, filters):
|
||||||
columns = []
|
columns = []
|
||||||
column_map = frappe._dict({
|
column_map = frappe._dict({
|
||||||
"parent": _("Sales Invoice") + ":Link/Sales Invoice:120",
|
"parent": _("Sales Invoice") + ":Link/Sales Invoice:120",
|
||||||
|
"invoice_or_item": _("Sales Invoice") + ":Link/Sales Invoice:120",
|
||||||
"posting_date": _("Posting Date") + ":Date:100",
|
"posting_date": _("Posting Date") + ":Date:100",
|
||||||
"posting_time": _("Posting Time") + ":Data:100",
|
"posting_time": _("Posting Time") + ":Data:100",
|
||||||
"item_code": _("Item Code") + ":Link/Item:100",
|
"item_code": _("Item Code") + ":Link/Item:100",
|
||||||
@ -122,7 +124,7 @@ def get_columns(group_wise_columns, filters):
|
|||||||
|
|
||||||
def get_column_names():
|
def get_column_names():
|
||||||
return frappe._dict({
|
return frappe._dict({
|
||||||
'parent': 'sales_invoice',
|
'invoice_or_item': 'sales_invoice',
|
||||||
'customer': 'customer',
|
'customer': 'customer',
|
||||||
'customer_group': 'customer_group',
|
'customer_group': 'customer_group',
|
||||||
'posting_date': 'posting_date',
|
'posting_date': 'posting_date',
|
||||||
@ -245,19 +247,28 @@ class GrossProfitGenerator(object):
|
|||||||
self.add_to_totals(new_row)
|
self.add_to_totals(new_row)
|
||||||
else:
|
else:
|
||||||
for i, row in enumerate(self.grouped[key]):
|
for i, row in enumerate(self.grouped[key]):
|
||||||
if row.parent in self.returned_invoices \
|
if row.indent == 1.0:
|
||||||
and row.item_code in self.returned_invoices[row.parent]:
|
if row.parent in self.returned_invoices \
|
||||||
returned_item_rows = self.returned_invoices[row.parent][row.item_code]
|
and row.item_code in self.returned_invoices[row.parent]:
|
||||||
for returned_item_row in returned_item_rows:
|
returned_item_rows = self.returned_invoices[row.parent][row.item_code]
|
||||||
row.qty += flt(returned_item_row.qty)
|
for returned_item_row in returned_item_rows:
|
||||||
row.base_amount += flt(returned_item_row.base_amount, self.currency_precision)
|
row.qty += flt(returned_item_row.qty)
|
||||||
row.buying_amount = flt(flt(row.qty) * flt(row.buying_rate), self.currency_precision)
|
row.base_amount += flt(returned_item_row.base_amount, self.currency_precision)
|
||||||
if (flt(row.qty) or row.base_amount) and self.is_not_invoice_row(row):
|
row.buying_amount = flt(flt(row.qty) * flt(row.buying_rate), self.currency_precision)
|
||||||
row = self.set_average_rate(row)
|
if (flt(row.qty) or row.base_amount):
|
||||||
self.grouped_data.append(row)
|
row = self.set_average_rate(row)
|
||||||
self.add_to_totals(row)
|
self.grouped_data.append(row)
|
||||||
|
self.add_to_totals(row)
|
||||||
|
|
||||||
self.set_average_gross_profit(self.totals)
|
self.set_average_gross_profit(self.totals)
|
||||||
self.grouped_data.append(self.totals)
|
|
||||||
|
if self.filters.get("group_by") == "Invoice":
|
||||||
|
self.totals.indent = 0.0
|
||||||
|
self.totals.parent_invoice = ""
|
||||||
|
self.totals.invoice_or_item = "Total"
|
||||||
|
self.si_list.append(self.totals)
|
||||||
|
else:
|
||||||
|
self.grouped_data.append(self.totals)
|
||||||
|
|
||||||
def is_not_invoice_row(self, row):
|
def is_not_invoice_row(self, row):
|
||||||
return (self.filters.get("group_by") == "Invoice" and row.indent != 0.0) or self.filters.get("group_by") != "Invoice"
|
return (self.filters.get("group_by") == "Invoice" and row.indent != 0.0) or self.filters.get("group_by") != "Invoice"
|
||||||
@ -446,7 +457,7 @@ class GrossProfitGenerator(object):
|
|||||||
if not row.indent:
|
if not row.indent:
|
||||||
row.indent = 1.0
|
row.indent = 1.0
|
||||||
row.parent_invoice = row.parent
|
row.parent_invoice = row.parent
|
||||||
row.parent = row.item_code
|
row.invoice_or_item = row.item_code
|
||||||
|
|
||||||
if frappe.db.exists('Product Bundle', row.item_code):
|
if frappe.db.exists('Product Bundle', row.item_code):
|
||||||
self.add_bundle_items(row, index)
|
self.add_bundle_items(row, index)
|
||||||
@ -455,7 +466,8 @@ class GrossProfitGenerator(object):
|
|||||||
return frappe._dict({
|
return frappe._dict({
|
||||||
'parent_invoice': "",
|
'parent_invoice': "",
|
||||||
'indent': 0.0,
|
'indent': 0.0,
|
||||||
'parent': row.parent,
|
'invoice_or_item': row.parent,
|
||||||
|
'parent': None,
|
||||||
'posting_date': row.posting_date,
|
'posting_date': row.posting_date,
|
||||||
'posting_time': row.posting_time,
|
'posting_time': row.posting_time,
|
||||||
'project': row.project,
|
'project': row.project,
|
||||||
@ -499,7 +511,8 @@ class GrossProfitGenerator(object):
|
|||||||
return frappe._dict({
|
return frappe._dict({
|
||||||
'parent_invoice': product_bundle.item_code,
|
'parent_invoice': product_bundle.item_code,
|
||||||
'indent': product_bundle.indent + 1,
|
'indent': product_bundle.indent + 1,
|
||||||
'parent': item.item_code,
|
'parent': None,
|
||||||
|
'invoice_or_item': item.item_code,
|
||||||
'posting_date': product_bundle.posting_date,
|
'posting_date': product_bundle.posting_date,
|
||||||
'posting_time': product_bundle.posting_time,
|
'posting_time': product_bundle.posting_time,
|
||||||
'project': product_bundle.project,
|
'project': product_bundle.project,
|
||||||
|
@ -14,6 +14,14 @@ frappe.ui.form.on('Asset Value Adjustment', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
frm.set_query('asset', function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
calculate_depreciation: 1,
|
||||||
|
docstatus: 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
|
@ -10,7 +10,11 @@ from frappe.utils import cint, date_diff, flt, formatdate, getdate
|
|||||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
||||||
get_checks_for_pl_and_bs_accounts,
|
get_checks_for_pl_and_bs_accounts,
|
||||||
)
|
)
|
||||||
|
from erpnext.assets.doctype.asset.asset import get_depreciation_amount
|
||||||
from erpnext.assets.doctype.asset.depreciation import get_depreciation_accounts
|
from erpnext.assets.doctype.asset.depreciation import get_depreciation_accounts
|
||||||
|
from erpnext.regional.india.utils import (
|
||||||
|
get_depreciation_amount as get_depreciation_amount_for_india,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AssetValueAdjustment(Document):
|
class AssetValueAdjustment(Document):
|
||||||
@ -90,6 +94,7 @@ class AssetValueAdjustment(Document):
|
|||||||
|
|
||||||
def reschedule_depreciations(self, asset_value):
|
def reschedule_depreciations(self, asset_value):
|
||||||
asset = frappe.get_doc('Asset', self.asset)
|
asset = frappe.get_doc('Asset', self.asset)
|
||||||
|
country = frappe.get_value('Company', self.company, 'country')
|
||||||
|
|
||||||
for d in asset.finance_books:
|
for d in asset.finance_books:
|
||||||
d.value_after_depreciation = asset_value
|
d.value_after_depreciation = asset_value
|
||||||
@ -111,8 +116,10 @@ class AssetValueAdjustment(Document):
|
|||||||
depreciation_amount = days * rate_per_day
|
depreciation_amount = days * rate_per_day
|
||||||
from_date = data.schedule_date
|
from_date = data.schedule_date
|
||||||
else:
|
else:
|
||||||
depreciation_amount = asset.get_depreciation_amount(value_after_depreciation,
|
if country == "India":
|
||||||
no_of_depreciations, d)
|
depreciation_amount = get_depreciation_amount_for_india(asset, value_after_depreciation, d)
|
||||||
|
else:
|
||||||
|
depreciation_amount = get_depreciation_amount(asset, value_after_depreciation, d)
|
||||||
|
|
||||||
if depreciation_amount:
|
if depreciation_amount:
|
||||||
value_after_depreciation -= flt(depreciation_amount)
|
value_after_depreciation -= flt(depreciation_amount)
|
||||||
|
@ -83,6 +83,12 @@ frappe.ui.form.on("Supplier", {
|
|||||||
frm.trigger("get_supplier_group_details");
|
frm.trigger("get_supplier_group_details");
|
||||||
}, __('Actions'));
|
}, __('Actions'));
|
||||||
|
|
||||||
|
if (cint(frappe.defaults.get_default("enable_common_party_accounting"))) {
|
||||||
|
frm.add_custom_button(__('Link with Customer'), function () {
|
||||||
|
frm.trigger('show_party_link_dialog');
|
||||||
|
}, __('Actions'));
|
||||||
|
}
|
||||||
|
|
||||||
// indicators
|
// indicators
|
||||||
erpnext.utils.set_party_dashboard_indicators(frm);
|
erpnext.utils.set_party_dashboard_indicators(frm);
|
||||||
}
|
}
|
||||||
@ -128,5 +134,42 @@ frappe.ui.form.on("Supplier", {
|
|||||||
else {
|
else {
|
||||||
frm.toggle_reqd("represents_company", false);
|
frm.toggle_reqd("represents_company", false);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
show_party_link_dialog: function(frm) {
|
||||||
|
const dialog = new frappe.ui.Dialog({
|
||||||
|
title: __('Select a Customer'),
|
||||||
|
fields: [{
|
||||||
|
fieldtype: 'Link', label: __('Customer'),
|
||||||
|
options: 'Customer', fieldname: 'customer', reqd: 1
|
||||||
|
}],
|
||||||
|
primary_action: function({ customer }) {
|
||||||
|
frappe.call({
|
||||||
|
method: 'erpnext.accounts.doctype.party_link.party_link.create_party_link',
|
||||||
|
args: {
|
||||||
|
primary_role: 'Supplier',
|
||||||
|
primary_party: frm.doc.name,
|
||||||
|
secondary_party: customer
|
||||||
|
},
|
||||||
|
freeze: true,
|
||||||
|
callback: function() {
|
||||||
|
dialog.hide();
|
||||||
|
frappe.msgprint({
|
||||||
|
message: __('Successfully linked to Customer'),
|
||||||
|
alert: true
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
dialog.hide();
|
||||||
|
frappe.msgprint({
|
||||||
|
message: __('Linking to Customer Failed. Please try again.'),
|
||||||
|
title: __('Linking Failed'),
|
||||||
|
indicator: 'red'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
primary_action_label: __('Create Link')
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -11,7 +11,11 @@ from frappe.contacts.address_and_contact import (
|
|||||||
)
|
)
|
||||||
from frappe.model.naming import set_name_by_naming_series, set_name_from_naming_options
|
from frappe.model.naming import set_name_by_naming_series, set_name_from_naming_options
|
||||||
|
|
||||||
from erpnext.accounts.party import get_dashboard_info, validate_party_accounts
|
from erpnext.accounts.party import ( # noqa
|
||||||
|
get_dashboard_info,
|
||||||
|
get_timeline_data,
|
||||||
|
validate_party_accounts,
|
||||||
|
)
|
||||||
from erpnext.utilities.transaction_base import TransactionBase
|
from erpnext.utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,11 +145,6 @@ class AccountsController(TransactionBase):
|
|||||||
self.validate_party()
|
self.validate_party()
|
||||||
self.validate_currency()
|
self.validate_currency()
|
||||||
|
|
||||||
if self.doctype == 'Purchase Invoice':
|
|
||||||
self.calculate_paid_amount()
|
|
||||||
# apply tax withholding only if checked and applicable
|
|
||||||
self.set_tax_withholding()
|
|
||||||
|
|
||||||
if self.doctype in ['Purchase Invoice', 'Sales Invoice']:
|
if self.doctype in ['Purchase Invoice', 'Sales Invoice']:
|
||||||
pos_check_field = "is_pos" if self.doctype=="Sales Invoice" else "is_paid"
|
pos_check_field = "is_pos" if self.doctype=="Sales Invoice" else "is_paid"
|
||||||
if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)):
|
if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)):
|
||||||
@ -164,6 +159,11 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
self.set_inter_company_account()
|
self.set_inter_company_account()
|
||||||
|
|
||||||
|
if self.doctype == 'Purchase Invoice':
|
||||||
|
self.calculate_paid_amount()
|
||||||
|
# apply tax withholding only if checked and applicable
|
||||||
|
self.set_tax_withholding()
|
||||||
|
|
||||||
validate_regional(self)
|
validate_regional(self)
|
||||||
|
|
||||||
if self.doctype != 'Material Request':
|
if self.doctype != 'Material Request':
|
||||||
@ -524,7 +524,8 @@ class AccountsController(TransactionBase):
|
|||||||
'is_opening': self.get("is_opening") or "No",
|
'is_opening': self.get("is_opening") or "No",
|
||||||
'party_type': None,
|
'party_type': None,
|
||||||
'party': None,
|
'party': None,
|
||||||
'project': self.get("project")
|
'project': self.get("project"),
|
||||||
|
'post_net_value': args.get('post_net_value')
|
||||||
})
|
})
|
||||||
|
|
||||||
accounting_dimensions = get_accounting_dimensions()
|
accounting_dimensions = get_accounting_dimensions()
|
||||||
@ -805,7 +806,6 @@ class AccountsController(TransactionBase):
|
|||||||
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
||||||
|
|
||||||
if self.doctype in ["Sales Invoice", "Purchase Invoice"]:
|
if self.doctype in ["Sales Invoice", "Purchase Invoice"]:
|
||||||
self.update_allocated_advance_taxes_on_cancel()
|
|
||||||
if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
|
if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
|
||||||
unlink_ref_doc_from_payment_entries(self)
|
unlink_ref_doc_from_payment_entries(self)
|
||||||
|
|
||||||
@ -853,29 +853,6 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
return tax_map
|
return tax_map
|
||||||
|
|
||||||
def update_allocated_advance_taxes_on_cancel(self):
|
|
||||||
if self.get('advances'):
|
|
||||||
tax_accounts = [d.account_head for d in self.get('taxes')]
|
|
||||||
allocated_tax_map = frappe._dict(frappe.get_all('GL Entry', fields=['account', 'sum(credit - debit)'],
|
|
||||||
filters={'voucher_no': self.name, 'account': ('in', tax_accounts)},
|
|
||||||
group_by='account', as_list=1))
|
|
||||||
|
|
||||||
tax_map = self.get_tax_map()
|
|
||||||
|
|
||||||
for pe in self.get('advances'):
|
|
||||||
if pe.reference_type == 'Payment Entry':
|
|
||||||
pe = frappe.get_doc('Payment Entry', pe.reference_name)
|
|
||||||
for tax in pe.get('taxes'):
|
|
||||||
allocated_amount = tax_map.get(tax.account_head) - allocated_tax_map.get(tax.account_head)
|
|
||||||
if allocated_amount > tax.tax_amount:
|
|
||||||
allocated_amount = tax.tax_amount
|
|
||||||
|
|
||||||
if allocated_amount:
|
|
||||||
frappe.db.set_value('Advance Taxes and Charges', tax.name, 'allocated_amount',
|
|
||||||
tax.allocated_amount - allocated_amount)
|
|
||||||
tax_map[tax.account_head] -= allocated_amount
|
|
||||||
allocated_tax_map[tax.account_head] -= allocated_amount
|
|
||||||
|
|
||||||
def get_amount_and_base_amount(self, item, enable_discount_accounting):
|
def get_amount_and_base_amount(self, item, enable_discount_accounting):
|
||||||
amount = item.net_amount
|
amount = item.net_amount
|
||||||
base_amount = item.base_net_amount
|
base_amount = item.base_net_amount
|
||||||
@ -959,58 +936,10 @@ class AccountsController(TransactionBase):
|
|||||||
}, item=self)
|
}, item=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
def allocate_advance_taxes(self, gl_entries):
|
|
||||||
tax_map = self.get_tax_map()
|
|
||||||
for pe in self.get("advances"):
|
|
||||||
if pe.reference_type == "Payment Entry" and \
|
|
||||||
frappe.db.get_value('Payment Entry', pe.reference_name, 'advance_tax_account'):
|
|
||||||
pe = frappe.get_doc("Payment Entry", pe.reference_name)
|
|
||||||
for tax in pe.get("taxes"):
|
|
||||||
account_currency = get_account_currency(tax.account_head)
|
|
||||||
|
|
||||||
if self.doctype == "Purchase Invoice":
|
|
||||||
dr_or_cr = "debit" if tax.add_deduct_tax == "Add" else "credit"
|
|
||||||
rev_dr_cr = "credit" if tax.add_deduct_tax == "Add" else "debit"
|
|
||||||
else:
|
|
||||||
dr_or_cr = "credit" if tax.add_deduct_tax == "Add" else "debit"
|
|
||||||
rev_dr_cr = "debit" if tax.add_deduct_tax == "Add" else "credit"
|
|
||||||
|
|
||||||
party = self.supplier if self.doctype == "Purchase Invoice" else self.customer
|
|
||||||
unallocated_amount = tax.tax_amount - tax.allocated_amount
|
|
||||||
if tax_map.get(tax.account_head):
|
|
||||||
amount = tax_map.get(tax.account_head)
|
|
||||||
if amount < unallocated_amount:
|
|
||||||
unallocated_amount = amount
|
|
||||||
|
|
||||||
gl_entries.append(
|
|
||||||
self.get_gl_dict({
|
|
||||||
"account": tax.account_head,
|
|
||||||
"against": party,
|
|
||||||
dr_or_cr: unallocated_amount,
|
|
||||||
dr_or_cr + "_in_account_currency": unallocated_amount
|
|
||||||
if account_currency==self.company_currency
|
|
||||||
else unallocated_amount,
|
|
||||||
"cost_center": tax.cost_center
|
|
||||||
}, account_currency, item=tax))
|
|
||||||
|
|
||||||
gl_entries.append(
|
|
||||||
self.get_gl_dict({
|
|
||||||
"account": pe.advance_tax_account,
|
|
||||||
"against": party,
|
|
||||||
rev_dr_cr: unallocated_amount,
|
|
||||||
rev_dr_cr + "_in_account_currency": unallocated_amount
|
|
||||||
if account_currency==self.company_currency
|
|
||||||
else unallocated_amount,
|
|
||||||
"cost_center": tax.cost_center
|
|
||||||
}, account_currency, item=tax))
|
|
||||||
|
|
||||||
frappe.db.set_value("Advance Taxes and Charges", tax.name, "allocated_amount",
|
|
||||||
tax.allocated_amount + unallocated_amount)
|
|
||||||
|
|
||||||
tax_map[tax.account_head] -= unallocated_amount
|
|
||||||
|
|
||||||
def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield):
|
def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield):
|
||||||
from erpnext.controllers.status_updater import get_allowance_for
|
from erpnext.controllers.status_updater import get_allowance_for
|
||||||
|
|
||||||
item_allowance = {}
|
item_allowance = {}
|
||||||
global_qty_allowance, global_amount_allowance = None, None
|
global_qty_allowance, global_amount_allowance = None, None
|
||||||
|
|
||||||
@ -1031,12 +960,7 @@ class AccountsController(TransactionBase):
|
|||||||
.format(item.item_code, ref_dt), title=_("Warning"), indicator="orange")
|
.format(item.item_code, ref_dt), title=_("Warning"), indicator="orange")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
already_billed = frappe.db.sql("""
|
already_billed = self.get_billed_amount_for_item(item, item_ref_dn, based_on)
|
||||||
select sum(%s)
|
|
||||||
from `tab%s`
|
|
||||||
where %s=%s and docstatus=1 and parent != %s
|
|
||||||
""" % (based_on, self.doctype + " Item", item_ref_dn, '%s', '%s'),
|
|
||||||
(item.get(item_ref_dn), self.name))[0][0]
|
|
||||||
|
|
||||||
total_billed_amt = flt(flt(already_billed) + flt(item.get(based_on)),
|
total_billed_amt = flt(flt(already_billed) + flt(item.get(based_on)),
|
||||||
self.precision(based_on, item))
|
self.precision(based_on, item))
|
||||||
@ -1064,6 +988,43 @@ class AccountsController(TransactionBase):
|
|||||||
frappe.msgprint(_("Overbilling of {} ignored because you have {} role.")
|
frappe.msgprint(_("Overbilling of {} ignored because you have {} role.")
|
||||||
.format(total_overbilled_amt, role_allowed_to_over_bill), indicator="orange", alert=True)
|
.format(total_overbilled_amt, role_allowed_to_over_bill), indicator="orange", alert=True)
|
||||||
|
|
||||||
|
def get_billed_amount_for_item(self, item, item_ref_dn, based_on):
|
||||||
|
'''
|
||||||
|
Returns Sum of Amount of
|
||||||
|
Sales/Purchase Invoice Items
|
||||||
|
that are linked to `item_ref_dn` (`dn_detail` / `pr_detail`)
|
||||||
|
that are submitted OR not submitted but are under current invoice
|
||||||
|
'''
|
||||||
|
|
||||||
|
from frappe.query_builder import Criterion
|
||||||
|
from frappe.query_builder.functions import Sum
|
||||||
|
|
||||||
|
item_doctype = frappe.qb.DocType(item.doctype)
|
||||||
|
based_on_field = frappe.qb.Field(based_on)
|
||||||
|
join_field = frappe.qb.Field(item_ref_dn)
|
||||||
|
|
||||||
|
result = (
|
||||||
|
frappe.qb.from_(item_doctype)
|
||||||
|
.select(Sum(based_on_field))
|
||||||
|
.where(
|
||||||
|
join_field == item.get(item_ref_dn)
|
||||||
|
).where(
|
||||||
|
Criterion.any([ # select all items from other invoices OR current invoices
|
||||||
|
Criterion.all([ # for selecting items from other invoices
|
||||||
|
item_doctype.docstatus == 1,
|
||||||
|
item_doctype.parent != self.name
|
||||||
|
]),
|
||||||
|
Criterion.all([ # for selecting items from current invoice, that are linked to same reference
|
||||||
|
item_doctype.docstatus == 0,
|
||||||
|
item_doctype.parent == self.name,
|
||||||
|
item_doctype.name != item.name
|
||||||
|
])
|
||||||
|
])
|
||||||
|
)
|
||||||
|
).run()
|
||||||
|
|
||||||
|
return result[0][0] if result else 0
|
||||||
|
|
||||||
def throw_overbill_exception(self, item, max_allowed_amt):
|
def throw_overbill_exception(self, item, max_allowed_amt):
|
||||||
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set allowance in Accounts Settings")
|
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set allowance in Accounts Settings")
|
||||||
.format(item.item_code, item.idx, max_allowed_amt))
|
.format(item.item_code, item.idx, max_allowed_amt))
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, msgprint
|
from frappe import ValidationError, _, msgprint
|
||||||
from frappe.contacts.doctype.address.address import get_address_display
|
from frappe.contacts.doctype.address.address import get_address_display
|
||||||
from frappe.utils import cint, cstr, flt, getdate
|
from frappe.utils import cint, cstr, flt, getdate
|
||||||
|
|
||||||
@ -17,6 +17,9 @@ from erpnext.stock.get_item_details import get_conversion_factor
|
|||||||
from erpnext.stock.utils import get_incoming_rate
|
from erpnext.stock.utils import get_incoming_rate
|
||||||
|
|
||||||
|
|
||||||
|
class QtyMismatchError(ValidationError):
|
||||||
|
pass
|
||||||
|
|
||||||
class BuyingController(StockController, Subcontracting):
|
class BuyingController(StockController, Subcontracting):
|
||||||
|
|
||||||
def get_feed(self):
|
def get_feed(self):
|
||||||
@ -360,19 +363,15 @@ class BuyingController(StockController, Subcontracting):
|
|||||||
def validate_accepted_rejected_qty(self):
|
def validate_accepted_rejected_qty(self):
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
self.validate_negative_quantity(d, ["received_qty","qty", "rejected_qty"])
|
self.validate_negative_quantity(d, ["received_qty","qty", "rejected_qty"])
|
||||||
if not flt(d.received_qty) and flt(d.qty):
|
|
||||||
d.received_qty = flt(d.qty) - flt(d.rejected_qty)
|
|
||||||
|
|
||||||
elif not flt(d.qty) and flt(d.rejected_qty):
|
if not flt(d.received_qty) and (flt(d.qty) or flt(d.rejected_qty)):
|
||||||
d.qty = flt(d.received_qty) - flt(d.rejected_qty)
|
d.received_qty = flt(d.qty) + flt(d.rejected_qty)
|
||||||
|
|
||||||
elif not flt(d.rejected_qty):
|
|
||||||
d.rejected_qty = flt(d.received_qty) - flt(d.qty)
|
|
||||||
|
|
||||||
val = flt(d.qty) + flt(d.rejected_qty)
|
|
||||||
# Check Received Qty = Accepted Qty + Rejected Qty
|
# Check Received Qty = Accepted Qty + Rejected Qty
|
||||||
|
val = flt(d.qty) + flt(d.rejected_qty)
|
||||||
if (flt(val, d.precision("received_qty")) != flt(d.received_qty, d.precision("received_qty"))):
|
if (flt(val, d.precision("received_qty")) != flt(d.received_qty, d.precision("received_qty"))):
|
||||||
frappe.throw(_("Accepted + Rejected Qty must be equal to Received quantity for Item {0}").format(d.item_code))
|
message = _("Row #{0}: Received Qty must be equal to Accepted + Rejected Qty for Item {1}").format(d.idx, d.item_code)
|
||||||
|
frappe.throw(msg=message, title=_("Mismatch"), exc=QtyMismatchError)
|
||||||
|
|
||||||
def validate_negative_quantity(self, item_row, field_list):
|
def validate_negative_quantity(self, item_row, field_list):
|
||||||
if self.is_return:
|
if self.is_return:
|
||||||
|
@ -17,7 +17,7 @@ from erpnext.accounts.general_ledger import (
|
|||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import get_fiscal_year
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
from erpnext.stock import get_warehouse_account_map
|
from erpnext.stock import get_warehouse_account_map
|
||||||
from erpnext.stock.stock_ledger import get_valuation_rate
|
from erpnext.stock.stock_ledger import get_items_to_be_repost, get_valuation_rate
|
||||||
|
|
||||||
|
|
||||||
class QualityInspectionRequiredError(frappe.ValidationError): pass
|
class QualityInspectionRequiredError(frappe.ValidationError): pass
|
||||||
@ -134,7 +134,7 @@ class StockController(AccountsController):
|
|||||||
"against": expense_account,
|
"against": expense_account,
|
||||||
"cost_center": item_row.cost_center,
|
"cost_center": item_row.cost_center,
|
||||||
"project": item_row.project or self.get('project'),
|
"project": item_row.project or self.get('project'),
|
||||||
"remarks": self.get("remarks") or "Accounting Entry for Stock",
|
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||||
"debit": flt(sle.stock_value_difference, precision),
|
"debit": flt(sle.stock_value_difference, precision),
|
||||||
"is_opening": item_row.get("is_opening") or self.get("is_opening") or "No",
|
"is_opening": item_row.get("is_opening") or self.get("is_opening") or "No",
|
||||||
}, warehouse_account[sle.warehouse]["account_currency"], item=item_row))
|
}, warehouse_account[sle.warehouse]["account_currency"], item=item_row))
|
||||||
@ -143,7 +143,7 @@ class StockController(AccountsController):
|
|||||||
"account": expense_account,
|
"account": expense_account,
|
||||||
"against": warehouse_account[sle.warehouse]["account"],
|
"against": warehouse_account[sle.warehouse]["account"],
|
||||||
"cost_center": item_row.cost_center,
|
"cost_center": item_row.cost_center,
|
||||||
"remarks": self.get("remarks") or "Accounting Entry for Stock",
|
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||||
"credit": flt(sle.stock_value_difference, precision),
|
"credit": flt(sle.stock_value_difference, precision),
|
||||||
"project": item_row.get("project") or self.get("project"),
|
"project": item_row.get("project") or self.get("project"),
|
||||||
"is_opening": item_row.get("is_opening") or self.get("is_opening") or "No"
|
"is_opening": item_row.get("is_opening") or self.get("is_opening") or "No"
|
||||||
@ -544,7 +544,12 @@ class StockController(AccountsController):
|
|||||||
"company": self.company
|
"company": self.company
|
||||||
})
|
})
|
||||||
if future_sle_exists(args):
|
if future_sle_exists(args):
|
||||||
create_repost_item_valuation_entry(args)
|
item_based_reposting = cint(frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting"))
|
||||||
|
if item_based_reposting:
|
||||||
|
create_item_wise_repost_entries(voucher_type=self.doctype, voucher_no=self.name)
|
||||||
|
else:
|
||||||
|
create_repost_item_valuation_entry(args)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_quality_inspections(doctype, docname, items):
|
def make_quality_inspections(doctype, docname, items):
|
||||||
@ -676,5 +681,38 @@ def create_repost_item_valuation_entry(args):
|
|||||||
repost_entry.company = args.company
|
repost_entry.company = args.company
|
||||||
repost_entry.allow_zero_rate = args.allow_zero_rate
|
repost_entry.allow_zero_rate = args.allow_zero_rate
|
||||||
repost_entry.flags.ignore_links = True
|
repost_entry.flags.ignore_links = True
|
||||||
|
repost_entry.flags.ignore_permissions = True
|
||||||
repost_entry.save()
|
repost_entry.save()
|
||||||
repost_entry.submit()
|
repost_entry.submit()
|
||||||
|
|
||||||
|
|
||||||
|
def create_item_wise_repost_entries(voucher_type, voucher_no, allow_zero_rate=False):
|
||||||
|
"""Using a voucher create repost item valuation records for all item-warehouse pairs."""
|
||||||
|
|
||||||
|
stock_ledger_entries = get_items_to_be_repost(voucher_type, voucher_no)
|
||||||
|
|
||||||
|
distinct_item_warehouses = set()
|
||||||
|
repost_entries = []
|
||||||
|
|
||||||
|
for sle in stock_ledger_entries:
|
||||||
|
item_wh = (sle.item_code, sle.warehouse)
|
||||||
|
if item_wh in distinct_item_warehouses:
|
||||||
|
continue
|
||||||
|
distinct_item_warehouses.add(item_wh)
|
||||||
|
|
||||||
|
repost_entry = frappe.new_doc("Repost Item Valuation")
|
||||||
|
repost_entry.based_on = "Item and Warehouse"
|
||||||
|
repost_entry.voucher_type = voucher_type
|
||||||
|
repost_entry.voucher_no = voucher_no
|
||||||
|
|
||||||
|
repost_entry.item_code = sle.item_code
|
||||||
|
repost_entry.warehouse = sle.warehouse
|
||||||
|
repost_entry.posting_date = sle.posting_date
|
||||||
|
repost_entry.posting_time = sle.posting_time
|
||||||
|
repost_entry.allow_zero_rate = allow_zero_rate
|
||||||
|
repost_entry.flags.ignore_links = True
|
||||||
|
repost_entry.flags.ignore_permissions = True
|
||||||
|
repost_entry.submit()
|
||||||
|
repost_entries.append(repost_entry)
|
||||||
|
|
||||||
|
return repost_entries
|
||||||
|
@ -50,6 +50,7 @@ class calculate_taxes_and_totals(object):
|
|||||||
self.initialize_taxes()
|
self.initialize_taxes()
|
||||||
self.determine_exclusive_rate()
|
self.determine_exclusive_rate()
|
||||||
self.calculate_net_total()
|
self.calculate_net_total()
|
||||||
|
self.calculate_shipping_charges()
|
||||||
self.calculate_taxes()
|
self.calculate_taxes()
|
||||||
self.manipulate_grand_total_for_inclusive_tax()
|
self.manipulate_grand_total_for_inclusive_tax()
|
||||||
self.calculate_totals()
|
self.calculate_totals()
|
||||||
@ -258,6 +259,11 @@ class calculate_taxes_and_totals(object):
|
|||||||
|
|
||||||
self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"])
|
self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"])
|
||||||
|
|
||||||
|
def calculate_shipping_charges(self):
|
||||||
|
if hasattr(self.doc, "shipping_rule") and self.doc.shipping_rule:
|
||||||
|
shipping_rule = frappe.get_doc("Shipping Rule", self.doc.shipping_rule)
|
||||||
|
shipping_rule.apply(self.doc)
|
||||||
|
|
||||||
def calculate_taxes(self):
|
def calculate_taxes(self):
|
||||||
if not self.doc.get('is_consolidated'):
|
if not self.doc.get('is_consolidated'):
|
||||||
self.doc.rounding_adjustment = 0
|
self.doc.rounding_adjustment = 0
|
||||||
|
@ -125,7 +125,7 @@ def get_student_guardians(student):
|
|||||||
|
|
||||||
:param student: Student.
|
:param student: Student.
|
||||||
"""
|
"""
|
||||||
guardians = frappe.get_list("Student Guardian", fields=["guardian"] ,
|
guardians = frappe.get_all("Student Guardian", fields=["guardian"] ,
|
||||||
filters={"parent": student})
|
filters={"parent": student})
|
||||||
return guardians
|
return guardians
|
||||||
|
|
||||||
@ -137,10 +137,10 @@ def get_student_group_students(student_group, include_inactive=0):
|
|||||||
:param student_group: Student Group.
|
:param student_group: Student Group.
|
||||||
"""
|
"""
|
||||||
if include_inactive:
|
if include_inactive:
|
||||||
students = frappe.get_list("Student Group Student", fields=["student", "student_name"] ,
|
students = frappe.get_all("Student Group Student", fields=["student", "student_name"] ,
|
||||||
filters={"parent": student_group}, order_by= "group_roll_number")
|
filters={"parent": student_group}, order_by= "group_roll_number")
|
||||||
else:
|
else:
|
||||||
students = frappe.get_list("Student Group Student", fields=["student", "student_name"] ,
|
students = frappe.get_all("Student Group Student", fields=["student", "student_name"] ,
|
||||||
filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
|
filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
|
||||||
return students
|
return students
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ def get_fee_components(fee_structure):
|
|||||||
:param fee_structure: Fee Structure.
|
:param fee_structure: Fee Structure.
|
||||||
"""
|
"""
|
||||||
if fee_structure:
|
if fee_structure:
|
||||||
fs = frappe.get_list("Fee Component", fields=["fees_category", "description", "amount"] , filters={"parent": fee_structure}, order_by= "idx")
|
fs = frappe.get_all("Fee Component", fields=["fees_category", "description", "amount"] , filters={"parent": fee_structure}, order_by= "idx")
|
||||||
return fs
|
return fs
|
||||||
|
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ def get_fee_schedule(program, student_category=None):
|
|||||||
:param program: Program.
|
:param program: Program.
|
||||||
:param student_category: Student Category
|
:param student_category: Student Category
|
||||||
"""
|
"""
|
||||||
fs = frappe.get_list("Program Fee", fields=["academic_term", "fee_structure", "due_date", "amount"] ,
|
fs = frappe.get_all("Program Fee", fields=["academic_term", "fee_structure", "due_date", "amount"] ,
|
||||||
filters={"parent": program, "student_category": student_category }, order_by= "idx")
|
filters={"parent": program, "student_category": student_category }, order_by= "idx")
|
||||||
return fs
|
return fs
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ def get_assessment_criteria(course):
|
|||||||
|
|
||||||
:param Course: Course
|
:param Course: Course
|
||||||
"""
|
"""
|
||||||
return frappe.get_list("Course Assessment Criteria", \
|
return frappe.get_all("Course Assessment Criteria",
|
||||||
fields=["assessment_criteria", "weightage"], filters={"parent": course}, order_by= "idx")
|
fields=["assessment_criteria", "weightage"], filters={"parent": course}, order_by= "idx")
|
||||||
|
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ def get_assessment_details(assessment_plan):
|
|||||||
|
|
||||||
:param Assessment Plan: Assessment Plan
|
:param Assessment Plan: Assessment Plan
|
||||||
"""
|
"""
|
||||||
return frappe.get_list("Assessment Plan Criteria", \
|
return frappe.get_all("Assessment Plan Criteria",
|
||||||
fields=["assessment_criteria", "maximum_score", "docstatus"], filters={"parent": assessment_plan}, order_by= "idx")
|
fields=["assessment_criteria", "maximum_score", "docstatus"], filters={"parent": assessment_plan}, order_by= "idx")
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,520 +1,143 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"actions": [],
|
||||||
"allow_guest_to_view": 0,
|
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 0,
|
|
||||||
"autoname": "naming_series:",
|
"autoname": "naming_series:",
|
||||||
"beta": 0,
|
|
||||||
"creation": "2015-09-09 16:34:04.960369",
|
"creation": "2015-09-09 16:34:04.960369",
|
||||||
"custom": 0,
|
|
||||||
"docstatus": 0,
|
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "Document",
|
"document_type": "Document",
|
||||||
"editable_grid": 0,
|
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"student_group",
|
||||||
|
"instructor",
|
||||||
|
"instructor_name",
|
||||||
|
"column_break_2",
|
||||||
|
"naming_series",
|
||||||
|
"course",
|
||||||
|
"color",
|
||||||
|
"section_break_6",
|
||||||
|
"schedule_date",
|
||||||
|
"room",
|
||||||
|
"column_break_9",
|
||||||
|
"from_time",
|
||||||
|
"to_time",
|
||||||
|
"title"
|
||||||
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "student_group",
|
"fieldname": "student_group",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 1,
|
"in_global_search": 1,
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Student Group",
|
"label": "Student Group",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Student Group",
|
"options": "Student Group",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "instructor",
|
"fieldname": "instructor",
|
||||||
"fieldtype": "Link",
|
"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": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Instructor",
|
"label": "Instructor",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Instructor",
|
"options": "Instructor",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fetch_from": "instructor.instructor_name",
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fetch_from": "instructor.Instructor_name",
|
|
||||||
"fieldname": "instructor_name",
|
"fieldname": "instructor_name",
|
||||||
"fieldtype": "Read Only",
|
"fieldtype": "Read Only",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 1,
|
"in_global_search": 1,
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Instructor Name",
|
"label": "Instructor Name",
|
||||||
"length": 0,
|
"read_only": 1
|
||||||
"no_copy": 0,
|
|
||||||
"options": "",
|
|
||||||
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_2",
|
"fieldname": "column_break_2",
|
||||||
"fieldtype": "Column Break",
|
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"default": "",
|
|
||||||
"fieldname": "naming_series",
|
"fieldname": "naming_series",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"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": "Naming Series",
|
"label": "Naming Series",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "EDU-CSH-.YYYY.-",
|
"options": "EDU-CSH-.YYYY.-",
|
||||||
"permlevel": 0,
|
"set_only_once": 1
|
||||||
"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": 1,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "course",
|
"fieldname": "course",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 1,
|
"in_global_search": 1,
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Course",
|
"label": "Course",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Course",
|
"options": "Course",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "color",
|
"fieldname": "color",
|
||||||
"fieldtype": "Color",
|
"fieldtype": "Color",
|
||||||
"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": "Color",
|
"label": "Color",
|
||||||
"length": 0,
|
"print_hide": 1
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 1,
|
|
||||||
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "section_break_6",
|
"fieldname": "section_break_6",
|
||||||
"fieldtype": "Section Break",
|
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"default": "Today",
|
"default": "Today",
|
||||||
"fieldname": "schedule_date",
|
"fieldname": "schedule_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"hidden": 0,
|
"label": "Schedule Date"
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Schedule Date",
|
|
||||||
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "room",
|
"fieldname": "room",
|
||||||
"fieldtype": "Link",
|
"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": "Room",
|
"label": "Room",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Room",
|
"options": "Room",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_9",
|
"fieldname": "column_break_9",
|
||||||
"fieldtype": "Column Break",
|
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "from_time",
|
"fieldname": "from_time",
|
||||||
"fieldtype": "Time",
|
"fieldtype": "Time",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "From Time",
|
"label": "From Time",
|
||||||
"length": 0,
|
"reqd": 1
|
||||||
"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": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "to_time",
|
"fieldname": "to_time",
|
||||||
"fieldtype": "Time",
|
"fieldtype": "Time",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "To Time",
|
"label": "To Time",
|
||||||
"length": 0,
|
"reqd": 1
|
||||||
"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": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "title",
|
"fieldname": "title",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
"ignore_user_permissions": 0,
|
"label": "Title"
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Title",
|
|
||||||
"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
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"links": [],
|
||||||
"hide_heading": 0,
|
"modified": "2021-11-24 11:57:08.164449",
|
||||||
"hide_toolbar": 0,
|
|
||||||
"idx": 0,
|
|
||||||
"image_view": 0,
|
|
||||||
"in_create": 0,
|
|
||||||
"is_submittable": 0,
|
|
||||||
"issingle": 0,
|
|
||||||
"istable": 0,
|
|
||||||
"max_attachments": 0,
|
|
||||||
"menu_index": 0,
|
|
||||||
"modified": "2018-08-21 14:44:51.827225",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Education",
|
"module": "Education",
|
||||||
"name": "Course Schedule",
|
"name": "Course Schedule",
|
||||||
"name_case": "",
|
"naming_rule": "By \"Naming Series\" field",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
"export": 1,
|
"export": 1,
|
||||||
"if_owner": 0,
|
|
||||||
"import": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"role": "Academics User",
|
"role": "Academics User",
|
||||||
"set_user_permissions": 0,
|
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"submit": 0,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quick_entry": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"read_only_onload": 0,
|
|
||||||
"restrict_to_domain": "Education",
|
"restrict_to_domain": "Education",
|
||||||
"show_name_in_global_search": 0,
|
|
||||||
"sort_field": "schedule_date",
|
"sort_field": "schedule_date",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"title_field": "title",
|
"title_field": "title"
|
||||||
"track_changes": 0,
|
|
||||||
"track_seen": 0,
|
|
||||||
"track_views": 0
|
|
||||||
}
|
}
|
@ -1,661 +1,168 @@
|
|||||||
{
|
{
|
||||||
|
"actions": [],
|
||||||
"allow_copy": 1,
|
"allow_copy": 1,
|
||||||
"allow_guest_to_view": 0,
|
|
||||||
"allow_import": 0,
|
|
||||||
"allow_rename": 0,
|
|
||||||
"beta": 0,
|
|
||||||
"creation": "2015-09-23 15:37:38.108475",
|
"creation": "2015-09-23 15:37:38.108475",
|
||||||
"custom": 0,
|
|
||||||
"docstatus": 0,
|
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "Setup",
|
"document_type": "Setup",
|
||||||
"editable_grid": 0,
|
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"student_group",
|
||||||
|
"course",
|
||||||
|
"program",
|
||||||
|
"column_break_3",
|
||||||
|
"academic_year",
|
||||||
|
"academic_term",
|
||||||
|
"section_break_6",
|
||||||
|
"instructor",
|
||||||
|
"instructor_name",
|
||||||
|
"column_break_9",
|
||||||
|
"room",
|
||||||
|
"section_break_7",
|
||||||
|
"course_start_date",
|
||||||
|
"course_end_date",
|
||||||
|
"day",
|
||||||
|
"reschedule",
|
||||||
|
"column_break_15",
|
||||||
|
"from_time",
|
||||||
|
"to_time"
|
||||||
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "student_group",
|
"fieldname": "student_group",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Student Group",
|
"label": "Student Group",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Student Group",
|
"options": "Student Group",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "course",
|
"fieldname": "course",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Course",
|
"label": "Course",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Course",
|
"options": "Course",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "program",
|
"fieldname": "program",
|
||||||
"fieldtype": "Link",
|
"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": "Program",
|
"label": "Program",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Program",
|
"options": "Program",
|
||||||
"permlevel": 0,
|
"read_only": 1
|
||||||
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_3",
|
"fieldname": "column_break_3",
|
||||||
"fieldtype": "Column Break",
|
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "academic_year",
|
"fieldname": "academic_year",
|
||||||
"fieldtype": "Link",
|
"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": "Academic Year",
|
"label": "Academic Year",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Academic Year",
|
"options": "Academic Year",
|
||||||
"permlevel": 0,
|
"read_only": 1
|
||||||
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "academic_term",
|
"fieldname": "academic_term",
|
||||||
"fieldtype": "Link",
|
"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": "Academic Term",
|
"label": "Academic Term",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Academic Term",
|
"options": "Academic Term",
|
||||||
"permlevel": 0,
|
"read_only": 1
|
||||||
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "section_break_6",
|
"fieldname": "section_break_6",
|
||||||
"fieldtype": "Section Break",
|
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "instructor",
|
"fieldname": "instructor",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Instructor",
|
"label": "Instructor",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Instructor",
|
"options": "Instructor",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fetch_from": "instructor.instructor_name",
|
"fetch_from": "instructor.instructor_name",
|
||||||
"fieldname": "instructor_name",
|
"fieldname": "instructor_name",
|
||||||
"fieldtype": "Read Only",
|
"fieldtype": "Read Only",
|
||||||
"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": "Instructor Name",
|
"label": "Instructor Name",
|
||||||
"length": 0,
|
"read_only": 1
|
||||||
"no_copy": 0,
|
|
||||||
"options": "",
|
|
||||||
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_9",
|
"fieldname": "column_break_9",
|
||||||
"fieldtype": "Column Break",
|
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "room",
|
"fieldname": "room",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Room",
|
"label": "Room",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Room",
|
"options": "Room",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "section_break_7",
|
"fieldname": "section_break_7",
|
||||||
"fieldtype": "Section Break",
|
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"default": "",
|
|
||||||
"fieldname": "from_time",
|
"fieldname": "from_time",
|
||||||
"fieldtype": "Time",
|
"fieldtype": "Time",
|
||||||
"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": "From Time",
|
"label": "From Time",
|
||||||
"length": 0,
|
"reqd": 1
|
||||||
"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": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"default": "",
|
|
||||||
"fieldname": "course_start_date",
|
"fieldname": "course_start_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"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": "Course Start Date",
|
"label": "Course Start Date",
|
||||||
"length": 0,
|
"reqd": 1
|
||||||
"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": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "day",
|
"fieldname": "day",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"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": "Day",
|
"label": "Day",
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nSunday",
|
"options": "\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nSunday",
|
||||||
"permlevel": 0,
|
"reqd": 1
|
||||||
"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": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"default": "0",
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "reschedule",
|
"fieldname": "reschedule",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"label": "Reschedule"
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Reschedule",
|
|
||||||
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_15",
|
"fieldname": "column_break_15",
|
||||||
"fieldtype": "Column Break",
|
"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
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "to_time",
|
"fieldname": "to_time",
|
||||||
"fieldtype": "Time",
|
"fieldtype": "Time",
|
||||||
"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": "To TIme",
|
"label": "To TIme",
|
||||||
"length": 0,
|
"reqd": 1
|
||||||
"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": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"default": "",
|
|
||||||
"fieldname": "course_end_date",
|
"fieldname": "course_end_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"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": "Course End Date",
|
"label": "Course End Date",
|
||||||
"length": 0,
|
"reqd": 1
|
||||||
"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": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
|
||||||
"hide_heading": 1,
|
|
||||||
"hide_toolbar": 1,
|
"hide_toolbar": 1,
|
||||||
"idx": 0,
|
|
||||||
"image_view": 0,
|
|
||||||
"in_create": 0,
|
|
||||||
"is_submittable": 0,
|
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"links": [],
|
||||||
"max_attachments": 0,
|
"modified": "2021-11-11 09:33:18.874445",
|
||||||
"menu_index": 0,
|
|
||||||
"modified": "2018-05-16 22:43:29.363798",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Education",
|
"module": "Education",
|
||||||
"name": "Course Scheduling Tool",
|
"name": "Course Scheduling Tool",
|
||||||
"name_case": "",
|
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 0,
|
|
||||||
"email": 0,
|
|
||||||
"export": 0,
|
|
||||||
"if_owner": 0,
|
|
||||||
"import": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"print": 0,
|
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 0,
|
|
||||||
"role": "Academics User",
|
"role": "Academics User",
|
||||||
"set_user_permissions": 0,
|
|
||||||
"share": 0,
|
|
||||||
"submit": 0,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quick_entry": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"read_only_onload": 0,
|
|
||||||
"restrict_to_domain": "Education",
|
"restrict_to_domain": "Education",
|
||||||
"show_name_in_global_search": 0,
|
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"track_changes": 1,
|
"track_changes": 1
|
||||||
"track_seen": 0
|
|
||||||
}
|
}
|
@ -14,24 +14,36 @@ def get_student_attendance_records(based_on, date=None, student_group=None, cour
|
|||||||
student_list = []
|
student_list = []
|
||||||
student_attendance_list = []
|
student_attendance_list = []
|
||||||
|
|
||||||
if based_on=="Course Schedule":
|
if based_on == "Course Schedule":
|
||||||
student_group = frappe.db.get_value("Course Schedule", course_schedule, "student_group")
|
student_group = frappe.db.get_value("Course Schedule", course_schedule, "student_group")
|
||||||
if student_group:
|
if student_group:
|
||||||
student_list = frappe.get_list("Student Group Student", fields=["student", "student_name", "group_roll_number"] , \
|
student_list = frappe.get_all("Student Group Student", fields=["student", "student_name", "group_roll_number"],
|
||||||
filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
|
filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
|
||||||
|
|
||||||
if not student_list:
|
if not student_list:
|
||||||
student_list = frappe.get_list("Student Group Student", fields=["student", "student_name", "group_roll_number"] ,
|
student_list = frappe.get_all("Student Group Student", fields=["student", "student_name", "group_roll_number"],
|
||||||
filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
|
filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
|
||||||
|
|
||||||
|
table = frappe.qb.DocType("Student Attendance")
|
||||||
|
|
||||||
if course_schedule:
|
if course_schedule:
|
||||||
student_attendance_list= frappe.db.sql('''select student, status from `tabStudent Attendance` where \
|
student_attendance_list = (
|
||||||
course_schedule= %s''', (course_schedule), as_dict=1)
|
frappe.qb.from_(table)
|
||||||
|
.select(table.student, table.status)
|
||||||
|
.where(
|
||||||
|
(table.course_schedule == course_schedule)
|
||||||
|
)
|
||||||
|
).run(as_dict=True)
|
||||||
else:
|
else:
|
||||||
student_attendance_list= frappe.db.sql('''select student, status from `tabStudent Attendance` where \
|
student_attendance_list = (
|
||||||
student_group= %s and date= %s and \
|
frappe.qb.from_(table)
|
||||||
(course_schedule is Null or course_schedule='')''',
|
.select(table.student, table.status)
|
||||||
(student_group, date), as_dict=1)
|
.where(
|
||||||
|
(table.student_group == student_group)
|
||||||
|
& (table.date == date)
|
||||||
|
& (table.course_schedule == "") | (table.course_schedule.isnull())
|
||||||
|
)
|
||||||
|
).run(as_dict=True)
|
||||||
|
|
||||||
for attendance in student_attendance_list:
|
for attendance in student_attendance_list:
|
||||||
for student in student_list:
|
for student in student_list:
|
||||||
|
@ -29,17 +29,6 @@
|
|||||||
"onboard": 0,
|
"onboard": 0,
|
||||||
"type": "Link"
|
"type": "Link"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"dependencies": "",
|
|
||||||
"hidden": 0,
|
|
||||||
"is_query_report": 0,
|
|
||||||
"label": "Shopify Settings",
|
|
||||||
"link_count": 0,
|
|
||||||
"link_to": "Shopify Settings",
|
|
||||||
"link_type": "DocType",
|
|
||||||
"onboard": 0,
|
|
||||||
"type": "Link"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"dependencies": "",
|
"dependencies": "",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -74,7 +63,7 @@
|
|||||||
"type": "Link"
|
"type": "Link"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-08-05 12:15:58.951705",
|
"modified": "2021-11-23 04:30:33.106991",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Integrations",
|
"module": "ERPNext Integrations",
|
||||||
"name": "ERPNext Integrations Settings",
|
"name": "ERPNext Integrations Settings",
|
||||||
|
@ -306,7 +306,8 @@ doc_events = {
|
|||||||
'validate': ["erpnext.erpnext_integrations.taxjar_integration.set_sales_tax"]
|
'validate': ["erpnext.erpnext_integrations.taxjar_integration.set_sales_tax"]
|
||||||
},
|
},
|
||||||
"Company": {
|
"Company": {
|
||||||
"on_trash": "erpnext.regional.india.utils.delete_gst_settings_for_company"
|
"on_trash": ["erpnext.regional.india.utils.delete_gst_settings_for_company",
|
||||||
|
"erpnext.regional.saudi_arabia.utils.delete_vat_settings_for_company"]
|
||||||
},
|
},
|
||||||
"Integration Request": {
|
"Integration Request": {
|
||||||
"validate": "erpnext.accounts.doctype.payment_request.payment_request.validate_payment"
|
"validate": "erpnext.accounts.doctype.payment_request.payment_request.validate_payment"
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
from frappe.query_builder.functions import Sum
|
||||||
from frappe.utils import flt, nowdate
|
from frappe.utils import flt, nowdate
|
||||||
|
|
||||||
import erpnext
|
import erpnext
|
||||||
@ -41,24 +42,34 @@ class EmployeeAdvance(Document):
|
|||||||
self.status = "Cancelled"
|
self.status = "Cancelled"
|
||||||
|
|
||||||
def set_total_advance_paid(self):
|
def set_total_advance_paid(self):
|
||||||
paid_amount = frappe.db.sql("""
|
gle = frappe.qb.DocType("GL Entry")
|
||||||
select ifnull(sum(debit), 0) as paid_amount
|
|
||||||
from `tabGL Entry`
|
|
||||||
where against_voucher_type = 'Employee Advance'
|
|
||||||
and against_voucher = %s
|
|
||||||
and party_type = 'Employee'
|
|
||||||
and party = %s
|
|
||||||
""", (self.name, self.employee), as_dict=1)[0].paid_amount
|
|
||||||
|
|
||||||
return_amount = frappe.db.sql("""
|
paid_amount = (
|
||||||
select ifnull(sum(credit), 0) as return_amount
|
frappe.qb.from_(gle)
|
||||||
from `tabGL Entry`
|
.select(Sum(gle.debit).as_("paid_amount"))
|
||||||
where against_voucher_type = 'Employee Advance'
|
.where(
|
||||||
and voucher_type != 'Expense Claim'
|
(gle.against_voucher_type == 'Employee Advance')
|
||||||
and against_voucher = %s
|
& (gle.against_voucher == self.name)
|
||||||
and party_type = 'Employee'
|
& (gle.party_type == 'Employee')
|
||||||
and party = %s
|
& (gle.party == self.employee)
|
||||||
""", (self.name, self.employee), as_dict=1)[0].return_amount
|
& (gle.docstatus == 1)
|
||||||
|
& (gle.is_cancelled == 0)
|
||||||
|
)
|
||||||
|
).run(as_dict=True)[0].paid_amount or 0
|
||||||
|
|
||||||
|
return_amount = (
|
||||||
|
frappe.qb.from_(gle)
|
||||||
|
.select(Sum(gle.credit).as_("return_amount"))
|
||||||
|
.where(
|
||||||
|
(gle.against_voucher_type == 'Employee Advance')
|
||||||
|
& (gle.voucher_type != 'Expense Claim')
|
||||||
|
& (gle.against_voucher == self.name)
|
||||||
|
& (gle.party_type == 'Employee')
|
||||||
|
& (gle.party == self.employee)
|
||||||
|
& (gle.docstatus == 1)
|
||||||
|
& (gle.is_cancelled == 0)
|
||||||
|
)
|
||||||
|
).run(as_dict=True)[0].return_amount or 0
|
||||||
|
|
||||||
if paid_amount != 0:
|
if paid_amount != 0:
|
||||||
paid_amount = flt(paid_amount) / flt(self.exchange_rate)
|
paid_amount = flt(paid_amount) / flt(self.exchange_rate)
|
||||||
|
@ -34,6 +34,24 @@ class TestEmployeeAdvance(unittest.TestCase):
|
|||||||
journal_entry1 = make_payment_entry(advance)
|
journal_entry1 = make_payment_entry(advance)
|
||||||
self.assertRaises(EmployeeAdvanceOverPayment, journal_entry1.submit)
|
self.assertRaises(EmployeeAdvanceOverPayment, journal_entry1.submit)
|
||||||
|
|
||||||
|
def test_paid_amount_on_pe_cancellation(self):
|
||||||
|
employee_name = make_employee("_T@employe.advance")
|
||||||
|
advance = make_employee_advance(employee_name)
|
||||||
|
|
||||||
|
pe = make_payment_entry(advance)
|
||||||
|
pe.submit()
|
||||||
|
|
||||||
|
advance.reload()
|
||||||
|
|
||||||
|
self.assertEqual(advance.paid_amount, 1000)
|
||||||
|
self.assertEqual(advance.status, "Paid")
|
||||||
|
|
||||||
|
pe.cancel()
|
||||||
|
advance.reload()
|
||||||
|
|
||||||
|
self.assertEqual(advance.paid_amount, 0)
|
||||||
|
self.assertEqual(advance.status, "Unpaid")
|
||||||
|
|
||||||
def test_repay_unclaimed_amount_from_salary(self):
|
def test_repay_unclaimed_amount_from_salary(self):
|
||||||
employee_name = make_employee("_T@employe.advance")
|
employee_name = make_employee("_T@employe.advance")
|
||||||
advance = make_employee_advance(employee_name, {"repay_unclaimed_amount_from_salary": 1})
|
advance = make_employee_advance(employee_name, {"repay_unclaimed_amount_from_salary": 1})
|
||||||
|
@ -389,7 +389,9 @@ frappe.ui.form.on("Expense Claim Detail", {
|
|||||||
sanctioned_amount: function(frm, cdt, cdn) {
|
sanctioned_amount: function(frm, cdt, cdn) {
|
||||||
cur_frm.cscript.calculate_total(frm.doc, cdt, cdn);
|
cur_frm.cscript.calculate_total(frm.doc, cdt, cdn);
|
||||||
frm.trigger("get_taxes");
|
frm.trigger("get_taxes");
|
||||||
|
frm.trigger("calculate_grand_total");
|
||||||
},
|
},
|
||||||
|
|
||||||
cost_center: function(frm, cdt, cdn) {
|
cost_center: function(frm, cdt, cdn) {
|
||||||
erpnext.utils.copy_value_in_all_rows(frm.doc, cdt, cdn, "expenses", "cost_center");
|
erpnext.utils.copy_value_in_all_rows(frm.doc, cdt, cdn, "expenses", "cost_center");
|
||||||
}
|
}
|
||||||
|
@ -379,11 +379,12 @@
|
|||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-05-04 05:35:12.040199",
|
"modified": "2021-11-22 16:26:57.787838",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Expense Claim",
|
"name": "Expense Claim",
|
||||||
"name_case": "Title Case",
|
"name_case": "Title Case",
|
||||||
|
"naming_rule": "By \"Naming Series\" field",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"actions": [],
|
||||||
"creation": "2017-10-09 16:53:26.410762",
|
"creation": "2017-10-09 16:53:26.410762",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "Document",
|
"document_type": "Document",
|
||||||
@ -50,7 +51,7 @@
|
|||||||
"fieldname": "unclaimed_amount",
|
"fieldname": "unclaimed_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Unclaimed amount",
|
"label": "Unclaimed Amount",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "advance_amount",
|
"oldfieldname": "advance_amount",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
@ -65,7 +66,7 @@
|
|||||||
"fieldname": "allocated_amount",
|
"fieldname": "allocated_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Allocated amount",
|
"label": "Allocated Amount",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "allocated_amount",
|
"oldfieldname": "allocated_amount",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
@ -87,7 +88,7 @@
|
|||||||
],
|
],
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2019-12-17 13:53:22.111766",
|
"modified": "2021-11-22 16:33:58.515819",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Expense Claim Advance",
|
"name": "Expense Claim Advance",
|
||||||
|
@ -94,7 +94,6 @@
|
|||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Sanctioned Amount",
|
"label": "Sanctioned Amount",
|
||||||
"no_copy": 1,
|
|
||||||
"oldfieldname": "sanctioned_amount",
|
"oldfieldname": "sanctioned_amount",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"options": "Company:company:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
@ -120,7 +119,7 @@
|
|||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-09-18 17:26:09.703215",
|
"modified": "2021-11-26 14:23:45.539922",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Expense Claim Detail",
|
"name": "Expense Claim Detail",
|
||||||
|
@ -3,7 +3,39 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
from frappe.utils.data import today
|
||||||
|
|
||||||
# test_records = frappe.get_test_records('Maintenance Visit')
|
# test_records = frappe.get_test_records('Maintenance Visit')
|
||||||
|
|
||||||
class TestMaintenanceVisit(unittest.TestCase):
|
class TestMaintenanceVisit(unittest.TestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def make_maintenance_visit():
|
||||||
|
mv = frappe.new_doc("Maintenance Visit")
|
||||||
|
mv.company = "_Test Company"
|
||||||
|
mv.customer = "_Test Customer"
|
||||||
|
mv.mntc_date = today()
|
||||||
|
mv.completion_status = "Partially Completed"
|
||||||
|
|
||||||
|
sales_person = make_sales_person("Dwight Schrute")
|
||||||
|
|
||||||
|
mv.append("purposes", {
|
||||||
|
"item_code": "_Test Item",
|
||||||
|
"sales_person": "Sales Team",
|
||||||
|
"description": "Test Item",
|
||||||
|
"work_done": "Test Work Done",
|
||||||
|
"service_person": sales_person.name
|
||||||
|
})
|
||||||
|
mv.insert(ignore_permissions=True)
|
||||||
|
|
||||||
|
return mv
|
||||||
|
|
||||||
|
def make_sales_person(name):
|
||||||
|
sales_person = frappe.get_doc({
|
||||||
|
'doctype': "Sales Person",
|
||||||
|
'sales_person_name': name
|
||||||
|
})
|
||||||
|
sales_person.insert(ignore_if_duplicate = True)
|
||||||
|
|
||||||
|
return sales_person
|
||||||
|
@ -680,12 +680,6 @@ frappe.ui.form.on("BOM Item", "items_remove", function(frm) {
|
|||||||
erpnext.bom.calculate_total(frm.doc);
|
erpnext.bom.calculate_total(frm.doc);
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on("BOM", "with_operations", function(frm) {
|
|
||||||
if(!cint(frm.doc.with_operations)) {
|
|
||||||
frm.set_value("operations", []);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
frappe.tour['BOM'] = [
|
frappe.tour['BOM'] = [
|
||||||
{
|
{
|
||||||
fieldname: "item",
|
fieldname: "item",
|
||||||
|
@ -237,6 +237,7 @@
|
|||||||
"options": "Price List"
|
"options": "Price List"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "with_operations",
|
||||||
"fieldname": "operations_section",
|
"fieldname": "operations_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hide_border": 1,
|
"hide_border": 1,
|
||||||
@ -539,7 +540,7 @@
|
|||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-10-27 14:52:04.500251",
|
"modified": "2021-11-18 13:04:16.271975",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM",
|
"name": "BOM",
|
||||||
|
@ -16,26 +16,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr style="margin: 15px -15px;">
|
<hr style="margin: 15px -15px;">
|
||||||
<p>
|
<p>
|
||||||
{% if data.value %}
|
{% if data.value && data.value != "BOM" %}
|
||||||
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="#Form/BOM/{{ data.value }}">
|
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="/app/bom/{{ data.value }}">
|
||||||
{{ __("Open BOM {0}", [data.value.bold()]) }}</a>
|
{{ __("Open BOM {0}", [data.value.bold()]) }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if data.item_code %}
|
{% if data.item_code %}
|
||||||
<a class="btn btn-default btn-xs" href="#Form/Item/{{ data.item_code }}">
|
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="/app/item/{{ data.item_code }}">
|
||||||
{{ __("Open Item {0}", [data.item_code.bold()]) }}</a>
|
{{ __("Open Item {0}", [data.item_code.bold()]) }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr style="margin: 15px -15px;">
|
|
||||||
<p>
|
|
||||||
{% if data.value %}
|
|
||||||
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="/app/Form/BOM/{{ data.value }}">
|
|
||||||
{{ __("Open BOM {0}", [data.value.bold()]) }}</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if data.item_code %}
|
|
||||||
<a class="btn btn-default btn-xs" href="/app/Form/Item/{{ data.item_code }}">
|
|
||||||
{{ __("Open Item {0}", [data.item_code.bold()]) }}</a>
|
|
||||||
{% endif %}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,6 +66,7 @@ frappe.treeview_settings["BOM"] = {
|
|||||||
var bom = frappe.model.get_doc("BOM", node.data.value);
|
var bom = frappe.model.get_doc("BOM", node.data.value);
|
||||||
node.data.image = escape(bom.image) || "";
|
node.data.image = escape(bom.image) || "";
|
||||||
node.data.description = bom.description || "";
|
node.data.description = bom.description || "";
|
||||||
|
node.data.item_code = bom.item || "";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,18 +23,12 @@ frappe.ui.form.on('Job Card', {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm) {
|
|
||||||
if (frm.doc.scrap_items.length == 0) {
|
|
||||||
frm.fields_dict['scrap_items_section'].collapse();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frappe.flags.pause_job = 0;
|
frappe.flags.pause_job = 0;
|
||||||
frappe.flags.resume_job = 0;
|
frappe.flags.resume_job = 0;
|
||||||
let has_items = frm.doc.items && frm.doc.items.length;
|
let has_items = frm.doc.items && frm.doc.items.length;
|
||||||
|
|
||||||
if (frm.doc.__onload.work_order_stopped) {
|
if (frm.doc.__onload.work_order_closed) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class JobCard(Document):
|
|||||||
def onload(self):
|
def onload(self):
|
||||||
excess_transfer = frappe.db.get_single_value("Manufacturing Settings", "job_card_excess_transfer")
|
excess_transfer = frappe.db.get_single_value("Manufacturing Settings", "job_card_excess_transfer")
|
||||||
self.set_onload("job_card_excess_transfer", excess_transfer)
|
self.set_onload("job_card_excess_transfer", excess_transfer)
|
||||||
self.set_onload("work_order_stopped", self.is_work_order_stopped())
|
self.set_onload("work_order_closed", self.is_work_order_closed())
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_time_logs()
|
self.validate_time_logs()
|
||||||
@ -549,10 +549,10 @@ class JobCard(Document):
|
|||||||
.format(message, bold(row.operation), bold(self.operation)), OperationSequenceError)
|
.format(message, bold(row.operation), bold(self.operation)), OperationSequenceError)
|
||||||
|
|
||||||
def validate_work_order(self):
|
def validate_work_order(self):
|
||||||
if self.is_work_order_stopped():
|
if self.is_work_order_closed():
|
||||||
frappe.throw(_("You can't make any changes to Job Card since Work Order is stopped."))
|
frappe.throw(_("You can't make any changes to Job Card since Work Order is closed."))
|
||||||
|
|
||||||
def is_work_order_stopped(self):
|
def is_work_order_closed(self):
|
||||||
if self.work_order:
|
if self.work_order:
|
||||||
status = frappe.get_value('Work Order', self.work_order)
|
status = frappe.get_value('Work Order', self.work_order)
|
||||||
|
|
||||||
@ -627,17 +627,22 @@ def make_material_request(source_name, target_doc=None):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_stock_entry(source_name, target_doc=None):
|
def make_stock_entry(source_name, target_doc=None):
|
||||||
def update_item(obj, target, source_parent):
|
def update_item(source, target, source_parent):
|
||||||
target.t_warehouse = source_parent.wip_warehouse
|
target.t_warehouse = source_parent.wip_warehouse
|
||||||
|
|
||||||
if not target.conversion_factor:
|
if not target.conversion_factor:
|
||||||
target.conversion_factor = 1
|
target.conversion_factor = 1
|
||||||
|
|
||||||
|
pending_rm_qty = flt(source.required_qty) - flt(source.transferred_qty)
|
||||||
|
if pending_rm_qty > 0:
|
||||||
|
target.qty = pending_rm_qty
|
||||||
|
|
||||||
def set_missing_values(source, target):
|
def set_missing_values(source, target):
|
||||||
target.purpose = "Material Transfer for Manufacture"
|
target.purpose = "Material Transfer for Manufacture"
|
||||||
target.from_bom = 1
|
target.from_bom = 1
|
||||||
|
|
||||||
# avoid negative 'For Quantity'
|
# avoid negative 'For Quantity'
|
||||||
pending_fg_qty = source.get('for_quantity', 0) - source.get('transferred_qty', 0)
|
pending_fg_qty = flt(source.get('for_quantity', 0)) - flt(source.get('transferred_qty', 0))
|
||||||
target.fg_completed_qty = pending_fg_qty if pending_fg_qty > 0 else 0
|
target.fg_completed_qty = pending_fg_qty if pending_fg_qty > 0 else 0
|
||||||
|
|
||||||
target.set_transfer_qty()
|
target.set_transfer_qty()
|
||||||
|
@ -15,11 +15,22 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
|
|||||||
|
|
||||||
|
|
||||||
class TestJobCard(unittest.TestCase):
|
class TestJobCard(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
make_bom_for_jc_tests()
|
||||||
|
|
||||||
transfer_material_against, source_warehouse = None, None
|
transfer_material_against, source_warehouse = None, None
|
||||||
tests_that_transfer_against_jc = ("test_job_card_multiple_materials_transfer",
|
|
||||||
"test_job_card_excess_material_transfer")
|
tests_that_skip_setup = (
|
||||||
|
"test_job_card_material_transfer_correctness",
|
||||||
|
)
|
||||||
|
tests_that_transfer_against_jc = (
|
||||||
|
"test_job_card_multiple_materials_transfer",
|
||||||
|
"test_job_card_excess_material_transfer",
|
||||||
|
"test_job_card_partial_material_transfer"
|
||||||
|
)
|
||||||
|
|
||||||
|
if self._testMethodName in tests_that_skip_setup:
|
||||||
|
return
|
||||||
|
|
||||||
if self._testMethodName in tests_that_transfer_against_jc:
|
if self._testMethodName in tests_that_transfer_against_jc:
|
||||||
transfer_material_against = "Job Card"
|
transfer_material_against = "Job Card"
|
||||||
@ -191,3 +202,131 @@ class TestJobCard(unittest.TestCase):
|
|||||||
|
|
||||||
# JC is Completed with excess transfer
|
# JC is Completed with excess transfer
|
||||||
self.assertEqual(job_card.status, "Completed")
|
self.assertEqual(job_card.status, "Completed")
|
||||||
|
|
||||||
|
def test_job_card_partial_material_transfer(self):
|
||||||
|
"Test partial material transfer against Job Card"
|
||||||
|
|
||||||
|
make_stock_entry(item_code="_Test Item", target="Stores - _TC",
|
||||||
|
qty=25, basic_rate=100)
|
||||||
|
make_stock_entry(item_code="_Test Item Home Desktop Manufactured",
|
||||||
|
target="Stores - _TC", qty=15, basic_rate=100)
|
||||||
|
|
||||||
|
job_card_name = frappe.db.get_value("Job Card", {'work_order': self.work_order.name})
|
||||||
|
job_card = frappe.get_doc("Job Card", job_card_name)
|
||||||
|
|
||||||
|
# partially transfer
|
||||||
|
transfer_entry = make_stock_entry_from_jc(job_card_name)
|
||||||
|
transfer_entry.fg_completed_qty = 1
|
||||||
|
transfer_entry.get_items()
|
||||||
|
transfer_entry.insert()
|
||||||
|
transfer_entry.submit()
|
||||||
|
|
||||||
|
job_card.reload()
|
||||||
|
self.assertEqual(job_card.transferred_qty, 1)
|
||||||
|
self.assertEqual(transfer_entry.items[0].qty, 5)
|
||||||
|
self.assertEqual(transfer_entry.items[1].qty, 3)
|
||||||
|
|
||||||
|
# transfer remaining
|
||||||
|
transfer_entry_2 = make_stock_entry_from_jc(job_card_name)
|
||||||
|
|
||||||
|
self.assertEqual(transfer_entry_2.fg_completed_qty, 1)
|
||||||
|
self.assertEqual(transfer_entry_2.items[0].qty, 5)
|
||||||
|
self.assertEqual(transfer_entry_2.items[1].qty, 3)
|
||||||
|
|
||||||
|
transfer_entry_2.insert()
|
||||||
|
transfer_entry_2.submit()
|
||||||
|
|
||||||
|
job_card.reload()
|
||||||
|
self.assertEqual(job_card.transferred_qty, 2)
|
||||||
|
|
||||||
|
def test_job_card_material_transfer_correctness(self):
|
||||||
|
"""
|
||||||
|
1. Test if only current Job Card Items are pulled in a Stock Entry against a Job Card
|
||||||
|
2. Test impact of changing 'For Qty' in such a Stock Entry
|
||||||
|
"""
|
||||||
|
create_bom_with_multiple_operations()
|
||||||
|
work_order = make_wo_with_transfer_against_jc()
|
||||||
|
|
||||||
|
job_card_name = frappe.db.get_value(
|
||||||
|
"Job Card",
|
||||||
|
{"work_order": work_order.name,"operation": "Test Operation A"}
|
||||||
|
)
|
||||||
|
job_card = frappe.get_doc("Job Card", job_card_name)
|
||||||
|
|
||||||
|
self.assertEqual(len(job_card.items), 1)
|
||||||
|
self.assertEqual(job_card.items[0].item_code, "_Test Item")
|
||||||
|
|
||||||
|
# check if right items are mapped in transfer entry
|
||||||
|
transfer_entry = make_stock_entry_from_jc(job_card_name)
|
||||||
|
transfer_entry.insert()
|
||||||
|
|
||||||
|
self.assertEqual(len(transfer_entry.items), 1)
|
||||||
|
self.assertEqual(transfer_entry.items[0].item_code, "_Test Item")
|
||||||
|
self.assertEqual(transfer_entry.items[0].qty, 4)
|
||||||
|
|
||||||
|
# change 'For Qty' and check impact on items table
|
||||||
|
# no.of items should be the same with qty change
|
||||||
|
transfer_entry.fg_completed_qty = 2
|
||||||
|
transfer_entry.get_items()
|
||||||
|
|
||||||
|
self.assertEqual(len(transfer_entry.items), 1)
|
||||||
|
self.assertEqual(transfer_entry.items[0].item_code, "_Test Item")
|
||||||
|
self.assertEqual(transfer_entry.items[0].qty, 2)
|
||||||
|
|
||||||
|
# rollback via tearDown method
|
||||||
|
|
||||||
|
def create_bom_with_multiple_operations():
|
||||||
|
"Create a BOM with multiple operations and Material Transfer against Job Card"
|
||||||
|
from erpnext.manufacturing.doctype.operation.test_operation import make_operation
|
||||||
|
|
||||||
|
test_record = frappe.get_test_records("BOM")[2]
|
||||||
|
bom_doc = frappe.get_doc(test_record)
|
||||||
|
|
||||||
|
row = {
|
||||||
|
"operation": "Test Operation A",
|
||||||
|
"workstation": "_Test Workstation A",
|
||||||
|
"hour_rate_rent": 300,
|
||||||
|
"time_in_mins": 60
|
||||||
|
}
|
||||||
|
make_workstation(row)
|
||||||
|
make_operation(row)
|
||||||
|
|
||||||
|
bom_doc.append("operations", {
|
||||||
|
"operation": "Test Operation A",
|
||||||
|
"description": "Test Operation A",
|
||||||
|
"workstation": "_Test Workstation A",
|
||||||
|
"hour_rate": 300,
|
||||||
|
"time_in_mins": 60,
|
||||||
|
"operating_cost": 100
|
||||||
|
})
|
||||||
|
|
||||||
|
bom_doc.transfer_material_against = "Job Card"
|
||||||
|
bom_doc.save()
|
||||||
|
bom_doc.submit()
|
||||||
|
|
||||||
|
return bom_doc
|
||||||
|
|
||||||
|
def make_wo_with_transfer_against_jc():
|
||||||
|
"Create a WO with multiple operations and Material Transfer against Job Card"
|
||||||
|
|
||||||
|
work_order = make_wo_order_test_record(
|
||||||
|
item="_Test FG Item 2",
|
||||||
|
qty=4,
|
||||||
|
transfer_material_against="Job Card",
|
||||||
|
source_warehouse="Stores - _TC",
|
||||||
|
do_not_submit=True
|
||||||
|
)
|
||||||
|
work_order.required_items[0].operation = "Test Operation A"
|
||||||
|
work_order.required_items[1].operation = "_Test Operation 1"
|
||||||
|
work_order.submit()
|
||||||
|
|
||||||
|
return work_order
|
||||||
|
|
||||||
|
def make_bom_for_jc_tests():
|
||||||
|
test_records = frappe.get_test_records('BOM')
|
||||||
|
bom = frappe.copy_doc(test_records[2])
|
||||||
|
bom.set_rate_of_sub_assembly_item_based_on_bom = 0
|
||||||
|
bom.rm_cost_as_per = "Valuation Rate"
|
||||||
|
bom.items[0].uom = "_Test UOM 1"
|
||||||
|
bom.items[0].conversion_factor = 5
|
||||||
|
bom.insert()
|
@ -17,15 +17,13 @@ def make_operation(*args, **kwargs):
|
|||||||
|
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
|
|
||||||
try:
|
if not frappe.db.exists("Operation", args.operation):
|
||||||
doc = frappe.get_doc({
|
doc = frappe.get_doc({
|
||||||
"doctype": "Operation",
|
"doctype": "Operation",
|
||||||
"name": args.operation,
|
"name": args.operation,
|
||||||
"workstation": args.workstation
|
"workstation": args.workstation
|
||||||
})
|
})
|
||||||
|
|
||||||
doc.insert()
|
doc.insert()
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
except frappe.DuplicateEntryError:
|
|
||||||
return frappe.get_doc("Operation", args.operation)
|
return frappe.get_doc("Operation", args.operation)
|
||||||
|
@ -105,7 +105,7 @@ frappe.ui.form.on('Production Plan', {
|
|||||||
}
|
}
|
||||||
frm.trigger("material_requirement");
|
frm.trigger("material_requirement");
|
||||||
|
|
||||||
const projected_qty_formula = ` <table class="table table-bordered" style="background-color: #f9f9f9;">
|
const projected_qty_formula = ` <table class="table table-bordered" style="background-color: var(--scrollbar-track-color);">
|
||||||
<tr><td style="padding-left:25px">
|
<tr><td style="padding-left:25px">
|
||||||
<div>
|
<div>
|
||||||
<h3 style="text-decoration: underline;">
|
<h3 style="text-decoration: underline;">
|
||||||
@ -238,6 +238,12 @@ frappe.ui.form.on('Production Plan', {
|
|||||||
method: "get_items",
|
method: "get_items",
|
||||||
freeze: true,
|
freeze: true,
|
||||||
doc: frm.doc,
|
doc: frm.doc,
|
||||||
|
callback: function() {
|
||||||
|
frm.refresh_field("po_items");
|
||||||
|
if (frm.doc.sub_assembly_items.length > 0) {
|
||||||
|
frm.trigger("get_sub_assembly_items");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ frappe.ui.form.on("Work Order", {
|
|||||||
additional_operating_cost: function(frm) {
|
additional_operating_cost: function(frm) {
|
||||||
erpnext.work_order.calculate_cost(frm.doc);
|
erpnext.work_order.calculate_cost(frm.doc);
|
||||||
erpnext.work_order.calculate_total_cost(frm);
|
erpnext.work_order.calculate_total_cost(frm);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on("Work Order Item", {
|
frappe.ui.form.on("Work Order Item", {
|
||||||
|
@ -326,6 +326,7 @@
|
|||||||
"label": "Expected Delivery Date"
|
"label": "Expected Delivery Date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"collapsible": 1,
|
||||||
"fieldname": "operations_section",
|
"fieldname": "operations_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Operations",
|
"label": "Operations",
|
||||||
@ -337,7 +338,7 @@
|
|||||||
"fieldname": "transfer_material_against",
|
"fieldname": "transfer_material_against",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Transfer Material Against",
|
"label": "Transfer Material Against",
|
||||||
"options": "\nWork Order\nJob Card"
|
"options": "Work Order\nJob Card"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "operations",
|
"fieldname": "operations",
|
||||||
@ -573,8 +574,7 @@
|
|||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"migration_hash": "a18118963f4fcdb7f9d326de5f4063ba",
|
"modified": "2021-11-08 17:36:07.016300",
|
||||||
"modified": "2021-10-29 15:12:32.203605",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Work Order",
|
"name": "Work Order",
|
||||||
|
@ -6,27 +6,27 @@
|
|||||||
"field_order": [
|
"field_order": [
|
||||||
"details",
|
"details",
|
||||||
"operation",
|
"operation",
|
||||||
"bom",
|
|
||||||
"column_break_4",
|
|
||||||
"description",
|
|
||||||
"sequence_id",
|
|
||||||
"col_break1",
|
|
||||||
"completed_qty",
|
|
||||||
"status",
|
"status",
|
||||||
|
"completed_qty",
|
||||||
|
"column_break_4",
|
||||||
|
"bom",
|
||||||
"workstation",
|
"workstation",
|
||||||
|
"sequence_id",
|
||||||
|
"section_break_10",
|
||||||
|
"description",
|
||||||
"estimated_time_and_cost",
|
"estimated_time_and_cost",
|
||||||
"planned_start_time",
|
"planned_start_time",
|
||||||
"planned_end_time",
|
|
||||||
"column_break_10",
|
|
||||||
"time_in_mins",
|
|
||||||
"hour_rate",
|
"hour_rate",
|
||||||
|
"time_in_mins",
|
||||||
|
"column_break_10",
|
||||||
|
"planned_end_time",
|
||||||
"batch_size",
|
"batch_size",
|
||||||
"planned_operating_cost",
|
"planned_operating_cost",
|
||||||
"section_break_9",
|
"section_break_9",
|
||||||
"actual_start_time",
|
"actual_start_time",
|
||||||
"actual_end_time",
|
|
||||||
"column_break_11",
|
|
||||||
"actual_operation_time",
|
"actual_operation_time",
|
||||||
|
"column_break_11",
|
||||||
|
"actual_end_time",
|
||||||
"actual_operating_cost"
|
"actual_operating_cost"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@ -42,7 +42,6 @@
|
|||||||
"oldfieldname": "operation_no",
|
"oldfieldname": "operation_no",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
"options": "Operation",
|
"options": "Operation",
|
||||||
"read_only": 1,
|
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -52,20 +51,14 @@
|
|||||||
"label": "BOM",
|
"label": "BOM",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "BOM",
|
"options": "BOM",
|
||||||
"print_hide": 1,
|
"print_hide": 1
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
"fieldtype": "Text Editor",
|
"fieldtype": "Text Editor",
|
||||||
"label": "Operation Description",
|
"label": "Operation Description",
|
||||||
"oldfieldname": "opn_description",
|
"oldfieldname": "opn_description",
|
||||||
"oldfieldtype": "Text",
|
"oldfieldtype": "Text"
|
||||||
"read_only": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "col_break1",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"columns": 1,
|
"columns": 1,
|
||||||
@ -74,19 +67,16 @@
|
|||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Completed Qty",
|
"label": "Completed Qty",
|
||||||
"no_copy": 1,
|
"no_copy": 1
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"columns": 1,
|
"columns": 1,
|
||||||
"default": "Pending",
|
"default": "Pending",
|
||||||
"fieldname": "status",
|
"fieldname": "status",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_list_view": 1,
|
|
||||||
"label": "Status",
|
"label": "Status",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "Pending\nWork in Progress\nCompleted",
|
"options": "Pending\nWork in Progress\nCompleted"
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "workstation",
|
"fieldname": "workstation",
|
||||||
@ -106,15 +96,13 @@
|
|||||||
"fieldname": "planned_start_time",
|
"fieldname": "planned_start_time",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"label": "Planned Start Time",
|
"label": "Planned Start Time",
|
||||||
"no_copy": 1,
|
"no_copy": 1
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "planned_end_time",
|
"fieldname": "planned_end_time",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"label": "Planned End Time",
|
"label": "Planned End Time",
|
||||||
"no_copy": 1,
|
"no_copy": 1
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_10",
|
"fieldname": "column_break_10",
|
||||||
@ -122,7 +110,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"columns": 1,
|
"columns": 1,
|
||||||
"description": "in Minutes",
|
"description": "In Minutes",
|
||||||
"fieldname": "time_in_mins",
|
"fieldname": "time_in_mins",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
@ -152,6 +140,7 @@
|
|||||||
"label": "Actual Time and Cost"
|
"label": "Actual Time and Cost"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"description": "Updated via 'Time Log' (In Minutes)",
|
||||||
"fieldname": "actual_start_time",
|
"fieldname": "actual_start_time",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"label": "Actual Start Time",
|
"label": "Actual Start Time",
|
||||||
@ -159,7 +148,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Updated via 'Time Log'",
|
"description": "Updated via 'Time Log' (In Minutes)",
|
||||||
"fieldname": "actual_end_time",
|
"fieldname": "actual_end_time",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"label": "Actual End Time",
|
"label": "Actual End Time",
|
||||||
@ -171,7 +160,7 @@
|
|||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "in Minutes\nUpdated via 'Time Log'",
|
"description": "Updated via 'Time Log' (In Minutes)",
|
||||||
"fieldname": "actual_operation_time",
|
"fieldname": "actual_operation_time",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"label": "Actual Operation Time",
|
"label": "Actual Operation Time",
|
||||||
@ -190,25 +179,28 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "batch_size",
|
"fieldname": "batch_size",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"label": "Batch Size",
|
"label": "Batch Size"
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "sequence_id",
|
"fieldname": "sequence_id",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Sequence ID",
|
"label": "Sequence ID",
|
||||||
"print_hide": 1,
|
"print_hide": 1
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_4",
|
"fieldname": "column_break_4",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_10",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-06-24 14:36:12.835543",
|
"modified": "2021-11-24 04:52:54.295168",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Work Order Operation",
|
"name": "Work Order Operation",
|
||||||
|
@ -89,7 +89,7 @@ def make_workstation(*args, **kwargs):
|
|||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
|
|
||||||
workstation_name = args.workstation_name or args.workstation
|
workstation_name = args.workstation_name or args.workstation
|
||||||
try:
|
if not frappe.db.exists("Workstation", workstation_name):
|
||||||
doc = frappe.get_doc({
|
doc = frappe.get_doc({
|
||||||
"doctype": "Workstation",
|
"doctype": "Workstation",
|
||||||
"workstation_name": workstation_name
|
"workstation_name": workstation_name
|
||||||
@ -99,5 +99,5 @@ def make_workstation(*args, **kwargs):
|
|||||||
doc.insert()
|
doc.insert()
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
except frappe.DuplicateEntryError:
|
|
||||||
return frappe.get_doc("Workstation", workstation_name)
|
return frappe.get_doc("Workstation", workstation_name)
|
||||||
|
@ -89,7 +89,7 @@ def get_bom_stock(filters):
|
|||||||
GROUP BY bom_item.item_code""".format(qty_field=qty_field, table=table, conditions=conditions, bom=bom), as_dict=1)
|
GROUP BY bom_item.item_code""".format(qty_field=qty_field, table=table, conditions=conditions, bom=bom), as_dict=1)
|
||||||
|
|
||||||
def get_manufacturer_records():
|
def get_manufacturer_records():
|
||||||
details = frappe.get_list('Item Manufacturer', fields = ["manufacturer", "manufacturer_part_no", "parent"])
|
details = frappe.get_all('Item Manufacturer', fields = ["manufacturer", "manufacturer_part_no", "parent"])
|
||||||
manufacture_details = frappe._dict()
|
manufacture_details = frappe._dict()
|
||||||
for detail in details:
|
for detail in details:
|
||||||
dic = manufacture_details.setdefault(detail.get('parent'), {})
|
dic = manufacture_details.setdefault(detail.get('parent'), {})
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt
|
||||||
@ -30,7 +29,6 @@ def get_data(report_filters):
|
|||||||
|
|
||||||
for row in job_cards:
|
for row in job_cards:
|
||||||
row.operating_cost = flt(row.hour_rate) * (flt(row.total_time_in_mins) / 60.0)
|
row.operating_cost = flt(row.hour_rate) * (flt(row.total_time_in_mins) / 60.0)
|
||||||
update_raw_material_cost(row, report_filters)
|
|
||||||
data.append(row)
|
data.append(row)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
@ -46,12 +44,6 @@ def get_filters(report_filters, operations):
|
|||||||
|
|
||||||
return filters
|
return filters
|
||||||
|
|
||||||
def update_raw_material_cost(row, filters):
|
|
||||||
row.rm_cost = 0.0
|
|
||||||
for data in frappe.get_all("Job Card Item", fields = ["amount"],
|
|
||||||
filters={"parent": row.name, "docstatus": 1}):
|
|
||||||
row.rm_cost += data.amount
|
|
||||||
|
|
||||||
def get_columns(filters):
|
def get_columns(filters):
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -59,7 +51,7 @@ def get_columns(filters):
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"fieldname": "name",
|
"fieldname": "name",
|
||||||
"options": "Job Card",
|
"options": "Job Card",
|
||||||
"width": "100"
|
"width": "120"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Work Order"),
|
"label": _("Work Order"),
|
||||||
@ -111,18 +103,12 @@ def get_columns(filters):
|
|||||||
"label": _("Operating Cost"),
|
"label": _("Operating Cost"),
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"fieldname": "operating_cost",
|
"fieldname": "operating_cost",
|
||||||
"width": "100"
|
"width": "150"
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": _("Raw Material Cost"),
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"fieldname": "rm_cost",
|
|
||||||
"width": "100"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Total Time (in Mins)"),
|
"label": _("Total Time (in Mins)"),
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"fieldname": "total_time_in_mins",
|
"fieldname": "total_time_in_mins",
|
||||||
"width": "100"
|
"width": "150"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -28,8 +28,15 @@ def get_production_plan_item_details(filters, data, order_details):
|
|||||||
|
|
||||||
production_plan_doc = frappe.get_cached_doc("Production Plan", filters.get("production_plan"))
|
production_plan_doc = frappe.get_cached_doc("Production Plan", filters.get("production_plan"))
|
||||||
for row in production_plan_doc.po_items:
|
for row in production_plan_doc.po_items:
|
||||||
work_order = frappe.get_cached_value("Work Order", {"production_plan_item": row.name,
|
work_order = frappe.get_value(
|
||||||
"bom_no": row.bom_no, "production_item": row.item_code}, "name")
|
"Work Order",
|
||||||
|
{
|
||||||
|
"production_plan_item": row.name,
|
||||||
|
"bom_no": row.bom_no,
|
||||||
|
"production_item": row.item_code
|
||||||
|
},
|
||||||
|
"name"
|
||||||
|
)
|
||||||
|
|
||||||
if row.item_code not in itemwise_indent:
|
if row.item_code not in itemwise_indent:
|
||||||
itemwise_indent.setdefault(row.item_code, {})
|
itemwise_indent.setdefault(row.item_code, {})
|
||||||
@ -40,10 +47,10 @@ def get_production_plan_item_details(filters, data, order_details):
|
|||||||
"item_name": frappe.get_cached_value("Item", row.item_code, "item_name"),
|
"item_name": frappe.get_cached_value("Item", row.item_code, "item_name"),
|
||||||
"qty": row.planned_qty,
|
"qty": row.planned_qty,
|
||||||
"document_type": "Work Order",
|
"document_type": "Work Order",
|
||||||
"document_name": work_order,
|
"document_name": work_order or "",
|
||||||
"bom_level": frappe.get_cached_value("BOM", row.bom_no, "bom_level"),
|
"bom_level": frappe.get_cached_value("BOM", row.bom_no, "bom_level"),
|
||||||
"produced_qty": order_details.get((work_order, row.item_code)).get("produced_qty"),
|
"produced_qty": order_details.get((work_order, row.item_code), {}).get("produced_qty", 0),
|
||||||
"pending_qty": flt(row.planned_qty) - flt(order_details.get((work_order, row.item_code)).get("produced_qty"))
|
"pending_qty": flt(row.planned_qty) - flt(order_details.get((work_order, row.item_code), {}).get("produced_qty", 0))
|
||||||
})
|
})
|
||||||
|
|
||||||
get_production_plan_sub_assembly_item_details(filters, row, production_plan_doc, data, order_details)
|
get_production_plan_sub_assembly_item_details(filters, row, production_plan_doc, data, order_details)
|
||||||
@ -54,11 +61,23 @@ def get_production_plan_sub_assembly_item_details(filters, row, production_plan_
|
|||||||
subcontracted_item = (item.type_of_manufacturing == 'Subcontract')
|
subcontracted_item = (item.type_of_manufacturing == 'Subcontract')
|
||||||
|
|
||||||
if subcontracted_item:
|
if subcontracted_item:
|
||||||
docname = frappe.get_cached_value("Purchase Order Item",
|
docname = frappe.get_value(
|
||||||
{"production_plan_sub_assembly_item": item.name, "docstatus": ("<", 2)}, "parent")
|
"Purchase Order Item",
|
||||||
|
{
|
||||||
|
"production_plan_sub_assembly_item": item.name,
|
||||||
|
"docstatus": ("<", 2)
|
||||||
|
},
|
||||||
|
"parent"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
docname = frappe.get_cached_value("Work Order",
|
docname = frappe.get_value(
|
||||||
{"production_plan_sub_assembly_item": item.name, "docstatus": ("<", 2)}, "name")
|
"Work Order",
|
||||||
|
{
|
||||||
|
"production_plan_sub_assembly_item": item.name,
|
||||||
|
"docstatus": ("<", 2)
|
||||||
|
},
|
||||||
|
"name"
|
||||||
|
)
|
||||||
|
|
||||||
data.append({
|
data.append({
|
||||||
"indent": 1,
|
"indent": 1,
|
||||||
@ -66,10 +85,10 @@ def get_production_plan_sub_assembly_item_details(filters, row, production_plan_
|
|||||||
"item_name": item.item_name,
|
"item_name": item.item_name,
|
||||||
"qty": item.qty,
|
"qty": item.qty,
|
||||||
"document_type": "Work Order" if not subcontracted_item else "Purchase Order",
|
"document_type": "Work Order" if not subcontracted_item else "Purchase Order",
|
||||||
"document_name": docname,
|
"document_name": docname or "",
|
||||||
"bom_level": item.bom_level,
|
"bom_level": item.bom_level,
|
||||||
"produced_qty": order_details.get((docname, item.production_item)).get("produced_qty"),
|
"produced_qty": order_details.get((docname, item.production_item), {}).get("produced_qty", 0),
|
||||||
"pending_qty": flt(item.qty) - flt(order_details.get((docname, item.production_item)).get("produced_qty"))
|
"pending_qty": flt(item.qty) - flt(order_details.get((docname, item.production_item), {}).get("produced_qty", 0))
|
||||||
})
|
})
|
||||||
|
|
||||||
def get_work_order_details(filters, order_details):
|
def get_work_order_details(filters, order_details):
|
||||||
|
@ -51,7 +51,7 @@ frappe.query_reports["Work Order Summary"] = {
|
|||||||
label: __("Status"),
|
label: __("Status"),
|
||||||
fieldname: "status",
|
fieldname: "status",
|
||||||
fieldtype: "Select",
|
fieldtype: "Select",
|
||||||
options: ["", "Not Started", "In Process", "Completed", "Stopped"]
|
options: ["", "Not Started", "In Process", "Completed", "Stopped", "Closed"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __("Sales Orders"),
|
label: __("Sales Orders"),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
@ -58,21 +59,16 @@ def get_chart_data(data, filters):
|
|||||||
return get_chart_based_on_qty(data, filters)
|
return get_chart_based_on_qty(data, filters)
|
||||||
|
|
||||||
def get_chart_based_on_status(data):
|
def get_chart_based_on_status(data):
|
||||||
labels = ["Completed", "In Process", "Stopped", "Not Started"]
|
labels = frappe.get_meta("Work Order").get_options("status").split("\n")
|
||||||
|
if "" in labels:
|
||||||
|
labels.remove("")
|
||||||
|
|
||||||
status_wise_data = {
|
status_wise_data = defaultdict(int)
|
||||||
"Not Started": 0,
|
|
||||||
"In Process": 0,
|
|
||||||
"Stopped": 0,
|
|
||||||
"Completed": 0,
|
|
||||||
"Draft": 0
|
|
||||||
}
|
|
||||||
|
|
||||||
for d in data:
|
for d in data:
|
||||||
status_wise_data[d.status] += 1
|
status_wise_data[d.status] += 1
|
||||||
|
|
||||||
values = [status_wise_data["Completed"], status_wise_data["In Process"],
|
values = [status_wise_data[label] for label in labels]
|
||||||
status_wise_data["Stopped"], status_wise_data["Not Started"]]
|
|
||||||
|
|
||||||
chart = {
|
chart = {
|
||||||
"data": {
|
"data": {
|
||||||
|
@ -287,7 +287,7 @@ erpnext.patches.v14_0.delete_einvoicing_doctypes
|
|||||||
erpnext.patches.v13_0.custom_fields_for_taxjar_integration #08-11-2021
|
erpnext.patches.v13_0.custom_fields_for_taxjar_integration #08-11-2021
|
||||||
erpnext.patches.v13_0.set_operation_time_based_on_operating_cost
|
erpnext.patches.v13_0.set_operation_time_based_on_operating_cost
|
||||||
erpnext.patches.v13_0.validate_options_for_data_field
|
erpnext.patches.v13_0.validate_options_for_data_field
|
||||||
erpnext.patches.v13_0.create_gst_payment_entry_fields
|
erpnext.patches.v13_0.create_gst_payment_entry_fields #27-11-2021
|
||||||
erpnext.patches.v14_0.delete_shopify_doctypes
|
erpnext.patches.v14_0.delete_shopify_doctypes
|
||||||
erpnext.patches.v13_0.fix_invoice_statuses
|
erpnext.patches.v13_0.fix_invoice_statuses
|
||||||
erpnext.patches.v13_0.replace_supplier_item_group_with_party_specific_item
|
erpnext.patches.v13_0.replace_supplier_item_group_with_party_specific_item
|
||||||
@ -306,6 +306,7 @@ erpnext.patches.v13_0.requeue_failed_reposts
|
|||||||
erpnext.patches.v13_0.update_job_card_status
|
erpnext.patches.v13_0.update_job_card_status
|
||||||
erpnext.patches.v12_0.update_production_plan_status
|
erpnext.patches.v12_0.update_production_plan_status
|
||||||
erpnext.patches.v13_0.healthcare_deprecation_warning
|
erpnext.patches.v13_0.healthcare_deprecation_warning
|
||||||
|
erpnext.patches.v13_0.item_naming_series_not_mandatory
|
||||||
erpnext.patches.v14_0.delete_healthcare_doctypes
|
erpnext.patches.v14_0.delete_healthcare_doctypes
|
||||||
erpnext.patches.v13_0.update_category_in_ltds_certificate
|
erpnext.patches.v13_0.update_category_in_ltds_certificate
|
||||||
erpnext.patches.v13_0.create_pan_field_for_india #2
|
erpnext.patches.v13_0.create_pan_field_for_india #2
|
||||||
|
@ -7,6 +7,7 @@ import frappe
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc("setup", "doctype", "target_detail")
|
frappe.reload_doc("setup", "doctype", "target_detail")
|
||||||
|
frappe.reload_doc("core", "doctype", "prepared_report")
|
||||||
|
|
||||||
for d in ['Sales Person', 'Sales Partner', 'Territory']:
|
for d in ['Sales Person', 'Sales Partner', 'Territory']:
|
||||||
frappe.db.sql("""
|
frappe.db.sql("""
|
||||||
|
@ -9,24 +9,29 @@ def execute():
|
|||||||
frappe.reload_doc('accounts', 'doctype', 'advance_taxes_and_charges')
|
frappe.reload_doc('accounts', 'doctype', 'advance_taxes_and_charges')
|
||||||
frappe.reload_doc('accounts', 'doctype', 'payment_entry')
|
frappe.reload_doc('accounts', 'doctype', 'payment_entry')
|
||||||
|
|
||||||
custom_fields = {
|
if frappe.db.exists('Company', {'country': 'India'}):
|
||||||
'Payment Entry': [
|
custom_fields = {
|
||||||
dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break', insert_after='deductions',
|
'Payment Entry': [
|
||||||
print_hide=1, collapsible=1),
|
dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break', insert_after='deductions',
|
||||||
dict(fieldname='company_address', label='Company Address', fieldtype='Link', insert_after='gst_section',
|
print_hide=1, collapsible=1),
|
||||||
print_hide=1, options='Address'),
|
dict(fieldname='company_address', label='Company Address', fieldtype='Link', insert_after='gst_section',
|
||||||
dict(fieldname='company_gstin', label='Company GSTIN',
|
print_hide=1, options='Address'),
|
||||||
fieldtype='Data', insert_after='company_address',
|
dict(fieldname='company_gstin', label='Company GSTIN',
|
||||||
fetch_from='company_address.gstin', print_hide=1, read_only=1),
|
fieldtype='Data', insert_after='company_address',
|
||||||
dict(fieldname='place_of_supply', label='Place of Supply',
|
fetch_from='company_address.gstin', print_hide=1, read_only=1),
|
||||||
fieldtype='Data', insert_after='company_gstin',
|
dict(fieldname='place_of_supply', label='Place of Supply',
|
||||||
print_hide=1, read_only=1),
|
fieldtype='Data', insert_after='company_gstin',
|
||||||
dict(fieldname='customer_address', label='Customer Address', fieldtype='Link', insert_after='place_of_supply',
|
print_hide=1, read_only=1),
|
||||||
print_hide=1, options='Address', depends_on = 'eval:doc.party_type == "Customer"'),
|
dict(fieldname='customer_address', label='Customer Address', fieldtype='Link', insert_after='place_of_supply',
|
||||||
dict(fieldname='customer_gstin', label='Customer GSTIN',
|
print_hide=1, options='Address', depends_on = 'eval:doc.party_type == "Customer"'),
|
||||||
fieldtype='Data', insert_after='customer_address',
|
dict(fieldname='customer_gstin', label='Customer GSTIN',
|
||||||
fetch_from='customer_address.gstin', print_hide=1, read_only=1)
|
fieldtype='Data', insert_after='customer_address',
|
||||||
]
|
fetch_from='customer_address.gstin', print_hide=1, read_only=1)
|
||||||
}
|
]
|
||||||
|
}
|
||||||
|
|
||||||
create_custom_fields(custom_fields, update=True)
|
create_custom_fields(custom_fields, update=True)
|
||||||
|
else:
|
||||||
|
fields = ['gst_section', 'company_address', 'company_gstin', 'place_of_supply', 'customer_address', 'customer_gstin']
|
||||||
|
for field in fields:
|
||||||
|
frappe.delete_doc_if_exists("Custom Field", f"Payment Entry-{field}")
|
11
erpnext/patches/v13_0/item_naming_series_not_mandatory.py
Normal file
11
erpnext/patches/v13_0/item_naming_series_not_mandatory.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
|
||||||
|
stock_settings = frappe.get_doc("Stock Settings")
|
||||||
|
|
||||||
|
set_by_naming_series("Item", "item_code",
|
||||||
|
stock_settings.get("item_naming_by")=="Naming Series", hide_name_field=True, make_mandatory=0)
|
@ -6,10 +6,19 @@ from erpnext.stock.stock_ledger import update_entries_after
|
|||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
for doctype in ('repost_item_valuation', 'stock_entry_detail', 'purchase_receipt_item',
|
doctypes_to_reload = [
|
||||||
'purchase_invoice_item', 'delivery_note_item', 'sales_invoice_item', 'packed_item'):
|
("stock", "repost_item_valuation"),
|
||||||
frappe.reload_doc('stock', 'doctype', doctype)
|
("stock", "stock_entry_detail"),
|
||||||
frappe.reload_doc('buying', 'doctype', 'purchase_receipt_item_supplied')
|
("stock", "purchase_receipt_item"),
|
||||||
|
("stock", "delivery_note_item"),
|
||||||
|
("stock", "packed_item"),
|
||||||
|
("accounts", "sales_invoice_item"),
|
||||||
|
("accounts", "purchase_invoice_item"),
|
||||||
|
("buying", "purchase_receipt_item_supplied")
|
||||||
|
]
|
||||||
|
|
||||||
|
for module, doctype in doctypes_to_reload:
|
||||||
|
frappe.reload_doc(module, 'doctype', doctype)
|
||||||
|
|
||||||
reposting_project_deployed_on = get_creation_time()
|
reposting_project_deployed_on = get_creation_time()
|
||||||
posting_date = getdate(reposting_project_deployed_on)
|
posting_date = getdate(reposting_project_deployed_on)
|
||||||
|
@ -193,7 +193,7 @@ def get_total_applicable_component_amount(employee, applicable_earnings_componen
|
|||||||
sal_slip = get_last_salary_slip(employee)
|
sal_slip = get_last_salary_slip(employee)
|
||||||
if not sal_slip:
|
if not sal_slip:
|
||||||
frappe.throw(_("No Salary Slip is found for Employee: {0}").format(bold(employee)))
|
frappe.throw(_("No Salary Slip is found for Employee: {0}").format(bold(employee)))
|
||||||
component_and_amounts = frappe.get_list("Salary Detail",
|
component_and_amounts = frappe.get_all("Salary Detail",
|
||||||
filters={
|
filters={
|
||||||
"docstatus": 1,
|
"docstatus": 1,
|
||||||
'parent': sal_slip,
|
'parent': sal_slip,
|
||||||
|
@ -48,7 +48,7 @@ class TestGratuity(unittest.TestCase):
|
|||||||
self.assertEqual(floor(experience), gratuity.current_work_experience)
|
self.assertEqual(floor(experience), gratuity.current_work_experience)
|
||||||
|
|
||||||
#amount Calculation
|
#amount Calculation
|
||||||
component_amount = frappe.get_list("Salary Detail",
|
component_amount = frappe.get_all("Salary Detail",
|
||||||
filters={
|
filters={
|
||||||
"docstatus": 1,
|
"docstatus": 1,
|
||||||
'parent': sal_slip,
|
'parent': sal_slip,
|
||||||
@ -84,7 +84,7 @@ class TestGratuity(unittest.TestCase):
|
|||||||
self.assertEqual(floor(experience), gratuity.current_work_experience)
|
self.assertEqual(floor(experience), gratuity.current_work_experience)
|
||||||
|
|
||||||
#amount Calculation
|
#amount Calculation
|
||||||
component_amount = frappe.get_list("Salary Detail",
|
component_amount = frappe.get_all("Salary Detail",
|
||||||
filters={
|
filters={
|
||||||
"docstatus": 1,
|
"docstatus": 1,
|
||||||
'parent': sal_slip,
|
'parent': sal_slip,
|
||||||
|
@ -165,45 +165,33 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
|
|||||||
}
|
}
|
||||||
|
|
||||||
qty(doc, cdt, cdn) {
|
qty(doc, cdt, cdn) {
|
||||||
var item = frappe.get_doc(cdt, cdn);
|
|
||||||
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) {
|
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) {
|
||||||
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
|
this.calculate_received_qty(doc, cdt, cdn)
|
||||||
|
|
||||||
if(!doc.is_return && this.validate_negative_quantity(cdt, cdn, item, ["qty", "received_qty"])){ return }
|
|
||||||
|
|
||||||
if(!item.rejected_qty && item.qty) {
|
|
||||||
item.received_qty = item.qty;
|
|
||||||
}
|
|
||||||
|
|
||||||
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
|
|
||||||
item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item));
|
|
||||||
item.received_stock_qty = flt(item.conversion_factor, precision("conversion_factor", item)) * flt(item.received_qty);
|
|
||||||
}
|
}
|
||||||
super.qty(doc, cdt, cdn);
|
super.qty(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rejected_qty(doc, cdt, cdn) {
|
||||||
|
this.calculate_received_qty(doc, cdt, cdn)
|
||||||
|
}
|
||||||
|
|
||||||
|
calculate_received_qty(doc, cdt, cdn){
|
||||||
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
|
frappe.model.round_floats_in(item, ["qty", "rejected_qty"]);
|
||||||
|
|
||||||
|
if(!doc.is_return && this.validate_negative_quantity(cdt, cdn, item, ["qty", "rejected_qty"])){ return }
|
||||||
|
|
||||||
|
let received_qty = flt(item.qty + item.rejected_qty, precision("received_qty", item));
|
||||||
|
let received_stock_qty = flt(item.conversion_factor, precision("conversion_factor", item)) * flt(received_qty);
|
||||||
|
|
||||||
|
frappe.model.set_value(cdt, cdn, "received_qty", received_qty);
|
||||||
|
frappe.model.set_value(cdt, cdn, "received_stock_qty", received_stock_qty);
|
||||||
|
}
|
||||||
|
|
||||||
batch_no(doc, cdt, cdn) {
|
batch_no(doc, cdt, cdn) {
|
||||||
super.batch_no(doc, cdt, cdn);
|
super.batch_no(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
received_qty(doc, cdt, cdn) {
|
|
||||||
this.calculate_accepted_qty(doc, cdt, cdn)
|
|
||||||
}
|
|
||||||
|
|
||||||
rejected_qty(doc, cdt, cdn) {
|
|
||||||
this.calculate_accepted_qty(doc, cdt, cdn)
|
|
||||||
}
|
|
||||||
|
|
||||||
calculate_accepted_qty(doc, cdt, cdn){
|
|
||||||
var item = frappe.get_doc(cdt, cdn);
|
|
||||||
frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
|
|
||||||
|
|
||||||
if(!doc.is_return && this.validate_negative_quantity(cdt, cdn, item, ["received_qty", "rejected_qty"])){ return }
|
|
||||||
|
|
||||||
item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item));
|
|
||||||
this.qty(doc, cdt, cdn);
|
|
||||||
}
|
|
||||||
|
|
||||||
validate_negative_quantity(cdt, cdn, item, fieldnames){
|
validate_negative_quantity(cdt, cdn, item, fieldnames){
|
||||||
if(!item || !fieldnames) { return }
|
if(!item || !fieldnames) { return }
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
this.initialize_taxes();
|
this.initialize_taxes();
|
||||||
this.determine_exclusive_rate();
|
this.determine_exclusive_rate();
|
||||||
this.calculate_net_total();
|
this.calculate_net_total();
|
||||||
|
this.calculate_shipping_charges();
|
||||||
this.calculate_taxes();
|
this.calculate_taxes();
|
||||||
this.manipulate_grand_total_for_inclusive_tax();
|
this.manipulate_grand_total_for_inclusive_tax();
|
||||||
this.calculate_totals();
|
this.calculate_totals();
|
||||||
@ -266,8 +267,13 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
me.frm.doc.net_total += item.net_amount;
|
me.frm.doc.net_total += item.net_amount;
|
||||||
me.frm.doc.base_net_total += item.base_net_amount;
|
me.frm.doc.base_net_total += item.base_net_amount;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
calculate_shipping_charges() {
|
||||||
frappe.model.round_floats_in(this.frm.doc, ["total", "base_total", "net_total", "base_net_total"]);
|
frappe.model.round_floats_in(this.frm.doc, ["total", "base_total", "net_total", "base_net_total"]);
|
||||||
|
if (frappe.meta.get_docfield(this.frm.doc.doctype, "shipping_rule", this.frm.doc.name)) {
|
||||||
|
this.shipping_rule();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_taxes_from_item_tax_template(item_tax_map) {
|
add_taxes_from_item_tax_template(item_tax_map) {
|
||||||
|
@ -1085,16 +1085,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "apply_shipping_rule",
|
method: "apply_shipping_rule",
|
||||||
callback: function(r) {
|
|
||||||
if(!r.exc) {
|
|
||||||
me.calculate_taxes_and_totals();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).fail(() => this.frm.set_value('shipping_rule', ''));
|
}).fail(() => this.frm.set_value('shipping_rule', ''));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
me.calculate_taxes_and_totals();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_margin_amount_based_on_currency(exchange_rate) {
|
set_margin_amount_based_on_currency(exchange_rate) {
|
||||||
|
@ -751,9 +751,13 @@ frappe.form.link_formatters['Item'] = function(value, doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
frappe.form.link_formatters['Employee'] = function(value, doc) {
|
frappe.form.link_formatters['Employee'] = function(value, doc) {
|
||||||
if(doc && doc.employee_name && doc.employee_name !== value) {
|
if (doc && value && doc.employee_name && doc.employee_name !== value && doc.employee === value) {
|
||||||
return value? value + ': ' + doc.employee_name: doc.employee_name;
|
return value + ': ' + doc.employee_name;
|
||||||
|
} else if (!value && doc.doctype && doc.employee_name) {
|
||||||
|
// format blank value in child table
|
||||||
|
return doc.employee;
|
||||||
} else {
|
} else {
|
||||||
|
// if value is blank in report view or project name and name are the same, return as is
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,45 @@ class TestGSTR3BReport(unittest.TestCase):
|
|||||||
gst_settings.round_off_gst_values = 1
|
gst_settings.round_off_gst_values = 1
|
||||||
gst_settings.save()
|
gst_settings.save()
|
||||||
|
|
||||||
|
def test_gst_category_auto_update(self):
|
||||||
|
if not frappe.db.exists("Customer", "_Test GST Customer With GSTIN"):
|
||||||
|
customer = frappe.get_doc({
|
||||||
|
"customer_group": "_Test Customer Group",
|
||||||
|
"customer_name": "_Test GST Customer With GSTIN",
|
||||||
|
"customer_type": "Individual",
|
||||||
|
"doctype": "Customer",
|
||||||
|
"territory": "_Test Territory"
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
self.assertEqual(customer.gst_category, 'Unregistered')
|
||||||
|
|
||||||
|
if not frappe.db.exists('Address', '_Test GST Category-1-Billing'):
|
||||||
|
address = frappe.get_doc({
|
||||||
|
"address_line1": "_Test Address Line 1",
|
||||||
|
"address_title": "_Test GST Category-1",
|
||||||
|
"address_type": "Billing",
|
||||||
|
"city": "_Test City",
|
||||||
|
"state": "Test State",
|
||||||
|
"country": "India",
|
||||||
|
"doctype": "Address",
|
||||||
|
"is_primary_address": 1,
|
||||||
|
"phone": "+91 0000000000",
|
||||||
|
"gstin": "29AZWPS7135H1ZG",
|
||||||
|
"gst_state": "Karnataka",
|
||||||
|
"gst_state_number": "29"
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
address.append("links", {
|
||||||
|
"link_doctype": "Customer",
|
||||||
|
"link_name": "_Test GST Customer With GSTIN"
|
||||||
|
})
|
||||||
|
|
||||||
|
address.save()
|
||||||
|
|
||||||
|
customer.load_from_db()
|
||||||
|
self.assertEqual(customer.gst_category, 'Registered Regular')
|
||||||
|
|
||||||
|
|
||||||
def make_sales_invoice():
|
def make_sales_invoice():
|
||||||
si = create_sales_invoice(company="_Test Company GST",
|
si = create_sales_invoice(company="_Test Company GST",
|
||||||
customer = '_Test GST Customer',
|
customer = '_Test GST Customer',
|
||||||
|
@ -791,7 +791,7 @@ def set_tax_withholding_category(company):
|
|||||||
accounts = [dict(company=company, account=tds_account)]
|
accounts = [dict(company=company, account=tds_account)]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fiscal_year_details = get_fiscal_year(today(), verbose=0, company=company)
|
fiscal_year_details = get_fiscal_year(today(), verbose=0)
|
||||||
except FiscalYearError:
|
except FiscalYearError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -74,11 +74,11 @@ def validate_tax_category(doc, method):
|
|||||||
frappe.throw(_("Intra State tax category for GST State {0} already exists").format(doc.gst_state))
|
frappe.throw(_("Intra State tax category for GST State {0} already exists").format(doc.gst_state))
|
||||||
|
|
||||||
def update_gst_category(doc, method):
|
def update_gst_category(doc, method):
|
||||||
if hasattr(doc, 'gst_category'):
|
for link in doc.links:
|
||||||
for link in doc.links:
|
if link.link_doctype in ['Customer', 'Supplier']:
|
||||||
if link.link_doctype in ['Customer', 'Supplier']:
|
meta = frappe.get_meta(link.link_doctype)
|
||||||
if doc.get('gstin'):
|
if doc.get('gstin') and meta.has_field('gst_category'):
|
||||||
frappe.db.set_value(link.link_doctype, {'name': link.link_name, 'gst_category': 'Unregistered'}, 'gst_category', 'Registered Regular')
|
frappe.db.set_value(link.link_doctype, {'name': link.link_name, 'gst_category': 'Unregistered'}, 'gst_category', 'Registered Regular')
|
||||||
|
|
||||||
def set_gst_state_and_state_number(doc):
|
def set_gst_state_and_state_number(doc):
|
||||||
if not doc.gst_state:
|
if not doc.gst_state:
|
||||||
|
File diff suppressed because one or more lines are too long
@ -106,14 +106,14 @@ def set_address_details(row, special_characters):
|
|||||||
row.update({'ship_to_state': row.to_state})
|
row.update({'ship_to_state': row.to_state})
|
||||||
|
|
||||||
def set_taxes(row, filters):
|
def set_taxes(row, filters):
|
||||||
taxes = frappe.get_list("Sales Taxes and Charges",
|
taxes = frappe.get_all("Sales Taxes and Charges",
|
||||||
filters={
|
filters={
|
||||||
'parent': row.dn_id
|
'parent': row.dn_id
|
||||||
},
|
},
|
||||||
fields=('item_wise_tax_detail', 'account_head'))
|
fields=('item_wise_tax_detail', 'account_head'))
|
||||||
|
|
||||||
account_list = ["cgst_account", "sgst_account", "igst_account", "cess_account"]
|
account_list = ["cgst_account", "sgst_account", "igst_account", "cess_account"]
|
||||||
taxes_list = frappe.get_list("GST Account",
|
taxes_list = frappe.get_all("GST Account",
|
||||||
filters={
|
filters={
|
||||||
"parent": "GST Settings",
|
"parent": "GST Settings",
|
||||||
"company": filters.company
|
"company": filters.company
|
||||||
|
@ -41,7 +41,7 @@ class VATAuditReport(object):
|
|||||||
return self.columns, self.data
|
return self.columns, self.data
|
||||||
|
|
||||||
def get_sa_vat_accounts(self):
|
def get_sa_vat_accounts(self):
|
||||||
self.sa_vat_accounts = frappe.get_list("South Africa VAT Account",
|
self.sa_vat_accounts = frappe.get_all("South Africa VAT Account",
|
||||||
filters = {"parent": self.filters.company}, pluck="account")
|
filters = {"parent": self.filters.company}, pluck="account")
|
||||||
if not self.sa_vat_accounts and not frappe.flags.in_test and not frappe.flags.in_migrate:
|
if not self.sa_vat_accounts and not frappe.flags.in_test and not frappe.flags.in_migrate:
|
||||||
link_to_settings = get_link_to_form("South Africa VAT Settings", "", label="South Africa VAT Settings")
|
link_to_settings = get_link_to_form("South Africa VAT Settings", "", label="South Africa VAT Settings")
|
||||||
|
@ -28,14 +28,22 @@ def create_qr_code(doc, method):
|
|||||||
|
|
||||||
for field in meta.get_image_fields():
|
for field in meta.get_image_fields():
|
||||||
if field.fieldname == 'qr_code':
|
if field.fieldname == 'qr_code':
|
||||||
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
# Creating public url to print format
|
# Creating public url to print format
|
||||||
default_print_format = frappe.db.get_value('Property Setter', dict(property='default_print_format', doc_type=doc.doctype), "value")
|
default_print_format = frappe.db.get_value('Property Setter', dict(property='default_print_format', doc_type=doc.doctype), "value")
|
||||||
|
|
||||||
# System Language
|
# System Language
|
||||||
language = frappe.get_system_settings('language')
|
language = frappe.get_system_settings('language')
|
||||||
|
|
||||||
|
params = urlencode({
|
||||||
|
'format': default_print_format or 'Standard',
|
||||||
|
'_lang': language,
|
||||||
|
'key': doc.get_signature()
|
||||||
|
})
|
||||||
|
|
||||||
# creating qr code for the url
|
# creating qr code for the url
|
||||||
url = f"{ frappe.utils.get_url() }/{ doc.doctype }/{ doc.name }?format={ default_print_format or 'Standard' }&_lang={ language }&key={ doc.get_signature() }"
|
url = f"{ frappe.utils.get_url() }/{ doc.doctype }/{ doc.name }?{ params }"
|
||||||
qr_image = io.BytesIO()
|
qr_image = io.BytesIO()
|
||||||
url = qr_create(url, error='L')
|
url = qr_create(url, error='L')
|
||||||
url.png(qr_image, scale=2, quiet_zone=1)
|
url.png(qr_image, scale=2, quiet_zone=1)
|
||||||
@ -75,3 +83,10 @@ def delete_qr_code_file(doc, method):
|
|||||||
})
|
})
|
||||||
if len(file_doc):
|
if len(file_doc):
|
||||||
frappe.delete_doc('File', file_doc[0].name)
|
frappe.delete_doc('File', file_doc[0].name)
|
||||||
|
|
||||||
|
def delete_vat_settings_for_company(doc, method):
|
||||||
|
if doc.country != 'Saudi Arabia':
|
||||||
|
return
|
||||||
|
|
||||||
|
settings_doc = frappe.get_doc('KSA VAT Setting', {'company': doc.name})
|
||||||
|
settings_doc.delete()
|
@ -134,6 +134,12 @@ frappe.ui.form.on("Customer", {
|
|||||||
frm.trigger("get_customer_group_details");
|
frm.trigger("get_customer_group_details");
|
||||||
}, __('Actions'));
|
}, __('Actions'));
|
||||||
|
|
||||||
|
if (cint(frappe.defaults.get_default("enable_common_party_accounting"))) {
|
||||||
|
frm.add_custom_button(__('Link with Supplier'), function () {
|
||||||
|
frm.trigger('show_party_link_dialog');
|
||||||
|
}, __('Actions'));
|
||||||
|
}
|
||||||
|
|
||||||
// indicator
|
// indicator
|
||||||
erpnext.utils.set_party_dashboard_indicators(frm);
|
erpnext.utils.set_party_dashboard_indicators(frm);
|
||||||
|
|
||||||
@ -158,5 +164,42 @@ frappe.ui.form.on("Customer", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
show_party_link_dialog: function(frm) {
|
||||||
|
const dialog = new frappe.ui.Dialog({
|
||||||
|
title: __('Select a Supplier'),
|
||||||
|
fields: [{
|
||||||
|
fieldtype: 'Link', label: __('Supplier'),
|
||||||
|
options: 'Supplier', fieldname: 'supplier', reqd: 1
|
||||||
|
}],
|
||||||
|
primary_action: function({ supplier }) {
|
||||||
|
frappe.call({
|
||||||
|
method: 'erpnext.accounts.doctype.party_link.party_link.create_party_link',
|
||||||
|
args: {
|
||||||
|
primary_role: 'Customer',
|
||||||
|
primary_party: frm.doc.name,
|
||||||
|
secondary_party: supplier
|
||||||
|
},
|
||||||
|
freeze: true,
|
||||||
|
callback: function() {
|
||||||
|
dialog.hide();
|
||||||
|
frappe.msgprint({
|
||||||
|
message: __('Successfully linked to Supplier'),
|
||||||
|
alert: true
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
dialog.hide();
|
||||||
|
frappe.msgprint({
|
||||||
|
message: __('Linking to Supplier Failed. Please try again.'),
|
||||||
|
title: __('Linking Failed'),
|
||||||
|
indicator: 'red'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
primary_action_label: __('Create Link')
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,11 @@ from frappe.model.rename_doc import update_linked_doctypes
|
|||||||
from frappe.utils import cint, cstr, flt, get_formatted_email, today
|
from frappe.utils import cint, cstr, flt, get_formatted_email, today
|
||||||
from frappe.utils.user import get_users_with_role
|
from frappe.utils.user import get_users_with_role
|
||||||
|
|
||||||
from erpnext.accounts.party import get_dashboard_info, validate_party_accounts
|
from erpnext.accounts.party import ( # noqa
|
||||||
|
get_dashboard_info,
|
||||||
|
get_timeline_data,
|
||||||
|
validate_party_accounts,
|
||||||
|
)
|
||||||
from erpnext.utilities.transaction_base import TransactionBase
|
from erpnext.utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
|
|
||||||
@ -463,11 +467,14 @@ def get_customer_list(doctype, txt, searchfield, start, page_len, filters=None):
|
|||||||
|
|
||||||
|
|
||||||
def check_credit_limit(customer, company, ignore_outstanding_sales_order=False, extra_amount=0):
|
def check_credit_limit(customer, company, ignore_outstanding_sales_order=False, extra_amount=0):
|
||||||
|
credit_limit = get_credit_limit(customer, company)
|
||||||
|
if not credit_limit:
|
||||||
|
return
|
||||||
|
|
||||||
customer_outstanding = get_customer_outstanding(customer, company, ignore_outstanding_sales_order)
|
customer_outstanding = get_customer_outstanding(customer, company, ignore_outstanding_sales_order)
|
||||||
if extra_amount > 0:
|
if extra_amount > 0:
|
||||||
customer_outstanding += flt(extra_amount)
|
customer_outstanding += flt(extra_amount)
|
||||||
|
|
||||||
credit_limit = get_credit_limit(customer, company)
|
|
||||||
if credit_limit > 0 and flt(customer_outstanding) > credit_limit:
|
if credit_limit > 0 and flt(customer_outstanding) > credit_limit:
|
||||||
msgprint(_("Credit limit has been crossed for customer {0} ({1}/{2})")
|
msgprint(_("Credit limit has been crossed for customer {0} ({1}/{2})")
|
||||||
.format(customer, customer_outstanding, credit_limit))
|
.format(customer, customer_outstanding, credit_limit))
|
||||||
|
@ -319,7 +319,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
|||||||
title: __('Select Items to Manufacture'),
|
title: __('Select Items to Manufacture'),
|
||||||
fields: fields,
|
fields: fields,
|
||||||
primary_action: function() {
|
primary_action: function() {
|
||||||
var data = d.get_values();
|
var data = {items: d.fields_dict.items.grid.get_selected_children()};
|
||||||
me.frm.call({
|
me.frm.call({
|
||||||
method: 'make_work_orders',
|
method: 'make_work_orders',
|
||||||
args: {
|
args: {
|
||||||
|
@ -223,60 +223,15 @@ class SalesOrder(SellingController):
|
|||||||
check_credit_limit(self.customer, self.company)
|
check_credit_limit(self.customer, self.company)
|
||||||
|
|
||||||
def check_nextdoc_docstatus(self):
|
def check_nextdoc_docstatus(self):
|
||||||
# Checks Delivery Note
|
linked_invoices = frappe.db.sql_list("""select distinct t1.name
|
||||||
submit_dn = frappe.db.sql_list("""
|
|
||||||
select t1.name
|
|
||||||
from `tabDelivery Note` t1,`tabDelivery Note Item` t2
|
|
||||||
where t1.name = t2.parent and t2.against_sales_order = %s and t1.docstatus = 1""", self.name)
|
|
||||||
|
|
||||||
if submit_dn:
|
|
||||||
submit_dn = [get_link_to_form("Delivery Note", dn) for dn in submit_dn]
|
|
||||||
frappe.throw(_("Delivery Notes {0} must be cancelled before cancelling this Sales Order")
|
|
||||||
.format(", ".join(submit_dn)))
|
|
||||||
|
|
||||||
# Checks Sales Invoice
|
|
||||||
submit_rv = frappe.db.sql_list("""select t1.name
|
|
||||||
from `tabSales Invoice` t1,`tabSales Invoice Item` t2
|
from `tabSales Invoice` t1,`tabSales Invoice Item` t2
|
||||||
where t1.name = t2.parent and t2.sales_order = %s and t1.docstatus < 2""",
|
where t1.name = t2.parent and t2.sales_order = %s and t1.docstatus = 0""",
|
||||||
self.name)
|
self.name)
|
||||||
|
|
||||||
if submit_rv:
|
if linked_invoices:
|
||||||
submit_rv = [get_link_to_form("Sales Invoice", si) for si in submit_rv]
|
linked_invoices = [get_link_to_form("Sales Invoice", si) for si in linked_invoices]
|
||||||
frappe.throw(_("Sales Invoice {0} must be cancelled before cancelling this Sales Order")
|
frappe.throw(_("Sales Invoice {0} must be deleted before cancelling this Sales Order")
|
||||||
.format(", ".join(submit_rv)))
|
.format(", ".join(linked_invoices)))
|
||||||
|
|
||||||
#check maintenance schedule
|
|
||||||
submit_ms = frappe.db.sql_list("""
|
|
||||||
select t1.name
|
|
||||||
from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2
|
|
||||||
where t2.parent=t1.name and t2.sales_order = %s and t1.docstatus = 1""", self.name)
|
|
||||||
|
|
||||||
if submit_ms:
|
|
||||||
submit_ms = [get_link_to_form("Maintenance Schedule", ms) for ms in submit_ms]
|
|
||||||
frappe.throw(_("Maintenance Schedule {0} must be cancelled before cancelling this Sales Order")
|
|
||||||
.format(", ".join(submit_ms)))
|
|
||||||
|
|
||||||
# check maintenance visit
|
|
||||||
submit_mv = frappe.db.sql_list("""
|
|
||||||
select t1.name
|
|
||||||
from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2
|
|
||||||
where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1""",self.name)
|
|
||||||
|
|
||||||
if submit_mv:
|
|
||||||
submit_mv = [get_link_to_form("Maintenance Visit", mv) for mv in submit_mv]
|
|
||||||
frappe.throw(_("Maintenance Visit {0} must be cancelled before cancelling this Sales Order")
|
|
||||||
.format(", ".join(submit_mv)))
|
|
||||||
|
|
||||||
# check work order
|
|
||||||
pro_order = frappe.db.sql_list("""
|
|
||||||
select name
|
|
||||||
from `tabWork Order`
|
|
||||||
where sales_order = %s and docstatus = 1""", self.name)
|
|
||||||
|
|
||||||
if pro_order:
|
|
||||||
pro_order = [get_link_to_form("Work Order", po) for po in pro_order]
|
|
||||||
frappe.throw(_("Work Order {0} must be cancelled before cancelling this Sales Order")
|
|
||||||
.format(", ".join(pro_order)))
|
|
||||||
|
|
||||||
def check_modified_date(self):
|
def check_modified_date(self):
|
||||||
mod_db = frappe.db.get_value("Sales Order", self.name, "modified")
|
mod_db = frappe.db.get_value("Sales Order", self.name, "modified")
|
||||||
|
@ -10,6 +10,12 @@ from frappe.core.doctype.user_permission.test_user_permission import create_user
|
|||||||
from frappe.utils import add_days, flt, getdate, nowdate
|
from frappe.utils import add_days, flt, getdate, nowdate
|
||||||
|
|
||||||
from erpnext.controllers.accounts_controller import update_child_qty_rate
|
from erpnext.controllers.accounts_controller import update_child_qty_rate
|
||||||
|
from erpnext.maintenance.doctype.maintenance_schedule.test_maintenance_schedule import (
|
||||||
|
make_maintenance_schedule,
|
||||||
|
)
|
||||||
|
from erpnext.maintenance.doctype.maintenance_visit.test_maintenance_visit import (
|
||||||
|
make_maintenance_visit,
|
||||||
|
)
|
||||||
from erpnext.manufacturing.doctype.blanket_order.test_blanket_order import make_blanket_order
|
from erpnext.manufacturing.doctype.blanket_order.test_blanket_order import make_blanket_order
|
||||||
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
|
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
|
||||||
from erpnext.selling.doctype.sales_order.sales_order import (
|
from erpnext.selling.doctype.sales_order.sales_order import (
|
||||||
@ -1278,6 +1284,72 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertRaises(frappe.ValidationError, so.cancel)
|
self.assertRaises(frappe.ValidationError, so.cancel)
|
||||||
|
|
||||||
|
def test_so_cancellation_after_si_submission(self):
|
||||||
|
"""
|
||||||
|
Test to check if Sales Order gets cancelled when linked Sales Invoice has been Submitted
|
||||||
|
Expected result: Sales Order should not get cancelled
|
||||||
|
"""
|
||||||
|
so = make_sales_order()
|
||||||
|
so.submit()
|
||||||
|
si = make_sales_invoice(so.name)
|
||||||
|
si.submit()
|
||||||
|
|
||||||
|
so.load_from_db()
|
||||||
|
self.assertRaises(frappe.LinkExistsError, so.cancel)
|
||||||
|
|
||||||
|
def test_so_cancellation_after_dn_submission(self):
|
||||||
|
"""
|
||||||
|
Test to check if Sales Order gets cancelled when linked Delivery Note has been Submitted
|
||||||
|
Expected result: Sales Order should not get cancelled
|
||||||
|
"""
|
||||||
|
so = make_sales_order()
|
||||||
|
so.submit()
|
||||||
|
dn = make_delivery_note(so.name)
|
||||||
|
dn.submit()
|
||||||
|
|
||||||
|
so.load_from_db()
|
||||||
|
self.assertRaises(frappe.LinkExistsError, so.cancel)
|
||||||
|
|
||||||
|
def test_so_cancellation_after_maintenance_schedule_submission(self):
|
||||||
|
"""
|
||||||
|
Expected result: Sales Order should not get cancelled
|
||||||
|
"""
|
||||||
|
so = make_sales_order()
|
||||||
|
so.submit()
|
||||||
|
ms = make_maintenance_schedule()
|
||||||
|
ms.items[0].sales_order = so.name
|
||||||
|
ms.submit()
|
||||||
|
|
||||||
|
so.load_from_db()
|
||||||
|
self.assertRaises(frappe.LinkExistsError, so.cancel)
|
||||||
|
|
||||||
|
def test_so_cancellation_after_maintenance_visit_submission(self):
|
||||||
|
"""
|
||||||
|
Expected result: Sales Order should not get cancelled
|
||||||
|
"""
|
||||||
|
so = make_sales_order()
|
||||||
|
so.submit()
|
||||||
|
mv = make_maintenance_visit()
|
||||||
|
mv.purposes[0].prevdoc_doctype = "Sales Order"
|
||||||
|
mv.purposes[0].prevdoc_docname = so.name
|
||||||
|
mv.submit()
|
||||||
|
|
||||||
|
so.load_from_db()
|
||||||
|
self.assertRaises(frappe.LinkExistsError, so.cancel)
|
||||||
|
|
||||||
|
def test_so_cancellation_after_work_order_submission(self):
|
||||||
|
"""
|
||||||
|
Expected result: Sales Order should not get cancelled
|
||||||
|
"""
|
||||||
|
from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
|
||||||
|
|
||||||
|
so = make_sales_order(item_code="_Test FG Item", qty=10)
|
||||||
|
so.submit()
|
||||||
|
make_wo_order_test_record(sales_order=so.name)
|
||||||
|
|
||||||
|
so.load_from_db()
|
||||||
|
self.assertRaises(frappe.LinkExistsError, so.cancel)
|
||||||
|
|
||||||
def test_payment_terms_are_fetched_when_creating_sales_invoice(self):
|
def test_payment_terms_are_fetched_when_creating_sales_invoice(self):
|
||||||
from erpnext.accounts.doctype.payment_entry.test_payment_entry import (
|
from erpnext.accounts.doctype.payment_entry.test_payment_entry import (
|
||||||
create_payment_terms_template,
|
create_payment_terms_template,
|
||||||
|
@ -49,11 +49,11 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
this.$component.append(
|
this.$component.append(
|
||||||
`<div class="cart-container">
|
`<div class="cart-container">
|
||||||
<div class="abs-cart-container">
|
<div class="abs-cart-container">
|
||||||
<div class="cart-label">Item Cart</div>
|
<div class="cart-label">${__('Item Cart')}</div>
|
||||||
<div class="cart-header">
|
<div class="cart-header">
|
||||||
<div class="name-header">Item</div>
|
<div class="name-header">${__('Item')}</div>
|
||||||
<div class="qty-header">Qty</div>
|
<div class="qty-header">${__('Quantity')}</div>
|
||||||
<div class="rate-amount-header">Amount</div>
|
<div class="rate-amount-header">${__('Amount')}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cart-items-section"></div>
|
<div class="cart-items-section"></div>
|
||||||
<div class="cart-totals-section"></div>
|
<div class="cart-totals-section"></div>
|
||||||
@ -78,7 +78,7 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
make_no_items_placeholder() {
|
make_no_items_placeholder() {
|
||||||
this.$cart_header.css('display', 'none');
|
this.$cart_header.css('display', 'none');
|
||||||
this.$cart_items_wrapper.html(
|
this.$cart_items_wrapper.html(
|
||||||
`<div class="no-item-wrapper">No items in cart</div>`
|
`<div class="no-item-wrapper">${__('No items in cart')}</div>`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,19 +98,19 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
|
|
||||||
this.$totals_section.append(
|
this.$totals_section.append(
|
||||||
`<div class="add-discount-wrapper">
|
`<div class="add-discount-wrapper">
|
||||||
${this.get_discount_icon()} Add Discount
|
${this.get_discount_icon()} ${__('Add Discount')}
|
||||||
</div>
|
</div>
|
||||||
<div class="net-total-container">
|
<div class="net-total-container">
|
||||||
<div class="net-total-label">Net Total</div>
|
<div class="net-total-label">${__("Net Total")}</div>
|
||||||
<div class="net-total-value">0.00</div>
|
<div class="net-total-value">0.00</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="taxes-container"></div>
|
<div class="taxes-container"></div>
|
||||||
<div class="grand-total-container">
|
<div class="grand-total-container">
|
||||||
<div>Grand Total</div>
|
<div>${__('Grand Total')}</div>
|
||||||
<div>0.00</div>
|
<div>0.00</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkout-btn">Checkout</div>
|
<div class="checkout-btn">${__('Checkout')}</div>
|
||||||
<div class="edit-cart-btn">Edit Cart</div>`
|
<div class="edit-cart-btn">${__('Edit Cart')}</div>`
|
||||||
)
|
)
|
||||||
|
|
||||||
this.$add_discount_elem = this.$component.find(".add-discount-wrapper");
|
this.$add_discount_elem = this.$component.find(".add-discount-wrapper");
|
||||||
@ -126,10 +126,10 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
},
|
},
|
||||||
cols: 5,
|
cols: 5,
|
||||||
keys: [
|
keys: [
|
||||||
[ 1, 2, 3, 'Quantity' ],
|
[ 1, 2, 3, __('Quantity') ],
|
||||||
[ 4, 5, 6, 'Discount' ],
|
[ 4, 5, 6, __('Discount') ],
|
||||||
[ 7, 8, 9, 'Rate' ],
|
[ 7, 8, 9, __('Rate') ],
|
||||||
[ '.', 0, 'Delete', 'Remove' ]
|
[ '.', 0, __('Delete'), __('Remove') ]
|
||||||
],
|
],
|
||||||
css_classes: [
|
css_classes: [
|
||||||
[ '', '', '', 'col-span-2' ],
|
[ '', '', '', 'col-span-2' ],
|
||||||
@ -148,7 +148,7 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
)
|
)
|
||||||
|
|
||||||
this.$numpad_section.append(
|
this.$numpad_section.append(
|
||||||
`<div class="numpad-btn checkout-btn" data-button-value="checkout">Checkout</div>`
|
`<div class="numpad-btn checkout-btn" data-button-value="checkout">${__('Checkout')}</div>`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
'border': '1px dashed var(--gray-500)',
|
'border': '1px dashed var(--gray-500)',
|
||||||
'padding': 'var(--padding-sm) var(--padding-md)'
|
'padding': 'var(--padding-sm) var(--padding-md)'
|
||||||
});
|
});
|
||||||
me.$add_discount_elem.html(`${me.get_discount_icon()} Add Discount`);
|
me.$add_discount_elem.html(`${me.get_discount_icon()} ${__('Add Discount')}`);
|
||||||
me.discount_field = undefined;
|
me.discount_field = undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -411,7 +411,7 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
});
|
});
|
||||||
this.$add_discount_elem.html(
|
this.$add_discount_elem.html(
|
||||||
`<div class="edit-discount-btn">
|
`<div class="edit-discount-btn">
|
||||||
${this.get_discount_icon()} Additional ${String(discount).bold()}% discount applied
|
${this.get_discount_icon()} ${__("Additional")} ${String(discount).bold()}% ${__("discount applied")}
|
||||||
</div>`
|
</div>`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -445,7 +445,7 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
|
|
||||||
function get_customer_description() {
|
function get_customer_description() {
|
||||||
if (!email_id && !mobile_no) {
|
if (!email_id && !mobile_no) {
|
||||||
return `<div class="customer-desc">Click to add email / phone</div>`;
|
return `<div class="customer-desc">${__('Click to add email / phone')}</div>`;
|
||||||
} else if (email_id && !mobile_no) {
|
} else if (email_id && !mobile_no) {
|
||||||
return `<div class="customer-desc">${email_id}</div>`;
|
return `<div class="customer-desc">${email_id}</div>`;
|
||||||
} else if (mobile_no && !email_id) {
|
} else if (mobile_no && !email_id) {
|
||||||
@ -479,22 +479,22 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
render_net_total(value) {
|
render_net_total(value) {
|
||||||
const currency = this.events.get_frm().doc.currency;
|
const currency = this.events.get_frm().doc.currency;
|
||||||
this.$totals_section.find('.net-total-container').html(
|
this.$totals_section.find('.net-total-container').html(
|
||||||
`<div>Net Total</div><div>${format_currency(value, currency)}</div>`
|
`<div>${__('Net Total')}</div><div>${format_currency(value, currency)}</div>`
|
||||||
)
|
)
|
||||||
|
|
||||||
this.$numpad_section.find('.numpad-net-total').html(
|
this.$numpad_section.find('.numpad-net-total').html(
|
||||||
`<div>Net Total: <span>${format_currency(value, currency)}</span></div>`
|
`<div>${__('Net Total')}: <span>${format_currency(value, currency)}</span></div>`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render_grand_total(value) {
|
render_grand_total(value) {
|
||||||
const currency = this.events.get_frm().doc.currency;
|
const currency = this.events.get_frm().doc.currency;
|
||||||
this.$totals_section.find('.grand-total-container').html(
|
this.$totals_section.find('.grand-total-container').html(
|
||||||
`<div>Grand Total</div><div>${format_currency(value, currency)}</div>`
|
`<div>${__('Grand Total')}</div><div>${format_currency(value, currency)}</div>`
|
||||||
)
|
)
|
||||||
|
|
||||||
this.$numpad_section.find('.numpad-grand-total').html(
|
this.$numpad_section.find('.numpad-grand-total').html(
|
||||||
`<div>Grand Total: <span>${format_currency(value, currency)}</span></div>`
|
`<div>${__('Grand Total')}: <span>${format_currency(value, currency)}</span></div>`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,6 +502,7 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
if (taxes.length) {
|
if (taxes.length) {
|
||||||
const currency = this.events.get_frm().doc.currency;
|
const currency = this.events.get_frm().doc.currency;
|
||||||
const taxes_html = taxes.map(t => {
|
const taxes_html = taxes.map(t => {
|
||||||
|
if (t.tax_amount_after_discount_amount == 0.0) return;
|
||||||
const description = /[0-9]+/.test(t.description) ? t.description : `${t.description} @ ${t.rate}%`;
|
const description = /[0-9]+/.test(t.description) ? t.description : `${t.description} @ ${t.rate}%`;
|
||||||
return `<div class="tax-row">
|
return `<div class="tax-row">
|
||||||
<div class="tax-label">${description}</div>
|
<div class="tax-label">${description}</div>
|
||||||
|
@ -28,7 +28,7 @@ erpnext.PointOfSale.ItemDetails = class {
|
|||||||
init_child_components() {
|
init_child_components() {
|
||||||
this.$component.html(
|
this.$component.html(
|
||||||
`<div class="item-details-header">
|
`<div class="item-details-header">
|
||||||
<div class="label">Item Details</div>
|
<div class="label">${__('Item Details')}</div>
|
||||||
<div class="close-btn">
|
<div class="close-btn">
|
||||||
<svg width="32" height="32" viewBox="0 0 14 14" fill="none">
|
<svg width="32" height="32" viewBox="0 0 14 14" fill="none">
|
||||||
<path d="M4.93764 4.93759L7.00003 6.99998M9.06243 9.06238L7.00003 6.99998M7.00003 6.99998L4.93764 9.06238L9.06243 4.93759" stroke="#8D99A6"/>
|
<path d="M4.93764 4.93759L7.00003 6.99998M9.06243 9.06238L7.00003 6.99998M7.00003 6.99998L4.93764 9.06238L9.06243 4.93759" stroke="#8D99A6"/>
|
||||||
@ -201,8 +201,9 @@ erpnext.PointOfSale.ItemDetails = class {
|
|||||||
`<div class="grid-filler no-select"></div>`
|
`<div class="grid-filler no-select"></div>`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const label = __('Auto Fetch Serial Numbers');
|
||||||
this.$form_container.append(
|
this.$form_container.append(
|
||||||
`<div class="btn btn-sm btn-secondary auto-fetch-btn">Auto Fetch Serial Numbers</div>`
|
`<div class="btn btn-sm btn-secondary auto-fetch-btn">${label}</div>`
|
||||||
);
|
);
|
||||||
this.$form_container.find('.serial_no-control').find('textarea').css('height', '6rem');
|
this.$form_container.find('.serial_no-control').find('textarea').css('height', '6rem');
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user