mirror of
https://github.com/frappe/erpnext.git
synced 2026-07-20 11:22:28 +00:00
Compare commits
304 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19a27d3f46 | ||
|
|
d5fa3a2b8f | ||
|
|
d7bf38842b | ||
|
|
be65ae7c86 | ||
|
|
f452ab56c6 | ||
|
|
c1c8bb6d98 | ||
|
|
472bad352d | ||
|
|
eea1ec42f4 | ||
|
|
ddd85334a3 | ||
|
|
2f20ef0f4c | ||
|
|
e8935457a0 | ||
|
|
64ec1728ab | ||
|
|
dbb6721412 | ||
|
|
afbbdcb802 | ||
|
|
37adbe5a85 | ||
|
|
d7a5853587 | ||
|
|
6b799dbef0 | ||
|
|
be8ecdf3d6 | ||
|
|
85f1561e5e | ||
|
|
2bf8610698 | ||
|
|
23364b374e | ||
|
|
82c162dfe7 | ||
|
|
7fea8a95e6 | ||
|
|
85a2d27736 | ||
|
|
106e0f885a | ||
|
|
c37ce8b8d3 | ||
|
|
5ac5d86d84 | ||
|
|
a180d2baa8 | ||
|
|
14717eeac6 | ||
|
|
179d82615f | ||
|
|
1618c92142 | ||
|
|
1118949867 | ||
|
|
31cd9dcee1 | ||
|
|
e42e75178a | ||
|
|
078e154966 | ||
|
|
3365f01963 | ||
|
|
469827da85 | ||
|
|
d3240f9510 | ||
|
|
2341f47631 | ||
|
|
b57a523dfe | ||
|
|
8d101d362d | ||
|
|
a9cfe1cfa4 | ||
|
|
dccd2ca69f | ||
|
|
314e151f1d | ||
|
|
c002465903 | ||
|
|
859a5f4dbe | ||
|
|
58d7fb5c94 | ||
|
|
744a7b1bad | ||
|
|
d9719fe41d | ||
|
|
50c1d24ee9 | ||
|
|
ea221f7e63 | ||
|
|
3799c1a662 | ||
|
|
56a8b90598 | ||
|
|
044ad91481 | ||
|
|
39a5e5abd1 | ||
|
|
407b351d55 | ||
|
|
6f64ec3574 | ||
|
|
e17ad9e620 | ||
|
|
505b69f6b2 | ||
|
|
485ef74c58 | ||
|
|
5cf9fbc27b | ||
|
|
4ef49eab66 | ||
|
|
f6d61f2dec | ||
|
|
7aaf3a71e8 | ||
|
|
c51ac1c68b | ||
|
|
04b106a515 | ||
|
|
e79f3e67ed | ||
|
|
f8d24b803c | ||
|
|
c516fc7ca4 | ||
|
|
c9b8423007 | ||
|
|
42675929fa | ||
|
|
a8de2321a5 | ||
|
|
748f8145b6 | ||
|
|
7a40a2b2e2 | ||
|
|
35c2d2324d | ||
|
|
f2b5f3a842 | ||
|
|
d2442da6f2 | ||
|
|
32bdb691df | ||
|
|
5050541401 | ||
|
|
87f0ed6477 | ||
|
|
6df18856db | ||
|
|
288b384ab5 | ||
|
|
cffcbf7c47 | ||
|
|
c69fda4440 | ||
|
|
507ec2184c | ||
|
|
75cfbe132b | ||
|
|
f88e908598 | ||
|
|
8791d11359 | ||
|
|
bbec5ccc83 | ||
|
|
8862166223 | ||
|
|
2eea0f003f | ||
|
|
a250d415aa | ||
|
|
4d83564188 | ||
|
|
7e01cacf8c | ||
|
|
830626d86a | ||
|
|
78e413aaaa | ||
|
|
f9da40e9af | ||
|
|
e6a8e1a23b | ||
|
|
e0e5783b3e | ||
|
|
0abed806a3 | ||
|
|
79e3700499 | ||
|
|
e898ce1f20 | ||
|
|
3ddebae3fb | ||
|
|
d5abab4208 | ||
|
|
00a40c95ea | ||
|
|
750da2f946 | ||
|
|
ff524e676f | ||
|
|
d8fc6ec471 | ||
|
|
4e12c70897 | ||
|
|
7e97138beb | ||
|
|
00865b9af3 | ||
|
|
7d1a431d9c | ||
|
|
fe9e2ec008 | ||
|
|
ca4c12b44e | ||
|
|
cdd950dee5 | ||
|
|
21b17cf407 | ||
|
|
6324cc238e | ||
|
|
cdc0b8e435 | ||
|
|
7049cca855 | ||
|
|
ba95d32876 | ||
|
|
bf1e0139e2 | ||
|
|
bf490c3a27 | ||
|
|
40b37f09fd | ||
|
|
04e0b35154 | ||
|
|
82b4749166 | ||
|
|
ef06f3288f | ||
|
|
945c0e86de | ||
|
|
2cae3d7b38 | ||
|
|
03933f8461 | ||
|
|
ba398bc779 | ||
|
|
022a46fdcd | ||
|
|
d092b6c25a | ||
|
|
5add3ea210 | ||
|
|
909346f222 | ||
|
|
d9a0e0c708 | ||
|
|
839edaf613 | ||
|
|
11f2da72b1 | ||
|
|
e7eb9d4e20 | ||
|
|
d94a97b6ad | ||
|
|
d819330443 | ||
|
|
86bbb3e9a0 | ||
|
|
b9d62d7f8e | ||
|
|
44dd9f6fe5 | ||
|
|
a683b14c64 | ||
|
|
becae59af0 | ||
|
|
e6d300e35c | ||
|
|
c2a41371d2 | ||
|
|
6d3fc0d020 | ||
|
|
81cbd0dc50 | ||
|
|
1bbda81c9f | ||
|
|
21461823f1 | ||
|
|
e9b580aba6 | ||
|
|
7f794e5bb6 | ||
|
|
6db07c0278 | ||
|
|
c28379075a | ||
|
|
64f4f86948 | ||
|
|
983df4463a | ||
|
|
b9c71e59e0 | ||
|
|
8427dd2ca8 | ||
|
|
105a9fdff1 | ||
|
|
bd0cb9d2ed | ||
|
|
ffbb767072 | ||
|
|
723e4f2a22 | ||
|
|
a738e8ca87 | ||
|
|
b0b36d2caa | ||
|
|
0de091a749 | ||
|
|
2d073016ee | ||
|
|
12f95c41b9 | ||
|
|
7fb22fd652 | ||
|
|
284a19c99d | ||
|
|
1a401b1427 | ||
|
|
b2db8031d5 | ||
|
|
58fae20ff9 | ||
|
|
2cf9cc02e1 | ||
|
|
9b893643c0 | ||
|
|
126de4d0e5 | ||
|
|
18635e4dd1 | ||
|
|
4b75d528c9 | ||
|
|
5220e9201b | ||
|
|
ee7bcc0350 | ||
|
|
1f2ec25493 | ||
|
|
e46a72b101 | ||
|
|
b4dfba54b6 | ||
|
|
9daf4418ea | ||
|
|
695e551972 | ||
|
|
e6a07d5508 | ||
|
|
d67affdfae | ||
|
|
cde452add7 | ||
|
|
5c74cdd0d2 | ||
|
|
58b1e3b866 | ||
|
|
b16d625b4f | ||
|
|
96f0b0e30a | ||
|
|
390cac2160 | ||
|
|
64e9275c4a | ||
|
|
42b028a3ba | ||
|
|
5327637b37 | ||
|
|
5d6849ac7f | ||
|
|
57e6759088 | ||
|
|
9760eb9d57 | ||
|
|
ee0b08ae9c | ||
|
|
22e770353f | ||
|
|
bbce16e00c | ||
|
|
3dbf88ba6f | ||
|
|
1cd57a324c | ||
|
|
e8f4eb02be | ||
|
|
f76b0dea44 | ||
|
|
3252d9d943 | ||
|
|
9655edabd9 | ||
|
|
2704327029 | ||
|
|
3e526b8ca8 | ||
|
|
c630be6781 | ||
|
|
51a153d8c2 | ||
|
|
707b630851 | ||
|
|
c82c955bc2 | ||
|
|
dc4b0921f6 | ||
|
|
72ed0fbbb4 | ||
|
|
020e6e980a | ||
|
|
70e0711893 | ||
|
|
8693ac81a2 | ||
|
|
56116f28af | ||
|
|
eeb99d1b98 | ||
|
|
5d23c0ce8e | ||
|
|
91580258d7 | ||
|
|
51ddf376da | ||
|
|
db4fec0314 | ||
|
|
6d63a1e90a | ||
|
|
589a49a38a | ||
|
|
464fc1f087 | ||
|
|
e3c2f0a221 | ||
|
|
77b8ced4a4 | ||
|
|
fb9dde38f6 | ||
|
|
ca944316b4 | ||
|
|
6d5a8aea9a | ||
|
|
eb9f216b40 | ||
|
|
63bfa30bc1 | ||
|
|
778141c569 | ||
|
|
b7ee2a44a0 | ||
|
|
3f9390c077 | ||
|
|
495ac7ba6b | ||
|
|
ad19268b4c | ||
|
|
54405a4b64 | ||
|
|
86f87e9b53 | ||
|
|
049836dff8 | ||
|
|
c313f05a8e | ||
|
|
b77375c72b | ||
|
|
6c064a1f95 | ||
|
|
9182c2e09d | ||
|
|
271f35fef5 | ||
|
|
37e4c91ec2 | ||
|
|
12d9bc3787 | ||
|
|
5eb430fe51 | ||
|
|
31ee8b4011 | ||
|
|
9363725342 | ||
|
|
e1e3dbcae2 | ||
|
|
8616684c24 | ||
|
|
90a57c1f8c | ||
|
|
ba1cd74189 | ||
|
|
c3719b46b2 | ||
|
|
e50804fb9d | ||
|
|
cc704044bd | ||
|
|
e6646efef3 | ||
|
|
57dd4689e0 | ||
|
|
08b4736ee0 | ||
|
|
662a0fcfe9 | ||
|
|
d6f3be0fc1 | ||
|
|
154c433a86 | ||
|
|
d3a6b9ed81 | ||
|
|
9c00b22703 | ||
|
|
b3e0f482ac | ||
|
|
61824d3735 | ||
|
|
ada41295bb | ||
|
|
08e89b88f4 | ||
|
|
cc43805f25 | ||
|
|
ec28262988 | ||
|
|
22754a9c58 | ||
|
|
6a9af076e5 | ||
|
|
816235e99c | ||
|
|
dfbdd0b2ee | ||
|
|
59a757b3e3 | ||
|
|
389610fb45 | ||
|
|
175b26e6e8 | ||
|
|
cea1a15dcd | ||
|
|
7a40ad340f | ||
|
|
db13eb56c4 | ||
|
|
cf2ebc0d6f | ||
|
|
9003718481 | ||
|
|
18666b6a74 | ||
|
|
395ecf2392 | ||
|
|
221e5993a8 | ||
|
|
8eda5aca09 | ||
|
|
bdfd30760a | ||
|
|
418818f0ec | ||
|
|
d971917ecf | ||
|
|
dda44bb1f5 | ||
|
|
448ab6e3df | ||
|
|
cc3e0bf806 | ||
|
|
93b3c2ce06 | ||
|
|
7c427aa890 | ||
|
|
b6509ead64 | ||
|
|
f8346ce62f | ||
|
|
e73a9deb42 | ||
|
|
5669a5f618 | ||
|
|
18afbc0617 | ||
|
|
f396b35622 |
@@ -5,7 +5,7 @@ import frappe
|
||||
from erpnext.hooks import regional_overrides
|
||||
from frappe.utils import getdate
|
||||
|
||||
__version__ = '12.16.0'
|
||||
__version__ = '12.18.0'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -41,6 +41,8 @@ frappe.ui.form.on('Accounting Dimension', {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
frm.toggle_enable('document_type', frm.doc.__islocal);
|
||||
},
|
||||
|
||||
document_type: function(frm) {
|
||||
|
||||
@@ -29,6 +29,16 @@ class AccountingDimension(Document):
|
||||
if exists and self.is_new():
|
||||
frappe.throw("Document Type already used as a dimension")
|
||||
|
||||
if not self.is_new():
|
||||
self.validate_document_type_change()
|
||||
|
||||
def validate_document_type_change(self):
|
||||
doctype_before_save = frappe.db.get_value("Accounting Dimension", self.name, "document_type")
|
||||
if doctype_before_save != self.document_type:
|
||||
message = _("Cannot change Reference Document Type.")
|
||||
message += _("Please create a new Accounting Dimension if required.")
|
||||
frappe.throw(message)
|
||||
|
||||
def after_insert(self):
|
||||
if frappe.flags.in_test:
|
||||
make_dimension_in_accounting_doctypes(doc=self)
|
||||
|
||||
@@ -138,7 +138,8 @@ class GLEntry(Document):
|
||||
frappe.throw(_("{0} {1}: Cost Center {2} does not belong to Company {3}")
|
||||
.format(self.voucher_type, self.voucher_no, self.cost_center, self.company))
|
||||
|
||||
if not self.flags.from_repost and self.cost_center and _check_is_group():
|
||||
if not self.flags.from_repost and not self.voucher_type == 'Period Closing Voucher' \
|
||||
and self.cost_center and _check_is_group():
|
||||
frappe.throw(_("""{0} {1}: Cost Center {2} is a group cost center and group cost centers cannot
|
||||
be used in transactions""").format(self.voucher_type, self.voucher_no, frappe.bold(self.cost_center)))
|
||||
|
||||
|
||||
@@ -38,7 +38,10 @@ def get_loyalty_details(customer, loyalty_program, expiry_date=None, company=Non
|
||||
@frappe.whitelist()
|
||||
def get_loyalty_program_details_with_points(customer, loyalty_program=None, expiry_date=None, company=None, silent=False, include_expired_entry=False, current_transaction_amount=0):
|
||||
lp_details = get_loyalty_program_details(customer, loyalty_program, company=company, silent=silent)
|
||||
loyalty_program = frappe.get_doc("Loyalty Program", loyalty_program)
|
||||
loyalty_program_name = loyalty_program or lp_details.loyalty_program
|
||||
if not loyalty_program_name: return
|
||||
|
||||
loyalty_program = frappe.get_doc("Loyalty Program", loyalty_program_name)
|
||||
lp_details.update(get_loyalty_details(customer, loyalty_program.name, expiry_date, company, include_expired_entry))
|
||||
|
||||
# sort collection rule, first item on list will be lowest min_spent
|
||||
|
||||
@@ -187,7 +187,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
|
||||
frm.toggle_display("base_received_amount", (
|
||||
frm.doc.paid_to_account_currency != company_currency &&
|
||||
frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency
|
||||
frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency
|
||||
&& frm.doc.base_paid_amount != frm.doc.base_received_amount
|
||||
));
|
||||
|
||||
@@ -386,6 +386,8 @@ frappe.ui.form.on('Payment Entry', {
|
||||
|
||||
set_account_currency_and_balance: function(frm, account, currency_field,
|
||||
balance_field, callback_function) {
|
||||
|
||||
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
|
||||
if (frm.doc.posting_date && account) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_account_details",
|
||||
@@ -412,6 +414,14 @@ frappe.ui.form.on('Payment Entry', {
|
||||
|
||||
if(!frm.doc.paid_amount && frm.doc.received_amount)
|
||||
frm.events.received_amount(frm);
|
||||
|
||||
if (frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency
|
||||
&& frm.doc.paid_amount != frm.doc.received_amount) {
|
||||
if (company_currency != frm.doc.paid_from_account_currency &&
|
||||
frm.doc.payment_type == "Pay") {
|
||||
frm.doc.paid_amount = frm.doc.received_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
() => {
|
||||
|
||||
@@ -88,18 +88,18 @@ class PaymentReconciliation(Document):
|
||||
voucher_type = ('Sales Invoice'
|
||||
if self.party_type == 'Customer' else "Purchase Invoice")
|
||||
|
||||
return frappe.db.sql(""" SELECT `tab{doc}`.name as reference_name, %(voucher_type)s as reference_type,
|
||||
(sum(`tabGL Entry`.{dr_or_cr}) - sum(`tabGL Entry`.{reconciled_dr_or_cr})) as amount,
|
||||
return frappe.db.sql(""" SELECT doc.name as reference_name, %(voucher_type)s as reference_type,
|
||||
(sum(gl.{dr_or_cr}) - sum(gl.{reconciled_dr_or_cr})) as amount,
|
||||
account_currency as currency
|
||||
FROM `tab{doc}`, `tabGL Entry`
|
||||
FROM `tab{doc}` doc, `tabGL Entry` gl
|
||||
WHERE
|
||||
(`tab{doc}`.name = `tabGL Entry`.against_voucher or `tab{doc}`.name = `tabGL Entry`.voucher_no)
|
||||
and `tab{doc}`.{party_type_field} = %(party)s
|
||||
and `tab{doc}`.is_return = 1 and `tab{doc}`.return_against IS NULL
|
||||
and `tabGL Entry`.against_voucher_type = %(voucher_type)s
|
||||
and `tab{doc}`.docstatus = 1 and `tabGL Entry`.party = %(party)s
|
||||
and `tabGL Entry`.party_type = %(party_type)s and `tabGL Entry`.account = %(account)s
|
||||
GROUP BY `tab{doc}`.name
|
||||
(doc.name = gl.against_voucher or doc.name = gl.voucher_no)
|
||||
and doc.{party_type_field} = %(party)s
|
||||
and doc.is_return = 1 and ifnull(doc.return_against, "") = ""
|
||||
and gl.against_voucher_type = %(voucher_type)s
|
||||
and doc.docstatus = 1 and gl.party = %(party)s
|
||||
and gl.party_type = %(party_type)s and gl.account = %(account)s
|
||||
GROUP BY doc.name
|
||||
Having
|
||||
amount > 0
|
||||
""".format(
|
||||
@@ -303,4 +303,4 @@ def reconcile_dr_cr_note(dr_cr_notes, company):
|
||||
]
|
||||
})
|
||||
|
||||
jv.submit()
|
||||
jv.submit()
|
||||
|
||||
@@ -153,8 +153,8 @@ def update_multi_mode_option(doc, pos_profile):
|
||||
|
||||
def get_mode_of_payment(doc):
|
||||
return frappe.db.sql("""
|
||||
select mpa.default_account, mpa.parent, mp.type as type
|
||||
from `tabMode of Payment Account` mpa,`tabMode of Payment` mp
|
||||
select mpa.default_account, mpa.parent, mp.type as type
|
||||
from `tabMode of Payment Account` mpa,`tabMode of Payment` mp
|
||||
where mpa.parent = mp.name and mpa.company = %(company)s and mp.enabled = 1""",
|
||||
{'company': doc.company}, as_dict=1)
|
||||
|
||||
@@ -394,6 +394,14 @@ def get_pricing_rule_data(doc):
|
||||
between ifnull(valid_from, '2000-01-01') and ifnull(valid_upto, '2500-12-31')
|
||||
order by priority desc, name desc""",
|
||||
{'company': doc.company, 'price_list': doc.selling_price_list, 'date': nowdate()}, as_dict=1)
|
||||
|
||||
for row in pricing_rules:
|
||||
if row.apply_on:
|
||||
doctype = "Pricing Rule " + row.apply_on
|
||||
apply_on = frappe.scrub(row.apply_on)
|
||||
row[apply_on] = [d.get(apply_on) for d in frappe.get_all(doctype,
|
||||
filters = {"parent": row.name}, fields = [apply_on])]
|
||||
|
||||
return pricing_rules
|
||||
|
||||
|
||||
@@ -434,10 +442,10 @@ def make_invoice(pos_profile, doc_list={}, email_queue_list={}, customers_list={
|
||||
name_list.append(name)
|
||||
|
||||
email_queue = make_email_queue(email_queue_list)
|
||||
|
||||
|
||||
if isinstance(pos_profile, string_types):
|
||||
pos_profile = json.loads(pos_profile)
|
||||
|
||||
|
||||
customers = get_customers_list(pos_profile)
|
||||
return {
|
||||
'invoice': name_list,
|
||||
|
||||
@@ -14,6 +14,16 @@ frappe.ui.form.on("Sales Invoice", {
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query('transporter_address', function (doc) {
|
||||
return {
|
||||
query: 'frappe.contacts.doctype.address.address.address_query',
|
||||
filters: {
|
||||
link_doctype: 'Supplier',
|
||||
link_name: doc.transporter
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
frm.set_query('driver', function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
import frappe.defaults
|
||||
from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr, nowdate
|
||||
from frappe.utils import cint, flt, getdate, add_days, cstr, nowdate, formatdate
|
||||
from frappe import _, msgprint, throw
|
||||
from erpnext.accounts.party import get_party_account, get_due_date
|
||||
from erpnext.controllers.stock_controller import update_gl_entries_after
|
||||
@@ -537,7 +537,12 @@ class SalesInvoice(SellingController):
|
||||
self.against_income_account = ','.join(against_acc)
|
||||
|
||||
def add_remarks(self):
|
||||
if not self.remarks: self.remarks = 'No Remarks'
|
||||
if not self.remarks:
|
||||
if self.po_no and self.po_date:
|
||||
self.remarks = _("Against Customer Order {0} dated {1}").format(self.po_no,
|
||||
formatdate(self.po_date))
|
||||
else:
|
||||
self.remarks = _("No Remarks")
|
||||
|
||||
def validate_auto_set_posting_time(self):
|
||||
# Don't auto set the posting date and time if invoice is amended
|
||||
|
||||
@@ -1877,23 +1877,6 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
def test_einvoice_json(self):
|
||||
from erpnext.regional.india.e_invoice.utils import make_einvoice
|
||||
|
||||
customer_gstin = '27AACCM7806M1Z3'
|
||||
customer_gstin_dtls = {
|
||||
'LegalName': '_Test Customer', 'TradeName': '_Test Customer', 'AddrLoc': '_Test City',
|
||||
'StateCode': '27', 'AddrPncd': '410038', 'AddrBno': '_Test Bldg',
|
||||
'AddrBnm': '100', 'AddrFlno': '200', 'AddrSt': '_Test Street'
|
||||
}
|
||||
company_gstin = '27AAECE4835E1ZR'
|
||||
company_gstin_dtls = {
|
||||
'LegalName': '_Test Company', 'TradeName': '_Test Company', 'AddrLoc': '_Test City',
|
||||
'StateCode': '27', 'AddrPncd': '401108', 'AddrBno': '_Test Bldg',
|
||||
'AddrBnm': '100', 'AddrFlno': '200', 'AddrSt': '_Test Street'
|
||||
}
|
||||
# set cache gstin details to avoid fetching details which will require connection to GSP servers
|
||||
frappe.local.gstin_cache = {}
|
||||
frappe.local.gstin_cache[customer_gstin] = customer_gstin_dtls
|
||||
frappe.local.gstin_cache[company_gstin] = company_gstin_dtls
|
||||
|
||||
si = make_sales_invoice_for_ewaybill()
|
||||
si.naming_series = 'INV-2020-.#####'
|
||||
si.items = []
|
||||
@@ -1901,8 +1884,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
"item_code": "_Test Item",
|
||||
"uom": "Nos",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"qty": 2,
|
||||
"rate": 100,
|
||||
"qty": 2000,
|
||||
"rate": 12,
|
||||
"income_account": "Sales - _TC",
|
||||
"expense_account": "Cost of Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
@@ -1911,31 +1894,50 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
"item_code": "_Test Item 2",
|
||||
"uom": "Nos",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"qty": 4,
|
||||
"rate": 150,
|
||||
"qty": 420,
|
||||
"rate": 15,
|
||||
"income_account": "Sales - _TC",
|
||||
"expense_account": "Cost of Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
})
|
||||
si.discount_amount = 100
|
||||
si.save()
|
||||
|
||||
einvoice = make_einvoice(si)
|
||||
|
||||
total_item_ass_value = sum([d['AssAmt'] for d in einvoice['ItemList']])
|
||||
total_item_cgst_value = sum([d['CgstAmt'] for d in einvoice['ItemList']])
|
||||
total_item_sgst_value = sum([d['SgstAmt'] for d in einvoice['ItemList']])
|
||||
total_item_igst_value = sum([d['IgstAmt'] for d in einvoice['ItemList']])
|
||||
total_item_value = sum([d['TotItemVal'] for d in einvoice['ItemList']])
|
||||
total_item_ass_value = 0
|
||||
total_item_cgst_value = 0
|
||||
total_item_sgst_value = 0
|
||||
total_item_igst_value = 0
|
||||
total_item_value = 0
|
||||
|
||||
for item in einvoice['ItemList']:
|
||||
total_item_ass_value += item['AssAmt']
|
||||
total_item_cgst_value += item['CgstAmt']
|
||||
total_item_sgst_value += item['SgstAmt']
|
||||
total_item_igst_value += item['IgstAmt']
|
||||
total_item_value += item['TotItemVal']
|
||||
|
||||
self.assertTrue(item['AssAmt'], item['TotAmt'] - item['Discount'])
|
||||
self.assertTrue(item['TotItemVal'], item['AssAmt'] + item['CgstAmt'] + item['SgstAmt'] + item['IgstAmt'])
|
||||
|
||||
value_details = einvoice['ValDtls']
|
||||
|
||||
self.assertEqual(einvoice['Version'], '1.1')
|
||||
self.assertEqual(einvoice['ValDtls']['AssVal'], total_item_ass_value)
|
||||
self.assertEqual(einvoice['ValDtls']['CgstVal'], total_item_cgst_value)
|
||||
self.assertEqual(einvoice['ValDtls']['SgstVal'], total_item_sgst_value)
|
||||
self.assertEqual(einvoice['ValDtls']['IgstVal'], total_item_igst_value)
|
||||
self.assertEqual(einvoice['ValDtls']['TotInvVal'], total_item_value)
|
||||
self.assertTrue(abs(value_details['AssVal'] - total_item_ass_value) <= 1)
|
||||
self.assertTrue(abs(value_details['CgstVal'] - total_item_cgst_value) <= 1)
|
||||
self.assertTrue(abs(value_details['SgstVal'] - total_item_sgst_value) <= 1)
|
||||
self.assertTrue(abs(value_details['IgstVal'] - total_item_igst_value) <= 1)
|
||||
|
||||
calculated_invoice_value = \
|
||||
value_details['AssVal'] + value_details['CgstVal'] \
|
||||
+ value_details['SgstVal'] + value_details['IgstVal'] \
|
||||
+ value_details['OthChrg'] - value_details['Discount']
|
||||
|
||||
self.assertTrue(abs(value_details['TotInvVal'] - calculated_invoice_value) <= 1)
|
||||
self.assertTrue(einvoice['EwbDtls'])
|
||||
|
||||
def make_sales_invoice_for_ewaybill():
|
||||
def make_test_address_for_ewaybill():
|
||||
if not frappe.db.exists('Address', '_Test Address for Eway bill-Billing'):
|
||||
address = frappe.get_doc({
|
||||
"address_line1": "_Test Address Line 1",
|
||||
@@ -1983,7 +1985,8 @@ def make_sales_invoice_for_ewaybill():
|
||||
})
|
||||
|
||||
address.save()
|
||||
|
||||
|
||||
def make_test_transporter_for_ewaybill():
|
||||
if not frappe.db.exists('Supplier', '_Test Transporter'):
|
||||
frappe.get_doc({
|
||||
"doctype": "Supplier",
|
||||
@@ -1994,12 +1997,17 @@ def make_sales_invoice_for_ewaybill():
|
||||
"is_transporter": 1
|
||||
}).insert()
|
||||
|
||||
def make_sales_invoice_for_ewaybill():
|
||||
make_test_address_for_ewaybill()
|
||||
make_test_transporter_for_ewaybill()
|
||||
|
||||
gst_settings = frappe.get_doc("GST Settings")
|
||||
|
||||
gst_account = frappe.get_all(
|
||||
"GST Account",
|
||||
fields=["cgst_account", "sgst_account", "igst_account"],
|
||||
filters = {"company": "_Test Company"})
|
||||
filters = {"company": "_Test Company"}
|
||||
)
|
||||
|
||||
if not gst_account:
|
||||
gst_settings.append("gst_accounts", {
|
||||
@@ -2011,7 +2019,7 @@ def make_sales_invoice_for_ewaybill():
|
||||
|
||||
gst_settings.save()
|
||||
|
||||
si = create_sales_invoice(do_not_save =1, rate = '60000')
|
||||
si = create_sales_invoice(do_not_save=1, rate='60000')
|
||||
|
||||
si.distance = 2000
|
||||
si.company_address = "_Test Address for Eway bill-Billing"
|
||||
@@ -2039,27 +2047,6 @@ def make_sales_invoice_for_ewaybill():
|
||||
|
||||
return si
|
||||
|
||||
def test_item_tax_validity(self):
|
||||
item = frappe.get_doc("Item", "_Test Item 2")
|
||||
|
||||
if item.taxes:
|
||||
item.taxes = []
|
||||
item.save()
|
||||
|
||||
item.append("taxes", {
|
||||
"item_tax_template": "_Test Item Tax Template 1",
|
||||
"valid_from": add_days(nowdate(), 1)
|
||||
})
|
||||
|
||||
item.save()
|
||||
|
||||
sales_invoice = create_sales_invoice(item = "_Test Item 2", do_not_save=1)
|
||||
sales_invoice.items[0].item_tax_template = "_Test Item Tax Template 1"
|
||||
self.assertRaises(frappe.ValidationError, sales_invoice.save)
|
||||
|
||||
item.taxes = []
|
||||
item.save()
|
||||
|
||||
def create_sales_invoice(**args):
|
||||
si = frappe.new_doc("Sales Invoice")
|
||||
args = frappe._dict(args)
|
||||
|
||||
@@ -34,6 +34,9 @@ def valdiate_taxes_and_charges_template(doc):
|
||||
|
||||
validate_disabled(doc)
|
||||
|
||||
# Validate with existing taxes and charges template for unique tax category
|
||||
validate_for_tax_category(doc)
|
||||
|
||||
for tax in doc.get("taxes"):
|
||||
validate_taxes_and_charges(tax)
|
||||
validate_inclusive_tax(tax, doc)
|
||||
@@ -41,3 +44,7 @@ def valdiate_taxes_and_charges_template(doc):
|
||||
def validate_disabled(doc):
|
||||
if doc.is_default and doc.disabled:
|
||||
frappe.throw(_("Disabled template must not be default template"))
|
||||
|
||||
def validate_for_tax_category(doc):
|
||||
if frappe.db.exists(doc.doctype, {"company": doc.company, "tax_category": doc.tax_category, "disabled": 0}):
|
||||
frappe.throw(_("A template with tax category {0} already exists. Only one template is allowed with each tax category").format(frappe.bold(doc.tax_category)))
|
||||
|
||||
@@ -298,7 +298,8 @@ class Subscription(Document):
|
||||
Returns the `Item`s linked to `Subscription Plan`
|
||||
"""
|
||||
if prorate:
|
||||
prorate_factor = get_prorata_factor(self.current_invoice_end, self.current_invoice_start)
|
||||
prorate_factor = get_prorata_factor(self.current_invoice_end, self.current_invoice_start,
|
||||
self.generate_invoice_at_period_start)
|
||||
|
||||
items = []
|
||||
customer = self.customer
|
||||
@@ -333,7 +334,7 @@ class Subscription(Document):
|
||||
if not self.generate_invoice_at_period_start:
|
||||
return False
|
||||
|
||||
if self.is_new_subscription():
|
||||
if self.is_new_subscription() and getdate(nowdate()) >= getdate(self.current_invoice_start):
|
||||
return True
|
||||
|
||||
# Check invoice dates and make sure it doesn't have outstanding invoices
|
||||
@@ -468,11 +469,13 @@ class Subscription(Document):
|
||||
if invoice:
|
||||
return invoice.precision('grand_total')
|
||||
|
||||
|
||||
def get_prorata_factor(period_end, period_start):
|
||||
diff = flt(date_diff(nowdate(), period_start) + 1)
|
||||
plan_days = flt(date_diff(period_end, period_start) + 1)
|
||||
prorate_factor = diff / plan_days
|
||||
def get_prorata_factor(period_end, period_start, is_prepaid):
|
||||
if is_prepaid:
|
||||
prorate_factor = 1
|
||||
else:
|
||||
diff = flt(date_diff(nowdate(), period_start) + 1)
|
||||
plan_days = flt(date_diff(period_end, period_start) + 1)
|
||||
prorate_factor = diff / plan_days
|
||||
|
||||
return prorate_factor
|
||||
|
||||
|
||||
@@ -291,7 +291,8 @@ class TestSubscription(unittest.TestCase):
|
||||
|
||||
self.assertEqual(
|
||||
flt(
|
||||
get_prorata_factor(subscription.current_invoice_end, subscription.current_invoice_start),
|
||||
get_prorata_factor(subscription.current_invoice_end, subscription.current_invoice_start,
|
||||
subscription.generate_invoice_at_period_start),
|
||||
2),
|
||||
flt(prorate_factor, 2)
|
||||
)
|
||||
@@ -528,9 +529,7 @@ class TestSubscription(unittest.TestCase):
|
||||
current_inv = subscription.get_current_invoice()
|
||||
self.assertEqual(current_inv.status, "Unpaid")
|
||||
|
||||
diff = flt(date_diff(nowdate(), subscription.current_invoice_start) + 1)
|
||||
plan_days = flt(date_diff(subscription.current_invoice_end, subscription.current_invoice_start) + 1)
|
||||
prorate_factor = flt(diff / plan_days)
|
||||
prorate_factor = 1
|
||||
|
||||
self.assertEqual(flt(current_inv.grand_total, 2), flt(prorate_factor * 900, 2))
|
||||
|
||||
|
||||
@@ -2018,34 +2018,57 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
apply_pricing_rule: function () {
|
||||
var me = this;
|
||||
|
||||
var remove_item = false;
|
||||
$.each(this.frm.doc["items"], function (n, item) {
|
||||
var pricing_rule = me.get_pricing_rule(item)
|
||||
me.validate_pricing_rule(pricing_rule)
|
||||
if (pricing_rule.length) {
|
||||
item.pricing_rule = pricing_rule[0].name;
|
||||
item.margin_type = pricing_rule[0].margin_type;
|
||||
item.price_list_rate = pricing_rule[0].price || item.price_list_rate;
|
||||
item.margin_rate_or_amount = pricing_rule[0].margin_rate_or_amount;
|
||||
item.discount_percentage = pricing_rule[0].discount_percentage || 0.0;
|
||||
me.apply_pricing_rule_on_item(item)
|
||||
if (pricing_rule[0].price_or_product_discount == "Price") {
|
||||
item.pricing_rule = pricing_rule[0].name;
|
||||
item.margin_type = pricing_rule[0].margin_type;
|
||||
item.price_list_rate = pricing_rule[0].price || item.price_list_rate;
|
||||
item.margin_rate_or_amount = pricing_rule[0].margin_rate_or_amount;
|
||||
item.discount_percentage = pricing_rule[0].discount_percentage || 0.0;
|
||||
me.apply_pricing_rule_on_item(item)
|
||||
} else {
|
||||
me.child = frappe.model.add_child(me.frm.doc, me.frm.doc.doctype + " Item", "items");
|
||||
me.child.item_code = pricing_rule[0].same_item ? item.item_code : pricing_rule[0].free_item;
|
||||
me.child.item_name = pricing_rule[0].same_item ? item.item_name : pricing_rule[0].free_item;
|
||||
me.child.stock_uom = pricing_rule[0].same_item ? item.stock_uom : pricing_rule[0].free_item_uom;
|
||||
me.child.uom = pricing_rule[0].same_item ? item.uom : pricing_rule[0].free_item_uom;
|
||||
me.child.conversion_factor = 1;
|
||||
me.child.qty = pricing_rule.qty || 1;
|
||||
me.child.is_free_item = 1;
|
||||
me.child.brand = pricing_rule[0].same_item ? item.brand : "";
|
||||
me.child.description = pricing_rule[0].same_item ? item.description : pricing_rule[0].free_item;
|
||||
}
|
||||
} else if (item.pricing_rule) {
|
||||
item.price_list_rate = me.price_list_data[item.item_code]
|
||||
item.margin_rate_or_amount = 0.0;
|
||||
item.discount_percentage = 0.0;
|
||||
item.pricing_rule = null;
|
||||
me.apply_pricing_rule_on_item(item)
|
||||
} else if (item.is_free_item) {
|
||||
remove_item = true;
|
||||
item.qty = 0
|
||||
}
|
||||
|
||||
if(item.discount_percentage > 0) {
|
||||
me.apply_pricing_rule_on_item(item)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
if (remove_item) {
|
||||
this.remove_zero_qty_items_from_cart();
|
||||
}
|
||||
},
|
||||
|
||||
get_pricing_rule: function (item) {
|
||||
var me = this;
|
||||
return $.grep(this.pricing_rules, function (data) {
|
||||
if (item.qty >= data.min_qty && (item.qty <= (data.max_qty ? data.max_qty : item.qty))) {
|
||||
me.get_mixed_min_max_qty_and_amt(data, item);
|
||||
if (data.mixed_qty >= data.min_qty && (data.mixed_qty <= (data.max_qty ? data.max_qty : data.mixed_qty))) {
|
||||
if (me.validate_item_condition(data, item)) {
|
||||
if (in_list(['Customer', 'Customer Group', 'Territory', 'Campaign'], data.applicable_for)) {
|
||||
return me.validate_condition(data)
|
||||
@@ -2057,11 +2080,26 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
})
|
||||
},
|
||||
|
||||
get_mixed_min_max_qty_and_amt: function(data, item) {
|
||||
var apply_on = frappe.model.scrub(data.apply_on);
|
||||
data.mixed_qty = 0.0
|
||||
if (data.mixed_conditions && in_list(data[apply_on], item[apply_on])) {
|
||||
this.frm.doc.items.forEach(d => {
|
||||
if (in_list(data[apply_on], d[apply_on])) {
|
||||
data.mixed_qty += d.qty;
|
||||
data.mixed_amt += d.amount;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
data.mixed_qty = item.qty;
|
||||
data.mixed_amt = item.amount;
|
||||
}
|
||||
},
|
||||
|
||||
validate_item_condition: function (data, item) {
|
||||
var apply_on = frappe.model.scrub(data.apply_on);
|
||||
|
||||
return (data.apply_on == 'Item Group')
|
||||
? this.validate_item_group(data.item_group, item.item_group) : (data[apply_on] == item[apply_on]);
|
||||
return in_list(data[apply_on], item[apply_on]);
|
||||
},
|
||||
|
||||
validate_item_group: function (pr_item_group, cart_item_group) {
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.CesVal, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(0, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.Discount, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(0, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.OthChrg, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.RndOffAmt, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.TotInvVal, None, "INR") }}</td>
|
||||
</tr>
|
||||
|
||||
@@ -15,15 +15,51 @@ def execute(filters=None):
|
||||
return columns, data
|
||||
|
||||
def get_columns():
|
||||
return [
|
||||
_("Payment Document") + "::130",
|
||||
_("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":110",
|
||||
_("Posting Date") + ":Date:100",
|
||||
_("Cheque/Reference No") + "::120",
|
||||
_("Clearance Date") + ":Date:100",
|
||||
_("Against Account") + ":Link/Account:170",
|
||||
_("Amount") + ":Currency:120"
|
||||
]
|
||||
columns = [{
|
||||
"label": _("Payment Document Type"),
|
||||
"fieldname": "payment_document_type",
|
||||
"fieldtype": "Link",
|
||||
"options": "Doctype",
|
||||
"width": 130
|
||||
},
|
||||
{
|
||||
"label": _("Payment Entry"),
|
||||
"fieldname": "payment_entry",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "payment_document_type",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"label": _("Posting Date"),
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Cheque/Reference No"),
|
||||
"fieldname": "cheque_no",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Clearance Date"),
|
||||
"fieldname": "clearance_date",
|
||||
"fieldtype": "Date",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Against Account"),
|
||||
"fieldname": "against",
|
||||
"fieldtype": "Link",
|
||||
"options": "Account",
|
||||
"width": 170
|
||||
},
|
||||
{
|
||||
"label": _("Amount"),
|
||||
"fieldname": "amount",
|
||||
"width": 120
|
||||
}]
|
||||
|
||||
return columns
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
|
||||
@@ -206,7 +206,7 @@ def get_data(companies, root_type, balance_must_be, fiscal_year, filters=None, i
|
||||
|
||||
set_gl_entries_by_account(fiscal_year.year_start_date,
|
||||
fiscal_year.year_end_date, root.lft, root.rgt, filters,
|
||||
gl_entries_by_account, accounts_by_name, ignore_closing_entries=False)
|
||||
gl_entries_by_account, accounts_by_name, accounts, ignore_closing_entries=False)
|
||||
|
||||
calculate_values(accounts_by_name, gl_entries_by_account, companies, fiscal_year, filters)
|
||||
accumulate_values_into_parents(accounts, accounts_by_name, companies)
|
||||
@@ -325,7 +325,7 @@ def prepare_data(accounts, fiscal_year, balance_must_be, companies, company_curr
|
||||
return data
|
||||
|
||||
def set_gl_entries_by_account(from_date, to_date, root_lft, root_rgt, filters, gl_entries_by_account,
|
||||
accounts_by_name, ignore_closing_entries=False):
|
||||
accounts_by_name, accounts, ignore_closing_entries=False):
|
||||
"""Returns a dict like { "account": [gl entries], ... }"""
|
||||
|
||||
company_lft, company_rgt = frappe.get_cached_value('Company',
|
||||
@@ -368,15 +368,31 @@ def set_gl_entries_by_account(from_date, to_date, root_lft, root_rgt, filters, g
|
||||
|
||||
for entry in gl_entries:
|
||||
key = entry.account_number or entry.account_name
|
||||
validate_entries(key, entry, accounts_by_name)
|
||||
validate_entries(key, entry, accounts_by_name, accounts)
|
||||
gl_entries_by_account.setdefault(key, []).append(entry)
|
||||
|
||||
return gl_entries_by_account
|
||||
|
||||
def validate_entries(key, entry, accounts_by_name):
|
||||
def get_account_details(account):
|
||||
return frappe.get_cached_value('Account', account, ['name', 'report_type', 'root_type', 'company',
|
||||
'is_group', 'account_name', 'account_number', 'parent_account', 'lft', 'rgt'], as_dict=1)
|
||||
|
||||
def validate_entries(key, entry, accounts_by_name, accounts):
|
||||
if key not in accounts_by_name:
|
||||
field = "Account number" if entry.account_number else "Account name"
|
||||
frappe.throw(_("{0} {1} is not present in the parent company").format(field, key))
|
||||
args = get_account_details(entry.account)
|
||||
|
||||
if args.parent_account:
|
||||
parent_args = get_account_details(args.parent_account)
|
||||
|
||||
args.update({
|
||||
'lft': parent_args.lft + 1,
|
||||
'rgt': parent_args.rgt - 1,
|
||||
'root_type': parent_args.root_type,
|
||||
'report_type': parent_args.report_type
|
||||
})
|
||||
|
||||
accounts_by_name.setdefault(key, args)
|
||||
accounts.append(args)
|
||||
|
||||
def get_additional_conditions(from_date, ignore_closing_entries, filters):
|
||||
additional_conditions = []
|
||||
|
||||
@@ -8,6 +8,7 @@ from frappe.utils import flt
|
||||
from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register import (get_tax_accounts,
|
||||
get_grand_total, add_total_row, get_display_value, get_group_by_and_display_fields, add_sub_total_row,
|
||||
get_group_by_conditions)
|
||||
from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import get_item_details
|
||||
|
||||
def execute(filters=None):
|
||||
return _execute(filters)
|
||||
@@ -23,7 +24,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
aii_account_map = get_aii_accounts()
|
||||
if item_list:
|
||||
itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency,
|
||||
doctype="Purchase Invoice", tax_doctype="Purchase Taxes and Charges")
|
||||
doctype='Purchase Invoice', tax_doctype='Purchase Taxes and Charges')
|
||||
|
||||
po_pr_map = get_purchase_receipts_against_purchase_order(item_list)
|
||||
|
||||
@@ -35,10 +36,14 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
if filters.get('group_by'):
|
||||
grand_total = get_grand_total(filters, 'Purchase Invoice')
|
||||
|
||||
item_details = get_item_details()
|
||||
|
||||
for d in item_list:
|
||||
if not d.stock_qty:
|
||||
continue
|
||||
|
||||
item_record = item_details.get(d.item_code)
|
||||
|
||||
purchase_receipt = None
|
||||
if d.purchase_receipt:
|
||||
purchase_receipt = d.purchase_receipt
|
||||
@@ -49,8 +54,8 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
|
||||
row = {
|
||||
'item_code': d.item_code,
|
||||
'item_name': d.item_name,
|
||||
'item_group': d.item_group,
|
||||
'item_name': item_record.item_name if item_record else d.item_name,
|
||||
'item_group': item_record.item_group if item_record else d.item_group,
|
||||
'description': d.description,
|
||||
'invoice': d.parent,
|
||||
'posting_date': d.posting_date,
|
||||
@@ -82,10 +87,10 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
for tax in tax_columns:
|
||||
item_tax = itemised_tax.get(d.name, {}).get(tax, {})
|
||||
row.update({
|
||||
frappe.scrub(tax + ' Rate'): item_tax.get("tax_rate", 0),
|
||||
frappe.scrub(tax + ' Amount'): item_tax.get("tax_amount", 0),
|
||||
frappe.scrub(tax + ' Rate'): item_tax.get('tax_rate', 0),
|
||||
frappe.scrub(tax + ' Amount'): item_tax.get('tax_amount', 0),
|
||||
})
|
||||
total_tax += flt(item_tax.get("tax_amount"))
|
||||
total_tax += flt(item_tax.get('tax_amount'))
|
||||
|
||||
row.update({
|
||||
'total_tax': total_tax,
|
||||
@@ -317,8 +322,9 @@ def get_items(filters, additional_query_columns):
|
||||
select
|
||||
`tabPurchase Invoice Item`.`name`, `tabPurchase Invoice Item`.`parent`,
|
||||
`tabPurchase Invoice`.posting_date, `tabPurchase Invoice`.credit_to, `tabPurchase Invoice`.company,
|
||||
`tabPurchase Invoice`.supplier, `tabPurchase Invoice`.remarks, `tabPurchase Invoice`.base_net_total, `tabPurchase Invoice Item`.`item_code`,
|
||||
`tabPurchase Invoice Item`.`item_name`, `tabPurchase Invoice Item`.`item_group`, `tabPurchase Invoice Item`.description,
|
||||
`tabPurchase Invoice`.supplier, `tabPurchase Invoice`.remarks, `tabPurchase Invoice`.base_net_total,
|
||||
`tabPurchase Invoice Item`.`item_code`, `tabPurchase Invoice Item`.description,
|
||||
`tabPurchase Invoice Item`.`item_name`, `tabPurchase Invoice Item`.`item_group`,
|
||||
`tabPurchase Invoice Item`.`project`, `tabPurchase Invoice Item`.`purchase_order`,
|
||||
`tabPurchase Invoice Item`.`purchase_receipt`, `tabPurchase Invoice Item`.`po_detail`,
|
||||
`tabPurchase Invoice Item`.`expense_account`, `tabPurchase Invoice Item`.`stock_qty`,
|
||||
|
||||
@@ -8,6 +8,7 @@ from frappe.utils import flt, cstr
|
||||
from frappe.model.meta import get_field_precision
|
||||
from frappe.utils.xlsxutils import handle_html
|
||||
from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments
|
||||
from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import get_item_details, get_customer_details
|
||||
|
||||
def execute(filters=None):
|
||||
return _execute(filters)
|
||||
@@ -17,7 +18,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
filters.update({"from_date": filters.get("date_range") and filters.get("date_range")[0], "to_date": filters.get("date_range") and filters.get("date_range")[1]})
|
||||
columns = get_columns(additional_table_columns, filters)
|
||||
|
||||
company_currency = frappe.get_cached_value('Company', filters.get("company"), "default_currency")
|
||||
company_currency = frappe.get_cached_value('Company', filters.get('company'), 'default_currency')
|
||||
|
||||
item_list = get_items(filters, additional_query_columns)
|
||||
if item_list:
|
||||
@@ -34,7 +35,13 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
if filters.get('group_by'):
|
||||
grand_total = get_grand_total(filters, 'Sales Invoice')
|
||||
|
||||
customer_details = get_customer_details()
|
||||
item_details = get_item_details()
|
||||
|
||||
for d in item_list:
|
||||
customer_record = customer_details.get(d.customer)
|
||||
item_record = item_details.get(d.item_code)
|
||||
|
||||
delivery_note = None
|
||||
if d.delivery_note:
|
||||
delivery_note = d.delivery_note
|
||||
@@ -46,14 +53,14 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
|
||||
row = {
|
||||
'item_code': d.item_code,
|
||||
'item_name': d.item_name,
|
||||
'item_group': d.item_group,
|
||||
'item_name': item_record.item_name if item_record else d.item_name,
|
||||
'item_group': item_record.item_group if item_record else d.item_group,
|
||||
'description': d.description,
|
||||
'invoice': d.parent,
|
||||
'posting_date': d.posting_date,
|
||||
'customer': d.customer,
|
||||
'customer_name': d.customer_name,
|
||||
'customer_group': d.customer_group,
|
||||
'customer_name': customer_record.customer_name,
|
||||
'customer_group': customer_record.customer_group,
|
||||
}
|
||||
|
||||
if additional_query_columns:
|
||||
@@ -91,10 +98,10 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
for tax in tax_columns:
|
||||
item_tax = itemised_tax.get(d.name, {}).get(tax, {})
|
||||
row.update({
|
||||
frappe.scrub(tax + ' Rate'): item_tax.get("tax_rate", 0),
|
||||
frappe.scrub(tax + ' Amount'): item_tax.get("tax_amount", 0),
|
||||
frappe.scrub(tax + ' Rate'): item_tax.get('tax_rate', 0),
|
||||
frappe.scrub(tax + ' Amount'): item_tax.get('tax_amount', 0),
|
||||
})
|
||||
total_tax += flt(item_tax.get("tax_amount"))
|
||||
total_tax += flt(item_tax.get('tax_amount'))
|
||||
|
||||
row.update({
|
||||
'total_tax': total_tax,
|
||||
@@ -227,7 +234,7 @@ def get_columns(additional_table_columns, filters):
|
||||
if filters.get('group_by') != 'Terriotory':
|
||||
columns.extend([
|
||||
{
|
||||
'label': _("Territory"),
|
||||
'label': _('Territory'),
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'options': 'Territory',
|
||||
@@ -382,13 +389,13 @@ def get_items(filters, additional_query_columns):
|
||||
`tabSales Invoice`.posting_date, `tabSales Invoice`.debit_to,
|
||||
`tabSales Invoice`.project, `tabSales Invoice`.customer, `tabSales Invoice`.remarks,
|
||||
`tabSales Invoice`.territory, `tabSales Invoice`.company, `tabSales Invoice`.base_net_total,
|
||||
`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.item_name,
|
||||
`tabSales Invoice Item`.item_group, `tabSales Invoice Item`.description, `tabSales Invoice Item`.sales_order,
|
||||
`tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.income_account,
|
||||
`tabSales Invoice Item`.cost_center, `tabSales Invoice Item`.stock_qty,
|
||||
`tabSales Invoice Item`.stock_uom, `tabSales Invoice Item`.base_net_rate,
|
||||
`tabSales Invoice Item`.base_net_amount, `tabSales Invoice`.customer_name,
|
||||
`tabSales Invoice`.customer_group, `tabSales Invoice Item`.so_detail,
|
||||
`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description,
|
||||
`tabSales Invoice Item`.`item_name`, `tabSales Invoice Item`.`item_group`,
|
||||
`tabSales Invoice Item`.sales_order, `tabSales Invoice Item`.delivery_note,
|
||||
`tabSales Invoice Item`.income_account, `tabSales Invoice Item`.cost_center,
|
||||
`tabSales Invoice Item`.stock_qty, `tabSales Invoice Item`.stock_uom,
|
||||
`tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount,
|
||||
`tabSales Invoice`.customer_name, `tabSales Invoice`.customer_group, `tabSales Invoice Item`.so_detail,
|
||||
`tabSales Invoice`.update_stock, `tabSales Invoice Item`.uom, `tabSales Invoice Item`.qty {0}
|
||||
from `tabSales Invoice`, `tabSales Invoice Item`
|
||||
where `tabSales Invoice`.name = `tabSales Invoice Item`.parent
|
||||
@@ -425,14 +432,14 @@ def get_deducted_taxes():
|
||||
return frappe.db.sql_list("select name from `tabPurchase Taxes and Charges` where add_deduct_tax = 'Deduct'")
|
||||
|
||||
def get_tax_accounts(item_list, columns, company_currency,
|
||||
doctype="Sales Invoice", tax_doctype="Sales Taxes and Charges"):
|
||||
doctype='Sales Invoice', tax_doctype='Sales Taxes and Charges'):
|
||||
import json
|
||||
item_row_map = {}
|
||||
tax_columns = []
|
||||
invoice_item_row = {}
|
||||
itemised_tax = {}
|
||||
|
||||
tax_amount_precision = get_field_precision(frappe.get_meta(tax_doctype).get_field("tax_amount"),
|
||||
tax_amount_precision = get_field_precision(frappe.get_meta(tax_doctype).get_field('tax_amount'),
|
||||
currency=company_currency) or 2
|
||||
|
||||
for d in item_list:
|
||||
@@ -477,8 +484,8 @@ def get_tax_accounts(item_list, columns, company_currency,
|
||||
tax_rate = tax_data
|
||||
tax_amount = 0
|
||||
|
||||
if charge_type == "Actual" and not tax_rate:
|
||||
tax_rate = "NA"
|
||||
if charge_type == 'Actual' and not tax_rate:
|
||||
tax_rate = 'NA'
|
||||
|
||||
item_net_amount = sum([flt(d.base_net_amount)
|
||||
for d in item_row_map.get(parent, {}).get(item_code, [])])
|
||||
@@ -492,17 +499,17 @@ def get_tax_accounts(item_list, columns, company_currency,
|
||||
if (doctype == 'Purchase Invoice' and name in deducted_tax) else tax_value)
|
||||
|
||||
itemised_tax.setdefault(d.name, {})[description] = frappe._dict({
|
||||
"tax_rate": tax_rate,
|
||||
"tax_amount": tax_value
|
||||
'tax_rate': tax_rate,
|
||||
'tax_amount': tax_value
|
||||
})
|
||||
|
||||
except ValueError:
|
||||
continue
|
||||
elif charge_type == "Actual" and tax_amount:
|
||||
elif charge_type == 'Actual' and tax_amount:
|
||||
for d in invoice_item_row.get(parent, []):
|
||||
itemised_tax.setdefault(d.name, {})[description] = frappe._dict({
|
||||
"tax_rate": "NA",
|
||||
"tax_amount": flt((tax_amount * d.base_net_amount) / d.base_net_total,
|
||||
'tax_rate': 'NA',
|
||||
'tax_amount': flt((tax_amount * d.base_net_amount) / d.base_net_total,
|
||||
tax_amount_precision)
|
||||
})
|
||||
|
||||
@@ -564,7 +571,7 @@ def add_total_row(data, filters, prev_group_by_value, item, total_row_map,
|
||||
})
|
||||
|
||||
total_row_map.setdefault('total_row', {
|
||||
subtotal_display_field: "Total",
|
||||
subtotal_display_field: 'Total',
|
||||
'stock_qty': 0.0,
|
||||
'amount': 0.0,
|
||||
'bold': 1,
|
||||
|
||||
@@ -59,23 +59,111 @@ def validate_filters(filters):
|
||||
|
||||
def get_columns(filters):
|
||||
return [
|
||||
_("Payment Document") + ":: 100",
|
||||
_("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":140",
|
||||
_("Party Type") + "::100",
|
||||
_("Party") + ":Dynamic Link/Party Type:140",
|
||||
_("Posting Date") + ":Date:100",
|
||||
_("Invoice") + (":Link/Purchase Invoice:130" if filters.get("payment_type") == _("Outgoing") else ":Link/Sales Invoice:130"),
|
||||
_("Invoice Posting Date") + ":Date:130",
|
||||
_("Payment Due Date") + ":Date:130",
|
||||
_("Debit") + ":Currency:120",
|
||||
_("Credit") + ":Currency:120",
|
||||
_("Remarks") + "::150",
|
||||
_("Age") +":Int:40",
|
||||
"0-30:Currency:100",
|
||||
"30-60:Currency:100",
|
||||
"60-90:Currency:100",
|
||||
_("90-Above") + ":Currency:100",
|
||||
_("Delay in payment (Days)") + "::150"
|
||||
{
|
||||
"fieldname": "payment_document",
|
||||
"label": _("Payment Document Type"),
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"fieldname": "payment_entry",
|
||||
"label": _("Payment Document"),
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "payment_document",
|
||||
"width": 160
|
||||
},
|
||||
{
|
||||
"fieldname": "party_type",
|
||||
"label": _("Party Type"),
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"fieldname": "party",
|
||||
"label": _("Party"),
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "party_type",
|
||||
"width": 160
|
||||
},
|
||||
{
|
||||
"fieldname": "posting_date",
|
||||
"label": _("Posting Date"),
|
||||
"fieldtype": "Date",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"fieldname": "invoice",
|
||||
"label": _("Invoice"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Purchase Invoice" if filters.get("payment_type") == _("Outgoing") else "Sales Invoice",
|
||||
"width": 160
|
||||
},
|
||||
{
|
||||
"fieldname": "invoice_posting_date",
|
||||
"label": _("Invoice Posting Date"),
|
||||
"fieldtype": "Date",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"fieldname": "due_date",
|
||||
"label": _("Payment Due Date"),
|
||||
"fieldtype": "Date",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"fieldname": "debit",
|
||||
"label": _("Debit"),
|
||||
"fieldtype": "Currency",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"fieldname": "credit",
|
||||
"label": _("Credit"),
|
||||
"fieldtype": "Currency",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"fieldname": "remarks",
|
||||
"label": _("Remarks"),
|
||||
"fieldtype": "Data",
|
||||
"width": 200
|
||||
},
|
||||
{
|
||||
"fieldname": "age",
|
||||
"label": _("Age"),
|
||||
"fieldtype": "Int",
|
||||
"width": 50
|
||||
},
|
||||
{
|
||||
"fieldname": "range1",
|
||||
"label": _("0-30"),
|
||||
"fieldtype": "Currency",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"fieldname": "range2",
|
||||
"label": _("30-60"),
|
||||
"fieldtype": "Currency",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"fieldname": "range3",
|
||||
"label": _("60-90"),
|
||||
"fieldtype": "Currency",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"fieldname": "range4",
|
||||
"label": _("90 Above"),
|
||||
"fieldtype": "Currency",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"fieldname": "delay_in_payment",
|
||||
"label": _("Delay in payment (Days)"),
|
||||
"fieldtype": "Int",
|
||||
"width": 100
|
||||
}
|
||||
]
|
||||
|
||||
def get_conditions(filters):
|
||||
|
||||
@@ -136,6 +136,8 @@ frappe.ui.form.on('Asset', {
|
||||
|
||||
if (frm.doc.docstatus == 0) {
|
||||
frm.toggle_reqd("finance_books", frm.doc.calculate_depreciation);
|
||||
frm.set_df_property('depreciation_start_date', 'reqd', 1, frm.doc.name, 'finance_books');
|
||||
frm.refresh_field('finance_books');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -50,6 +50,5 @@ frappe.ui.form.on('Asset Category', {
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2018-05-08 14:44:37.095570",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
@@ -54,9 +53,7 @@
|
||||
"fieldname": "depreciation_start_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Depreciation Posting Date",
|
||||
"mandatory_depends_on": "eval:parent.doctype == 'Asset'",
|
||||
"reqd": 1
|
||||
"label": "Depreciation Posting Date"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
@@ -84,10 +81,8 @@
|
||||
"label": "Rate of Depreciation"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-10-30 15:22:29.119868",
|
||||
"modified": "2020-12-30 15:43:03.188256",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Asset Finance Book",
|
||||
|
||||
@@ -141,7 +141,7 @@ def get_data(filters):
|
||||
|
||||
assets_record = frappe.db.get_all("Asset",
|
||||
filters=conditions,
|
||||
fields=["name", "asset_name", "department", "cost_center", "purchase_receipt",
|
||||
fields=["name as asset_id", "asset_name", "department", "cost_center", "purchase_receipt",
|
||||
"asset_category", "purchase_date", "gross_purchase_amount", "location",
|
||||
"available_for_use_date", "status", "purchase_invoice", "opening_accumulated_depreciation"])
|
||||
|
||||
|
||||
@@ -1056,7 +1056,7 @@
|
||||
"idx": 105,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-09-14 14:36:12.418690",
|
||||
"modified": "2021-01-22 20:27:11.418690",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
|
||||
@@ -89,7 +89,7 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
frappe.db.set_value("Accounts Settings", None, "over_billing_allowance", 0)
|
||||
|
||||
|
||||
def test_update_child_qty_rate(self):
|
||||
def test_update_child(self):
|
||||
mr = make_material_request(qty=10)
|
||||
po = make_purchase_order(mr.name)
|
||||
po.supplier = "_Test Supplier"
|
||||
@@ -119,7 +119,7 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
self.assertEqual(get_ordered_qty(), existing_ordered_qty + 3)
|
||||
|
||||
|
||||
def test_add_new_item_in_update_child_qty_rate(self):
|
||||
def test_update_child_adding_new_item(self):
|
||||
po = create_purchase_order(do_not_save=1)
|
||||
po.items[0].qty = 4
|
||||
po.save()
|
||||
@@ -145,7 +145,7 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
self.assertEqual(po.status, 'To Receive and Bill')
|
||||
|
||||
|
||||
def test_remove_item_in_update_child_qty_rate(self):
|
||||
def test_update_child_removing_item(self):
|
||||
po = create_purchase_order(do_not_save=1)
|
||||
po.items[0].qty = 4
|
||||
po.save()
|
||||
@@ -185,7 +185,7 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
self.assertEquals(len(po.get('items')), 1)
|
||||
self.assertEqual(po.status, 'To Receive and Bill')
|
||||
|
||||
def test_update_child_qty_rate_perm(self):
|
||||
def test_update_child_perm(self):
|
||||
po = create_purchase_order(item_code= "_Test Item", qty=4)
|
||||
|
||||
user = 'test@example.com'
|
||||
|
||||
@@ -108,6 +108,10 @@ class RequestforQuotation(BuyingController):
|
||||
'link_doctype': 'Supplier',
|
||||
'link_name': rfq_supplier.supplier
|
||||
})
|
||||
contact.append('email_ids', {
|
||||
'email_id': user.name,
|
||||
'is_primary': 1
|
||||
})
|
||||
|
||||
if not contact.email_id and not contact.user:
|
||||
contact.email_id = user.name
|
||||
|
||||
@@ -35,9 +35,7 @@ def update_last_purchase_rate(doc, is_submit):
|
||||
frappe.throw(_("UOM Conversion factor is required in row {0}").format(d.idx))
|
||||
|
||||
# update last purchsae rate
|
||||
if last_purchase_rate:
|
||||
frappe.db.sql("""update `tabItem` set last_purchase_rate = %s where name = %s""",
|
||||
(flt(last_purchase_rate), d.item_code))
|
||||
frappe.db.set_value('Item', d.item_code, 'last_purchase_rate', flt(last_purchase_rate))
|
||||
|
||||
def validate_for_items(doc):
|
||||
items = []
|
||||
|
||||
24
erpnext/change_log/v12/v12_17_0.md
Normal file
24
erpnext/change_log/v12/v12_17_0.md
Normal file
@@ -0,0 +1,24 @@
|
||||
## ERPNext v12.17.0 Release Notes
|
||||
|
||||
### Features
|
||||
|
||||
- Separated equity tree in COA SKR04 ([#24094](https://github.com/frappe/erpnext/pull/24094))
|
||||
- Display transporter address in sales invoice ([#23731](https://github.com/frappe/erpnext/pull/23731))
|
||||
- Introduced GST E-Invoicing ([#24184](https://github.com/frappe/erpnext/pull/24184))
|
||||
|
||||
### Fixes
|
||||
|
||||
- Fixed Payment Entry multi-currency issue ([#24331](https://github.com/frappe/erpnext/pull/24331))
|
||||
- Fixed an issue where user could have manufactured same serial no multiple times ([#24163](https://github.com/frappe/erpnext/pull/24163))
|
||||
- Back Update from QC based on Batch No ([#24368](https://github.com/frappe/erpnext/pull/24368))
|
||||
- Fixed tax calculation on salary slip for the first month ([#24309](https://github.com/frappe/erpnext/pull/24309)) ([#24272](https://github.com/frappe/erpnext/pull/24272))
|
||||
- Fixed issues related to e-invoicing ([#24366](https://github.com/frappe/erpnext/pull/24366)) ([#24421](https://github.com/frappe/erpnext/pull/24421)) ([#24284](https://github.com/frappe/erpnext/pull/24284))
|
||||
- Added a validation to restrict manual overriding of valuation rate in Stock Entry ([#24221](https://github.com/frappe/erpnext/pull/24221))
|
||||
- Fixed incorrect serial no. in the subcontracted Purchase Receipt ([#24353](https://github.com/frappe/erpnext/pull/24353))
|
||||
- Fixed an issue where Stock Ledger entry was not getting created against Stock Reconciliation ([#24384](https://github.com/frappe/erpnext/pull/24384))
|
||||
- Fixed company wise Valuation Rate for raw material in BOM ([#24367](https://github.com/frappe/erpnext/pull/24367))
|
||||
- Fixed Taxation related issue ([#24159](https://github.com/frappe/erpnext/pull/24159))
|
||||
- Allowed to override the basic rate for the finished good ([#24301](https://github.com/frappe/erpnext/pull/24301))
|
||||
- Fixed Loyalty Program related issues ([#24188](https://github.com/frappe/erpnext/pull/24188))
|
||||
- Fixed an issue where last purchase rate was not getting updated on canceling last voucher ([#24323](https://github.com/frappe/erpnext/pull/24323))
|
||||
- Fixed issue with pricing rule for offline POS ([#24288](https://github.com/frappe/erpnext/pull/24288))
|
||||
37
erpnext/change_log/v12/v12_18_0.md
Normal file
37
erpnext/change_log/v12/v12_18_0.md
Normal file
@@ -0,0 +1,37 @@
|
||||
## ERPNext v12.18.0 Release Notes
|
||||
|
||||
### Enhancements
|
||||
|
||||
- Make patient age translatable ([#24416](https://github.com/frappe/erpnext/pull/24416))
|
||||
- Adding UOM, Item Group via Update Items ([#24479](https://github.com/frappe/erpnext/pull/24479))
|
||||
|
||||
### Fixes
|
||||
|
||||
- Incorrect incoming rate for the sales return ([#24620](https://github.com/frappe/erpnext/pull/24620))
|
||||
- Prorata factor fixes in subscription ([#24638](https://github.com/frappe/erpnext/pull/24638))
|
||||
- QR code image generation for e-invoicing ([#24422](https://github.com/frappe/erpnext/pull/24422))
|
||||
- Validation for disabled warehouse ([#24546](https://github.com/frappe/erpnext/pull/24546))
|
||||
- Update total in words after updating items ([#24592](https://github.com/frappe/erpnext/pull/24592))
|
||||
- Set contact email in RFQ ([#24486](https://github.com/frappe/erpnext/pull/24486))
|
||||
- Plaid client version to support latest API ([#24532](https://github.com/frappe/erpnext/pull/24532))
|
||||
- Dynamic Links for reports ([#24461](https://github.com/frappe/erpnext/pull/24461))
|
||||
- Use supplied year for IRS 1099 forms ([#24425](https://github.com/frappe/erpnext/pull/24425))
|
||||
- Add check for allowing access to european region ([#24393](https://github.com/frappe/erpnext/pull/24393))
|
||||
- Item-wise Sales Register item_name error ([#24484](https://github.com/frappe/erpnext/pull/24484))
|
||||
- Skip e-invoice generation for non-taxable invoices (India) ([#24569](https://github.com/frappe/erpnext/pull/24569))
|
||||
- Issues with packing items ([#24606](https://github.com/frappe/erpnext/pull/24606))
|
||||
- Remove max 5 file attachment limit in task ([#24056](https://github.com/frappe/erpnext/pull/24056))
|
||||
- Calculate discount amount ([#24511](https://github.com/frappe/erpnext/pull/24511))
|
||||
- Validate tax template for tax category ([#24403](https://github.com/frappe/erpnext/pull/24403))
|
||||
- Do not validate gstin for exports (India) ([#24564](https://github.com/frappe/erpnext/pull/24564))
|
||||
- Stock ageing should not take cancelled stock entries. ([#24438](https://github.com/frappe/erpnext/pull/24438))
|
||||
- Discount amount calculation on net total ([#24498](https://github.com/frappe/erpnext/pull/24498))
|
||||
- Fetching of standalone cr/dr notes for reconciliation ([#24576](https://github.com/frappe/erpnext/pull/24576))
|
||||
- Avoid changing Ref. Doctype in Accounting Dimension after creation ([#24579](https://github.com/frappe/erpnext/pull/24579))
|
||||
- Add GST state code for Ladakh (India) ([#24635](https://github.com/frappe/erpnext/pull/24635))
|
||||
- Consolidated Financial Statement report not works if child company accounts not present in the parent company ([#24580](https://github.com/frappe/erpnext/pull/24580))
|
||||
- Missing Asset Id in the Fixed Asset Register Report ([#24391](https://github.com/frappe/erpnext/pull/24391))
|
||||
- e_invoice print format not showing other charges ([#24473](https://github.com/frappe/erpnext/pull/24473))
|
||||
- Fix filters for report IRS 1099 ([#24597](https://github.com/frappe/erpnext/pull/24597))
|
||||
- Stock ledger entry was not created against stock reconciliation ([#24382](https://github.com/frappe/erpnext/pull/24382))
|
||||
- Validate cancellation only if irn generated (India) ([#24609](https://github.com/frappe/erpnext/pull/24609))
|
||||
@@ -1185,43 +1185,28 @@ def add_taxes_from_tax_template(child_item, parent_doc):
|
||||
})
|
||||
tax_row.db_insert()
|
||||
|
||||
def set_sales_order_defaults(parent_doctype, parent_doctype_name, child_docname, trans_item):
|
||||
def set_order_defaults(parent_doctype, parent_doctype_name, child_doctype, child_docname, trans_item):
|
||||
"""
|
||||
Returns a Sales Order Item child item containing the default values
|
||||
Returns a Sales/Purchase Order Item child item containing the default values
|
||||
"""
|
||||
p_doc = frappe.get_doc(parent_doctype, parent_doctype_name)
|
||||
child_item = frappe.new_doc('Sales Order Item', p_doc, child_docname)
|
||||
child_item = frappe.new_doc(child_doctype, p_doc, child_docname)
|
||||
item = frappe.get_doc("Item", trans_item.get('item_code'))
|
||||
child_item.item_code = item.item_code
|
||||
child_item.item_name = item.item_name
|
||||
child_item.description = item.description
|
||||
child_item.delivery_date = trans_item.get('delivery_date') or p_doc.delivery_date
|
||||
child_item.conversion_factor = flt(trans_item.get('conversion_factor')) or get_conversion_factor(item.item_code, item.stock_uom).get("conversion_factor") or 1.0
|
||||
child_item.uom = item.stock_uom
|
||||
set_child_tax_template_and_map(item, child_item, p_doc)
|
||||
add_taxes_from_tax_template(child_item, p_doc)
|
||||
child_item.warehouse = get_item_warehouse(item, p_doc, overwrite_warehouse=True)
|
||||
if not child_item.warehouse:
|
||||
frappe.throw(_("Cannot find {} for item {}. Please set the same in Item Master or Stock Settings.")
|
||||
.format(frappe.bold("default warehouse"), frappe.bold(item.item_code)))
|
||||
return child_item
|
||||
|
||||
|
||||
def set_purchase_order_defaults(parent_doctype, parent_doctype_name, child_docname, trans_item):
|
||||
"""
|
||||
Returns a Purchase Order Item child item containing the default values
|
||||
"""
|
||||
p_doc = frappe.get_doc(parent_doctype, parent_doctype_name)
|
||||
child_item = frappe.new_doc('Purchase Order Item', p_doc, child_docname)
|
||||
item = frappe.get_doc("Item", trans_item.get('item_code'))
|
||||
child_item.item_code = item.item_code
|
||||
child_item.item_name = item.item_name
|
||||
child_item.description = item.description
|
||||
child_item.schedule_date = trans_item.get('schedule_date') or p_doc.schedule_date
|
||||
child_item.conversion_factor = flt(trans_item.get('conversion_factor')) or get_conversion_factor(item.item_code, item.stock_uom).get("conversion_factor") or 1.0
|
||||
child_item.uom = item.stock_uom
|
||||
child_item.base_rate = 1 # Initiallize value will update in parent validation
|
||||
child_item.base_amount = 1 # Initiallize value will update in parent validation
|
||||
for field in ("item_code", "item_name", "description", "item_group"):
|
||||
child_item.update({field: item.get(field)})
|
||||
date_fieldname = "delivery_date" if child_doctype == "Sales Order Item" else "schedule_date"
|
||||
child_item.update({date_fieldname: trans_item.get(date_fieldname) or p_doc.get(date_fieldname)})
|
||||
child_item.uom = trans_item.get("uom") or item.stock_uom
|
||||
conversion_factor = flt(get_conversion_factor(item.item_code, child_item.uom).get("conversion_factor"))
|
||||
child_item.conversion_factor = flt(trans_item.get('conversion_factor')) or conversion_factor
|
||||
if child_doctype == "Purchase Order Item":
|
||||
child_item.base_rate = 1 # Initiallize value will update in parent validation
|
||||
child_item.base_amount = 1 # Initiallize value will update in parent validation
|
||||
if child_doctype == "Sales Order Item":
|
||||
child_item.warehouse = get_item_warehouse(item, p_doc, overwrite_warehouse=True)
|
||||
if not child_item.warehouse:
|
||||
frappe.throw(_("Cannot find {} for item {}. Please set the same in Item Master or Stock Settings.")
|
||||
.format(frappe.bold("default warehouse"), frappe.bold(item.item_code)))
|
||||
set_child_tax_template_and_map(item, child_item, p_doc)
|
||||
add_taxes_from_tax_template(child_item, p_doc)
|
||||
return child_item
|
||||
@@ -1285,8 +1270,8 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
||||
)
|
||||
|
||||
def get_new_child_item(item_row):
|
||||
new_child_function = set_sales_order_defaults if parent_doctype == "Sales Order" else set_purchase_order_defaults
|
||||
return new_child_function(parent_doctype, parent_doctype_name, child_docname, item_row)
|
||||
child_doctype = "Sales Order Item" if parent_doctype == "Sales Order" else "Purchase Order Item"
|
||||
return set_order_defaults(parent_doctype, parent_doctype_name, child_doctype, child_docname, item_row)
|
||||
|
||||
def validate_quantity(child_item, d):
|
||||
if parent_doctype == "Sales Order" and flt(d.get("qty")) < flt(child_item.delivered_qty):
|
||||
@@ -1316,6 +1301,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
||||
prev_rate, new_rate = flt(child_item.get("rate")), flt(d.get("rate"))
|
||||
prev_qty, new_qty = flt(child_item.get("qty")), flt(d.get("qty"))
|
||||
prev_con_fac, new_con_fac = flt(child_item.get("conversion_factor")), flt(d.get("conversion_factor"))
|
||||
prev_uom, new_uom = child_item.get("uom"), d.get("uom")
|
||||
|
||||
if parent_doctype == 'Sales Order':
|
||||
prev_date, new_date = child_item.get("delivery_date"), d.get("delivery_date")
|
||||
@@ -1324,9 +1310,10 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
||||
|
||||
rate_unchanged = prev_rate == new_rate
|
||||
qty_unchanged = prev_qty == new_qty
|
||||
uom_unchanged = prev_uom == new_uom
|
||||
conversion_factor_unchanged = prev_con_fac == new_con_fac
|
||||
date_unchanged = prev_date == new_date if prev_date and new_date else False # in case of delivery note etc
|
||||
if rate_unchanged and qty_unchanged and conversion_factor_unchanged and date_unchanged:
|
||||
if rate_unchanged and qty_unchanged and conversion_factor_unchanged and uom_unchanged and date_unchanged:
|
||||
continue
|
||||
|
||||
validate_quantity(child_item, d)
|
||||
@@ -1347,6 +1334,11 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
||||
child_item.conversion_factor = 1
|
||||
else:
|
||||
child_item.conversion_factor = flt(d.get('conversion_factor'), conv_fac_precision)
|
||||
|
||||
if d.get("uom"):
|
||||
child_item.uom = d.get("uom")
|
||||
conversion_factor = flt(get_conversion_factor(child_item.item_code, child_item.uom).get("conversion_factor"))
|
||||
child_item.conversion_factor = flt(d.get('conversion_factor')) or conversion_factor
|
||||
|
||||
if d.get("delivery_date") and parent_doctype == 'Sales Order':
|
||||
child_item.delivery_date = d.get('delivery_date')
|
||||
@@ -1388,6 +1380,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
||||
parent.flags.ignore_validate_update_after_submit = True
|
||||
parent.set_qty_as_per_stock_uom()
|
||||
parent.calculate_taxes_and_totals()
|
||||
parent.set_total_in_words()
|
||||
if parent_doctype == "Sales Order":
|
||||
make_packing_list(parent)
|
||||
parent.set_gross_profit()
|
||||
@@ -1413,6 +1406,8 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
||||
parent.update_receiving_percentage()
|
||||
if parent.is_subcontracted == "Yes":
|
||||
parent.update_reserved_qty_for_subcontract()
|
||||
parent.create_raw_materials_supplied("supplied_items")
|
||||
parent.save()
|
||||
else:
|
||||
parent.update_reserved_qty()
|
||||
parent.update_project()
|
||||
|
||||
@@ -296,7 +296,7 @@ class BuyingController(StockController):
|
||||
raw_material_data = backflushed_raw_materials_map.get(rm_item_key, {})
|
||||
|
||||
consumed_qty = raw_material_data.get('qty', 0)
|
||||
consumed_serial_nos = raw_material_data.get('serial_nos', '')
|
||||
consumed_serial_nos = raw_material_data.get('serial_no', '')
|
||||
consumed_batch_nos = raw_material_data.get('batch_nos', '')
|
||||
|
||||
transferred_qty = raw_material.qty
|
||||
|
||||
@@ -279,6 +279,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
|
||||
target_doc.po_detail = source_doc.po_detail
|
||||
target_doc.pr_detail = source_doc.pr_detail
|
||||
target_doc.purchase_invoice_item = source_doc.name
|
||||
target_doc.price_list_rate = 0
|
||||
|
||||
elif doctype == "Delivery Note":
|
||||
target_doc.against_sales_order = source_doc.against_sales_order
|
||||
@@ -297,6 +298,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
|
||||
target_doc.dn_detail = source_doc.dn_detail
|
||||
target_doc.expense_account = source_doc.expense_account
|
||||
target_doc.sales_invoice_item = source_doc.name
|
||||
target_doc.price_list_rate = 0
|
||||
if default_warehouse_for_sales_return:
|
||||
target_doc.warehouse = default_warehouse_for_sales_return
|
||||
|
||||
|
||||
@@ -310,12 +310,27 @@ class SellingController(StockController):
|
||||
if flt(d.conversion_factor)==0.0:
|
||||
d.conversion_factor = get_conversion_factor(d.item_code, d.uom).get("conversion_factor") or 1.0
|
||||
return_rate = 0
|
||||
if cint(self.is_return) and self.return_against and self.docstatus==1:
|
||||
against_document_no = (d.get("sales_invoice_item")
|
||||
if self.doctype == "Sales Invoice" else d.get("delivery_note_item"))
|
||||
if cint(self.is_return) and self.docstatus==1:
|
||||
if self.return_against:
|
||||
against_document_no = (d.get("sales_invoice_item")
|
||||
if self.doctype == "Sales Invoice" else d.get("delivery_note_item"))
|
||||
|
||||
return_rate = self.get_incoming_rate_for_sales_return(d.item_code,
|
||||
self.return_against, against_document_no)
|
||||
return_rate = self.get_incoming_rate_for_sales_return(d.item_code,
|
||||
self.return_against, against_document_no)
|
||||
else:
|
||||
# For standalone credit note
|
||||
args = frappe._dict({
|
||||
"item_code": d.item_code,
|
||||
"warehouse": d.warehouse,
|
||||
"posting_date": self.posting_date,
|
||||
"posting_time": self.posting_time,
|
||||
"qty": flt(d.qty),
|
||||
"serial_no": d.serial_no,
|
||||
"company": d.company,
|
||||
"allow_zero_valuation": d.allow_zero_valuation
|
||||
})
|
||||
|
||||
return_rate = get_incoming_rate(args)
|
||||
|
||||
# On cancellation or if return entry submission, make stock ledger entry for
|
||||
# target warehouse first, to update serial no values properly
|
||||
|
||||
@@ -319,12 +319,13 @@ class StockController(AccountsController):
|
||||
return incoming_rate
|
||||
|
||||
def validate_warehouse(self):
|
||||
from erpnext.stock.utils import validate_warehouse_company
|
||||
from erpnext.stock.utils import validate_warehouse_company, validate_disabled_warehouse
|
||||
|
||||
warehouses = list(set([d.warehouse for d in
|
||||
self.get("items") if getattr(d, "warehouse", None)]))
|
||||
|
||||
for w in warehouses:
|
||||
validate_disabled_warehouse(w)
|
||||
validate_warehouse_company(w, self.company)
|
||||
|
||||
def update_billing_percentage(self, update_modified=True):
|
||||
|
||||
@@ -19,15 +19,50 @@ def set_defaut_value_for_filters(filters):
|
||||
if not filters.get('lead_age'): filters["lead_age"] = 60
|
||||
|
||||
def get_columns():
|
||||
return [
|
||||
_("Lead") + ":Link/Lead:100",
|
||||
_("Name") + "::100",
|
||||
_("Organization") + "::100",
|
||||
_("Reference Document") + "::150",
|
||||
_("Reference Name") + ":Dynamic Link/"+_("Reference Document")+":120",
|
||||
_("Last Communication") + ":Data:200",
|
||||
_("Last Communication Date") + ":Date:180"
|
||||
]
|
||||
columns = [{
|
||||
"label": _("Lead"),
|
||||
"fieldname": "lead",
|
||||
"fieldtype": "Link",
|
||||
"options": "Lead",
|
||||
"width": 130
|
||||
},
|
||||
{
|
||||
"label": _("Name"),
|
||||
"fieldname": "name",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Organization"),
|
||||
"fieldname": "organization",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Reference Document Type"),
|
||||
"fieldname": "reference_document_type",
|
||||
"fieldtype": "Link",
|
||||
"options": "Doctype",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Reference Name"),
|
||||
"fieldname": "reference_name",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "reference_document_type",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"label": _("Last Communication"),
|
||||
"fieldname": "last_communication",
|
||||
"fieldtype": "Data",
|
||||
"width": 200
|
||||
},
|
||||
{
|
||||
"label": _("Last Communication Date"),
|
||||
"fieldname": "last_communication_date",
|
||||
"fieldtype": "Date",
|
||||
"width": 100
|
||||
}]
|
||||
return columns
|
||||
|
||||
def get_data(filters):
|
||||
lead_details = []
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "question",
|
||||
"fieldtype": "Small Text",
|
||||
"fieldtype": "Text Editor",
|
||||
"in_list_view": 1,
|
||||
"label": "Question",
|
||||
"reqd": 1
|
||||
@@ -34,7 +34,7 @@
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"modified": "2019-05-30 18:39:21.880974",
|
||||
"modified": "2021-01-28 18:39:21.880974",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Question",
|
||||
@@ -77,4 +77,4 @@
|
||||
"quick_entry": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class PlaidConnector():
|
||||
client_id=self.settings.plaid_client_id,
|
||||
secret=self.settings.get_password("plaid_secret"),
|
||||
environment=self.settings.plaid_env,
|
||||
api_version="2019-05-29"
|
||||
api_version="2020-09-14"
|
||||
)
|
||||
|
||||
def get_access_token(self, public_token):
|
||||
@@ -29,13 +29,14 @@ class PlaidConnector():
|
||||
response = self.client.Item.public_token.exchange(public_token)
|
||||
access_token = response["access_token"]
|
||||
return access_token
|
||||
|
||||
|
||||
def get_token_request(self, update_mode=False):
|
||||
country_codes = ["US", "CA", "FR", "IE", "NL", "ES", "GB"] if self.settings.enable_european_access else ["US", "CA"]
|
||||
args = {
|
||||
"client_name": self.client_name,
|
||||
# only allow Plaid-supported languages and countries (LAST: Sep-19-2020)
|
||||
"language": frappe.local.lang if frappe.local.lang in ["en", "fr", "es", "nl"] else "en",
|
||||
"country_codes": ["US", "CA", "ES", "FR", "GB", "IE", "NL"],
|
||||
"country_codes": country_codes,
|
||||
"user": {
|
||||
"client_user_id": frappe.generate_hash(frappe.session.user, length=32)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2018-10-25 10:02:48.656165",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
@@ -11,7 +12,8 @@
|
||||
"plaid_client_id",
|
||||
"plaid_secret",
|
||||
"column_break_7",
|
||||
"plaid_env"
|
||||
"plaid_env",
|
||||
"enable_european_access"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -58,10 +60,17 @@
|
||||
{
|
||||
"fieldname": "column_break_7",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "enable_european_access",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enable European Access"
|
||||
}
|
||||
],
|
||||
"issingle": 1,
|
||||
"modified": "2020-09-12 02:31:44.542385",
|
||||
"links": [],
|
||||
"modified": "2020-10-29 20:24:56.916104",
|
||||
"modified_by": "Administrator",
|
||||
"module": "ERPNext Integrations",
|
||||
"name": "Plaid Settings",
|
||||
|
||||
@@ -308,7 +308,7 @@ var calculate_age = function(birth) {
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
||||
// List Stock items
|
||||
|
||||
@@ -293,5 +293,5 @@ var calculate_age = function(birth) {
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ frappe.ui.form.on('Patient', {
|
||||
$(frm.fields_dict['age_html'].wrapper).html("");
|
||||
}
|
||||
if(frm.doc.dob){
|
||||
$(frm.fields_dict['age_html'].wrapper).html("AGE : " + get_age(frm.doc.dob));
|
||||
$(frm.fields_dict['age_html'].wrapper).html(`${__('AGE')} : ${get_age(frm.doc.dob)}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -58,7 +58,7 @@ frappe.ui.form.on("Patient", "dob", function(frm) {
|
||||
}
|
||||
else{
|
||||
var age_str = get_age(frm.doc.dob);
|
||||
$(frm.fields_dict['age_html'].wrapper).html("AGE : " + age_str);
|
||||
$(frm.fields_dict['age_html'].wrapper).html(`${__('AGE')} : ${age_str}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -81,7 +81,7 @@ var get_age = function (birth) {
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
||||
var btn_create_vital_signs = function (frm) {
|
||||
|
||||
@@ -58,7 +58,7 @@ class Patient(Document):
|
||||
if self.dob:
|
||||
born = getdate(self.dob)
|
||||
age = dateutil.relativedelta.relativedelta(getdate(), born)
|
||||
age_str = str(age.years) + " year(s) " + str(age.months) + " month(s) " + str(age.days) + " day(s)"
|
||||
age_str = str(age.years) + ' ' + _("Years(s)") + ' ' + str(age.months) + ' ' + _("Month(s)") + ' ' + str(age.days) + ' ' + _("Day(s)")
|
||||
return age_str
|
||||
|
||||
def invoice_patient_registration(self):
|
||||
|
||||
@@ -468,5 +468,5 @@ var calculate_age = function(birth) {
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
||||
@@ -311,5 +311,5 @@ var calculate_age = function(birth) {
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
||||
@@ -36,5 +36,5 @@ var calculate_age = function(birth) {
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
|
||||
};
|
||||
|
||||
@@ -245,7 +245,8 @@ doc_events = {
|
||||
"Sales Invoice": {
|
||||
"on_submit": ["erpnext.regional.create_transaction_log", "erpnext.regional.italy.utils.sales_invoice_on_submit"],
|
||||
"on_cancel": "erpnext.regional.italy.utils.sales_invoice_on_cancel",
|
||||
"on_trash": "erpnext.regional.check_deletion_permission"
|
||||
"on_trash": "erpnext.regional.check_deletion_permission",
|
||||
"validate": "erpnext.regional.india.utils.set_transporter_address"
|
||||
},
|
||||
"Purchase Invoice": {
|
||||
"validate": "erpnext.regional.india.utils.update_grand_total_for_rcm"
|
||||
|
||||
@@ -782,7 +782,7 @@
|
||||
"icon": "fa fa-user",
|
||||
"idx": 24,
|
||||
"image_field": "image",
|
||||
"modified": "2020-01-09 04:23:55.611366",
|
||||
"modified": "2020-01-09 05:23:55.611366",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Employee",
|
||||
@@ -824,7 +824,6 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"search_fields": "employee_name",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import date_diff, getdate, formatdate, cint, month_diff, flt
|
||||
from frappe.utils import date_diff, getdate, formatdate, cint, month_diff, flt, add_months
|
||||
from frappe.model.document import Document
|
||||
from erpnext.hr.utils import get_holidays_for_employee
|
||||
|
||||
@@ -88,6 +88,8 @@ def get_period_factor(employee, start_date, end_date, payroll_frequency, payroll
|
||||
period_start = joining_date
|
||||
if relieving_date and getdate(relieving_date) < getdate(period_end):
|
||||
period_end = relieving_date
|
||||
if month_diff(period_end, start_date) > 1:
|
||||
start_date = add_months(start_date, - (month_diff(period_end, start_date)+1))
|
||||
|
||||
total_sub_periods, remaining_sub_periods = 0.0, 0.0
|
||||
|
||||
|
||||
@@ -299,14 +299,17 @@ class SalarySlip(TransactionBase):
|
||||
def calculate_net_pay(self):
|
||||
if self.salary_structure:
|
||||
self.calculate_component_amounts("earnings")
|
||||
self.gross_pay = self.get_component_totals("earnings")
|
||||
self.gross_pay = self.get_component_totals("earnings", depends_on_payment_days=1)
|
||||
|
||||
if self.salary_structure:
|
||||
self.calculate_component_amounts("deductions")
|
||||
self.total_deduction = self.get_component_totals("deductions")
|
||||
|
||||
|
||||
self.set_loan_repayment()
|
||||
|
||||
self.set_component_amounts_based_on_payment_days()
|
||||
self.set_net_pay()
|
||||
|
||||
def set_net_pay(self):
|
||||
self.total_deduction = self.get_component_totals("deductions")
|
||||
self.net_pay = flt(self.gross_pay) - (flt(self.total_deduction) + flt(self.total_loan_repayment))
|
||||
self.rounded_total = rounded(self.net_pay)
|
||||
|
||||
@@ -323,8 +326,6 @@ class SalarySlip(TransactionBase):
|
||||
else:
|
||||
self.add_tax_components(payroll_period)
|
||||
|
||||
self.set_component_amounts_based_on_payment_days(component_type)
|
||||
|
||||
def add_structure_components(self, component_type):
|
||||
data = self.get_data_for_eval()
|
||||
for struct_row in self._salary_structure_doc.get(component_type):
|
||||
@@ -679,7 +680,7 @@ class SalarySlip(TransactionBase):
|
||||
cint(row.depends_on_payment_days) and cint(self.total_working_days) and
|
||||
(not self.salary_slip_based_on_timesheet or
|
||||
getdate(self.start_date) < joining_date or
|
||||
getdate(self.end_date) > relieving_date
|
||||
(relieving_date and getdate(self.end_date) > relieving_date)
|
||||
)):
|
||||
additional_amount = flt((flt(row.additional_amount) * flt(self.payment_days)
|
||||
/ cint(self.total_working_days)), row.precision("additional_amount"))
|
||||
@@ -812,15 +813,21 @@ class SalarySlip(TransactionBase):
|
||||
struct_row['variable_based_on_taxable_salary'] = component.variable_based_on_taxable_salary
|
||||
return struct_row
|
||||
|
||||
def get_component_totals(self, component_type):
|
||||
def get_component_totals(self, component_type, depends_on_payment_days=0):
|
||||
joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee,
|
||||
["date_of_joining", "relieving_date"])
|
||||
|
||||
total = 0.0
|
||||
for d in self.get(component_type):
|
||||
if not d.do_not_include_in_total:
|
||||
d.amount = flt(d.amount, d.precision("amount"))
|
||||
total += d.amount
|
||||
if depends_on_payment_days:
|
||||
amount = self.get_amount_based_on_payment_days(d, joining_date, relieving_date)[0]
|
||||
else:
|
||||
amount = flt(d.amount, d.precision("amount"))
|
||||
total += amount
|
||||
return total
|
||||
|
||||
def set_component_amounts_based_on_payment_days(self, component_type):
|
||||
def set_component_amounts_based_on_payment_days(self):
|
||||
joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee,
|
||||
["date_of_joining", "relieving_date"])
|
||||
|
||||
@@ -830,8 +837,9 @@ class SalarySlip(TransactionBase):
|
||||
if not joining_date:
|
||||
frappe.throw(_("Please set the Date Of Joining for employee {0}").format(frappe.bold(self.employee_name)))
|
||||
|
||||
for d in self.get(component_type):
|
||||
d.amount = self.get_amount_based_on_payment_days(d, joining_date, relieving_date)[0]
|
||||
for component_type in ("earnings", "deductions"):
|
||||
for d in self.get(component_type):
|
||||
d.amount = flt(self.get_amount_based_on_payment_days(d, joining_date, relieving_date)[0], d.precision("amount"))
|
||||
|
||||
def set_loan_repayment(self):
|
||||
self.set('loans', [])
|
||||
|
||||
@@ -253,7 +253,7 @@ cur_frm.cscript.hour_rate = function(doc) {
|
||||
|
||||
cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate;
|
||||
|
||||
cur_frm.cscript.bom_no = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.bom_no = function(doc, cdt, cdn) {
|
||||
get_bom_material_detail(doc, cdt, cdn, false);
|
||||
};
|
||||
|
||||
@@ -261,17 +261,22 @@ cur_frm.cscript.is_default = function(doc) {
|
||||
if (doc.is_default) cur_frm.set_value("is_active", 1);
|
||||
};
|
||||
|
||||
var get_bom_material_detail= function(doc, cdt, cdn, scrap_items) {
|
||||
var get_bom_material_detail = function(doc, cdt, cdn, scrap_items) {
|
||||
if (!doc.company) {
|
||||
frappe.throw({message: __("Please select a Company first."), title: __("Mandatory")});
|
||||
}
|
||||
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
return frappe.call({
|
||||
doc: doc,
|
||||
method: "get_bom_material_detail",
|
||||
args: {
|
||||
'item_code': d.item_code,
|
||||
'bom_no': d.bom_no != null ? d.bom_no: '',
|
||||
"company": doc.company,
|
||||
"item_code": d.item_code,
|
||||
"bom_no": d.bom_no != null ? d.bom_no: '',
|
||||
"scrap_items": scrap_items,
|
||||
'qty': d.qty,
|
||||
"qty": d.qty,
|
||||
"stock_qty": d.stock_qty,
|
||||
"include_item_in_manufacturing": d.include_item_in_manufacturing,
|
||||
"uom": d.uom,
|
||||
@@ -309,7 +314,7 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
if (d.bom_no) {
|
||||
frappe.msgprint(__("You can not change rate if BOM mentioned agianst any item"));
|
||||
frappe.msgprint(__("You cannot change the rate if BOM is mentioned against any Item."));
|
||||
get_bom_material_detail(doc, cdt, cdn, scrap_items);
|
||||
} else {
|
||||
erpnext.bom.calculate_rm_cost(doc);
|
||||
|
||||
@@ -51,6 +51,10 @@ class BOM(WebsiteGenerator):
|
||||
|
||||
def validate(self):
|
||||
self.route = frappe.scrub(self.name).replace('_', '-')
|
||||
|
||||
if not self.company:
|
||||
frappe.throw(_("Please select a Company first."), title=_("Mandatory"))
|
||||
|
||||
self.clear_operations()
|
||||
self.validate_main_item()
|
||||
self.validate_currency()
|
||||
@@ -122,6 +126,7 @@ class BOM(WebsiteGenerator):
|
||||
self.validate_bom_currecny(item)
|
||||
|
||||
ret = self.get_bom_material_detail({
|
||||
"company": self.company,
|
||||
"item_code": item.item_code,
|
||||
"item_name": item.item_name,
|
||||
"bom_no": item.bom_no,
|
||||
@@ -236,6 +241,7 @@ class BOM(WebsiteGenerator):
|
||||
|
||||
for d in self.get("items"):
|
||||
rate = self.get_rm_rate({
|
||||
"company": self.company,
|
||||
"item_code": d.item_code,
|
||||
"bom_no": d.bom_no,
|
||||
"qty": d.qty,
|
||||
@@ -288,10 +294,20 @@ class BOM(WebsiteGenerator):
|
||||
""" Get weighted average of valuation rate from all warehouses """
|
||||
|
||||
total_qty, total_value, valuation_rate = 0.0, 0.0, 0.0
|
||||
for d in frappe.db.sql("""select actual_qty, stock_value from `tabBin`
|
||||
where item_code=%s""", args['item_code'], as_dict=1):
|
||||
total_qty += flt(d.actual_qty)
|
||||
total_value += flt(d.stock_value)
|
||||
item_bins = frappe.db.sql("""
|
||||
select
|
||||
bin.actual_qty, bin.stock_value
|
||||
from
|
||||
`tabBin` bin, `tabWarehouse` warehouse
|
||||
where
|
||||
bin.item_code=%(item)s
|
||||
and bin.warehouse = warehouse.name
|
||||
and warehouse.company=%(company)s""",
|
||||
{"item": args['item_code'], "company": args['company']}, as_dict=1)
|
||||
|
||||
for d in item_bins:
|
||||
total_qty += flt(d.actual_qty)
|
||||
total_value += flt(d.stock_value)
|
||||
|
||||
if total_qty:
|
||||
valuation_rate = total_value / total_qty
|
||||
|
||||
@@ -526,7 +526,6 @@ class TestWorkOrder(unittest.TestCase):
|
||||
ste1.submit()
|
||||
ste_cancel_list.append(ste1)
|
||||
|
||||
print(wo_order.name)
|
||||
ste3 = frappe.get_doc(make_stock_entry(wo_order.name, "Material Consumption for Manufacture", 2))
|
||||
self.assertEquals(ste3.fg_completed_qty, 2)
|
||||
|
||||
@@ -539,6 +538,48 @@ class TestWorkOrder(unittest.TestCase):
|
||||
|
||||
frappe.db.set_value("Manufacturing Settings", None, "material_consumption", 0)
|
||||
|
||||
def test_extra_material_transfer(self):
|
||||
frappe.db.set_value("Manufacturing Settings", None, "material_consumption", 0)
|
||||
frappe.db.set_value("Manufacturing Settings", None, "backflush_raw_materials_based_on",
|
||||
"Material Transferred for Manufacture")
|
||||
|
||||
wo_order = make_wo_order_test_record(planned_start_date=now(), qty=4)
|
||||
|
||||
ste_cancel_list = []
|
||||
ste1 = test_stock_entry.make_stock_entry(item_code="_Test Item",
|
||||
target="_Test Warehouse - _TC", qty=20, basic_rate=5000.0)
|
||||
ste2 = test_stock_entry.make_stock_entry(item_code="_Test Item Home Desktop 100",
|
||||
target="_Test Warehouse - _TC", qty=20, basic_rate=1000.0)
|
||||
|
||||
ste_cancel_list.extend([ste1, ste2])
|
||||
|
||||
itemwise_qty = {}
|
||||
s = frappe.get_doc(make_stock_entry(wo_order.name, "Material Transfer for Manufacture", 4))
|
||||
for row in s.items:
|
||||
row.qty = row.qty + 2
|
||||
itemwise_qty.setdefault(row.item_code, row.qty)
|
||||
|
||||
s.submit()
|
||||
ste_cancel_list.append(s)
|
||||
|
||||
ste3 = frappe.get_doc(make_stock_entry(wo_order.name, "Manufacture", 2))
|
||||
for ste_row in ste3.items:
|
||||
if itemwise_qty.get(ste_row.item_code) and ste_row.s_warehouse:
|
||||
self.assertEquals(ste_row.qty, itemwise_qty.get(ste_row.item_code) / 2)
|
||||
|
||||
ste3.submit()
|
||||
ste_cancel_list.append(ste3)
|
||||
|
||||
ste2 = frappe.get_doc(make_stock_entry(wo_order.name, "Manufacture", 2))
|
||||
for ste_row in ste2.items:
|
||||
if itemwise_qty.get(ste_row.item_code) and ste_row.s_warehouse:
|
||||
self.assertEquals(ste_row.qty, itemwise_qty.get(ste_row.item_code) / 2)
|
||||
|
||||
for ste_doc in ste_cancel_list:
|
||||
ste_doc.cancel()
|
||||
|
||||
frappe.db.set_value("Manufacturing Settings", None, "backflush_raw_materials_based_on", "BOM")
|
||||
|
||||
def get_scrap_item_details(bom_no):
|
||||
scrap_items = {}
|
||||
for item in frappe.db.sql("""select item_code, stock_qty from `tabBOM Scrap Item`
|
||||
|
||||
@@ -20,6 +20,7 @@ def get_columns():
|
||||
_("Item") + ":Link/Item:150",
|
||||
_("Description") + "::300",
|
||||
_("BOM Qty") + ":Float:160",
|
||||
_("BOM UoM") + "::160",
|
||||
_("Required Qty") + ":Float:120",
|
||||
_("In Stock Qty") + ":Float:120",
|
||||
_("Enough Parts to Build") + ":Float:200",
|
||||
@@ -32,7 +33,7 @@ def get_bom_stock(filters):
|
||||
bom = filters.get("bom")
|
||||
|
||||
table = "`tabBOM Item`"
|
||||
qty_field = "qty"
|
||||
qty_field = "stock_qty"
|
||||
|
||||
qty_to_produce = filters.get("qty_to_produce", 1)
|
||||
if int(qty_to_produce) <= 0:
|
||||
@@ -40,7 +41,6 @@ def get_bom_stock(filters):
|
||||
|
||||
if filters.get("show_exploded_view"):
|
||||
table = "`tabBOM Explosion Item`"
|
||||
qty_field = "stock_qty"
|
||||
|
||||
if filters.get("warehouse"):
|
||||
warehouse_details = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
|
||||
@@ -59,6 +59,7 @@ def get_bom_stock(filters):
|
||||
bom_item.item_code,
|
||||
bom_item.description ,
|
||||
bom_item.{qty_field},
|
||||
bom_item.stock_uom,
|
||||
bom_item.{qty_field} * {qty_to_produce} / bom.quantity,
|
||||
sum(ledger.actual_qty) as actual_qty,
|
||||
sum(FLOOR(ledger.actual_qty / (bom_item.{qty_field} * {qty_to_produce} / bom.quantity)))
|
||||
|
||||
@@ -678,4 +678,6 @@ erpnext.patches.v12_0.update_state_code_for_daman_and_diu
|
||||
erpnext.patches.v12_0.rename_lost_reason_detail
|
||||
erpnext.patches.v12_0.update_leave_application_status
|
||||
erpnext.patches.v12_0.update_payment_entry_status
|
||||
erpnext.patches.v12_0.add_transporter_address_field #2020-10-27
|
||||
erpnext.patches.v12_0.setup_einvoice_fields #2020-12-02
|
||||
erpnext.patches.v12_0.add_state_code_for_ladakh
|
||||
|
||||
16
erpnext/patches/v12_0/add_state_code_for_ladakh.py
Normal file
16
erpnext/patches/v12_0/add_state_code_for_ladakh.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import frappe
|
||||
from erpnext.regional.india import states
|
||||
|
||||
def execute():
|
||||
|
||||
company = frappe.get_all('Company', filters = {'country': 'India'})
|
||||
if not company:
|
||||
return
|
||||
|
||||
custom_fields = ['Address-gst_state', 'Tax Category-gst_state']
|
||||
|
||||
# Update options in gst_state custom fields
|
||||
for field in custom_fields:
|
||||
gst_state_field = frappe.get_doc('Custom Field', field)
|
||||
gst_state_field.options = '\n'.join(states)
|
||||
gst_state_field.save()
|
||||
150
erpnext/patches/v12_0/add_transporter_address_field.py
Normal file
150
erpnext/patches/v12_0/add_transporter_address_field.py
Normal file
@@ -0,0 +1,150 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
|
||||
def execute():
|
||||
company = frappe.get_all('Company', filters = {'country': 'India'})
|
||||
if not company:
|
||||
return
|
||||
|
||||
fields = [
|
||||
{
|
||||
'fieldname': 'transporter_info',
|
||||
'label': 'Transporter Info',
|
||||
'fieldtype': 'Section Break',
|
||||
'insert_after': 'terms',
|
||||
'collapsible': 1,
|
||||
'collapsible_depends_on': 'transporter',
|
||||
'print_hide': 1
|
||||
},
|
||||
{
|
||||
'fieldname': 'transporter',
|
||||
'label': 'Transporter',
|
||||
'fieldtype': 'Link',
|
||||
'insert_after': 'transporter_info',
|
||||
'options': 'Supplier',
|
||||
'print_hide': 1
|
||||
},
|
||||
{
|
||||
'fieldname': 'transporter_name',
|
||||
'label': 'Transporter Name',
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'transporter',
|
||||
'fetch_from': 'transporter.name',
|
||||
'read_only': 1,
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'gst_transporter_id',
|
||||
'label': 'GST Transporter ID',
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'transporter_name',
|
||||
'fetch_from': 'transporter.gst_transporter_id',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'driver',
|
||||
'label': 'Driver',
|
||||
'fieldtype': 'Link',
|
||||
'insert_after': 'gst_transporter_id',
|
||||
'options': 'Driver',
|
||||
'print_hide': 1
|
||||
},
|
||||
{
|
||||
'fieldname': 'lr_no',
|
||||
'label': 'Transport Receipt No',
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'driver',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'vehicle_no',
|
||||
'label': 'Vehicle No',
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'lr_no',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'distance',
|
||||
'label': 'Distance (in km)',
|
||||
'fieldtype': 'Float',
|
||||
'insert_after': 'vehicle_no',
|
||||
'print_hide': 1
|
||||
},
|
||||
{
|
||||
'fieldname': 'transporter_col_break',
|
||||
'fieldtype': 'Column Break',
|
||||
'insert_after': 'distance'
|
||||
},
|
||||
{
|
||||
'fieldname': 'transporter_address',
|
||||
'label': 'Transporter Address Name',
|
||||
'fieldtype': 'Link',
|
||||
'insert_after': 'transporter_col_break',
|
||||
'options': 'Address',
|
||||
'print_hide': 1
|
||||
},
|
||||
{
|
||||
'fieldname': 'transporter_address_display',
|
||||
'label': 'Transporter Address Preview',
|
||||
'fieldtype': 'Small Text',
|
||||
'insert_after': 'transporter_address',
|
||||
'read_only': 1,
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'mode_of_transport',
|
||||
'label': 'Mode of Transport',
|
||||
'fieldtype': 'Select',
|
||||
'options': '\nRoad\nAir\nRail\nShip',
|
||||
'default': 'Road',
|
||||
'insert_after': 'transporter_address_display',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'driver_name',
|
||||
'label': 'Driver Name',
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'mode_of_transport',
|
||||
'fetch_from': 'driver.full_name',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'lr_date',
|
||||
'label': 'Transport Receipt Date',
|
||||
'fieldtype': 'Date',
|
||||
'insert_after': 'driver_name',
|
||||
'default': 'Today',
|
||||
'print_hide': 1
|
||||
},
|
||||
{
|
||||
'fieldname': 'gst_vehicle_type',
|
||||
'label': 'GST Vehicle Type',
|
||||
'fieldtype': 'Select',
|
||||
'options': 'Regular\nOver Dimensional Cargo (ODC)',
|
||||
'depends_on': 'eval:(doc.mode_of_transport === "Road")',
|
||||
'default': 'Regular',
|
||||
'insert_after': 'lr_date',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'ewaybill',
|
||||
'label': 'e-Way Bill No.',
|
||||
'fieldtype': 'Data',
|
||||
'depends_on': 'eval:(doc.docstatus === 1)',
|
||||
'allow_on_submit': 1,
|
||||
'insert_after': 'tax_id',
|
||||
'translatable': 0
|
||||
}
|
||||
]
|
||||
|
||||
create_custom_fields({ 'Sales Invoice': fields }, update=True)
|
||||
frappe.reload_doctype('Sales Invoice')
|
||||
792
erpnext/projects/doctype/task/task.json
Normal file → Executable file
792
erpnext/projects/doctype/task/task.json
Normal file → Executable file
@@ -1,398 +1,398 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"autoname": "TASK-.YYYY.-.#####",
|
||||
"creation": "2013-01-29 19:25:50",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"subject",
|
||||
"project",
|
||||
"issue",
|
||||
"type",
|
||||
"is_group",
|
||||
"column_break0",
|
||||
"status",
|
||||
"priority",
|
||||
"task_weight",
|
||||
"completed_by",
|
||||
"color",
|
||||
"parent_task",
|
||||
"sb_timeline",
|
||||
"exp_start_date",
|
||||
"expected_time",
|
||||
"column_break_11",
|
||||
"exp_end_date",
|
||||
"progress",
|
||||
"is_milestone",
|
||||
"sb_details",
|
||||
"description",
|
||||
"sb_depends_on",
|
||||
"depends_on",
|
||||
"depends_on_tasks",
|
||||
"sb_actual",
|
||||
"act_start_date",
|
||||
"actual_time",
|
||||
"column_break_15",
|
||||
"act_end_date",
|
||||
"sb_costing",
|
||||
"total_costing_amount",
|
||||
"total_expense_claim",
|
||||
"column_break_20",
|
||||
"total_billing_amount",
|
||||
"sb_more_info",
|
||||
"review_date",
|
||||
"closing_date",
|
||||
"column_break_22",
|
||||
"department",
|
||||
"company",
|
||||
"lft",
|
||||
"rgt",
|
||||
"old_parent"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "subject",
|
||||
"fieldtype": "Data",
|
||||
"in_global_search": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Subject",
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "project",
|
||||
"fieldtype": "Link",
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Project",
|
||||
"oldfieldname": "project",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Project",
|
||||
"remember_last_selected_value": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "issue",
|
||||
"fieldtype": "Link",
|
||||
"label": "Issue",
|
||||
"options": "Issue"
|
||||
},
|
||||
{
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Link",
|
||||
"label": "Type",
|
||||
"options": "Task Type"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"default": "0",
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Is Group"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Status",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "status",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Open\nWorking\nPending Review\nOverdue\nCompleted\nCancelled"
|
||||
},
|
||||
{
|
||||
"fieldname": "priority",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Priority",
|
||||
"oldfieldname": "priority",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Low\nMedium\nHigh\nUrgent",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "color",
|
||||
"fieldtype": "Color",
|
||||
"label": "Color"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "parent_task",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Parent Task",
|
||||
"options": "Task",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"collapsible_depends_on": "eval:doc.__islocal",
|
||||
"fieldname": "sb_timeline",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Timeline"
|
||||
},
|
||||
{
|
||||
"fieldname": "exp_start_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Expected Start Date",
|
||||
"oldfieldname": "exp_start_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "expected_time",
|
||||
"fieldtype": "Float",
|
||||
"label": "Expected Time (in hours)",
|
||||
"oldfieldname": "exp_total_hrs",
|
||||
"oldfieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fetch_from": "type.weight",
|
||||
"fieldname": "task_weight",
|
||||
"fieldtype": "Float",
|
||||
"label": "Weight"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "exp_end_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Expected End Date",
|
||||
"oldfieldname": "exp_end_date",
|
||||
"oldfieldtype": "Date",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "progress",
|
||||
"fieldtype": "Percent",
|
||||
"label": "% Progress",
|
||||
"no_copy": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "is_milestone",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Is Milestone"
|
||||
},
|
||||
{
|
||||
"fieldname": "sb_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Details",
|
||||
"oldfieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"in_preview": 1,
|
||||
"label": "Task Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text Editor",
|
||||
"print_width": "300px",
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"fieldname": "sb_depends_on",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Dependencies",
|
||||
"oldfieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "depends_on",
|
||||
"fieldtype": "Table",
|
||||
"label": "Dependent Tasks",
|
||||
"options": "Task Depends On"
|
||||
},
|
||||
{
|
||||
"fieldname": "depends_on_tasks",
|
||||
"fieldtype": "Code",
|
||||
"hidden": 1,
|
||||
"label": "Depends on Tasks",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "sb_actual",
|
||||
"fieldtype": "Section Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"fieldname": "act_start_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Actual Start Date (via Time Sheet)",
|
||||
"oldfieldname": "act_start_date",
|
||||
"oldfieldtype": "Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "actual_time",
|
||||
"fieldtype": "Float",
|
||||
"label": "Actual Time (in hours)",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_15",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "act_end_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Actual End Date (via Time Sheet)",
|
||||
"oldfieldname": "act_end_date",
|
||||
"oldfieldtype": "Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "sb_costing",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Costing"
|
||||
},
|
||||
{
|
||||
"fieldname": "total_costing_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Costing Amount (via Time Sheet)",
|
||||
"oldfieldname": "actual_budget",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "total_expense_claim",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Expense Claim (via Expense Claim)",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_20",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "total_billing_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Billing Amount (via Time Sheet)",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "sb_more_info",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "More Info"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.status == \"Closed\" || doc.status == \"Pending Review\"",
|
||||
"fieldname": "review_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Review Date",
|
||||
"oldfieldname": "review_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.status == \"Closed\"",
|
||||
"fieldname": "closing_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Closing Date",
|
||||
"oldfieldname": "closing_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_22",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "department",
|
||||
"fieldtype": "Link",
|
||||
"label": "Department",
|
||||
"options": "Department"
|
||||
},
|
||||
{
|
||||
"fetch_from": "project.company",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"remember_last_selected_value": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "lft",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "rgt",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Old Parent",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "completed_by",
|
||||
"fieldtype": "Link",
|
||||
"label": "Completed By",
|
||||
"no_copy": 1,
|
||||
"options": "User"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-check",
|
||||
"idx": 1,
|
||||
"is_tree": 1,
|
||||
"links": [],
|
||||
"max_attachments": 5,
|
||||
"modified": "2020-07-03 12:36:04.960457",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Task",
|
||||
"nsm_parent_field": "parent_task",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Projects User",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"search_fields": "subject",
|
||||
"show_name_in_global_search": 1,
|
||||
"show_preview_popup": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"timeline_field": "project",
|
||||
"title_field": "subject",
|
||||
"track_seen": 1
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"autoname": "TASK-.YYYY.-.#####",
|
||||
"creation": "2013-01-29 19:25:50",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"subject",
|
||||
"project",
|
||||
"issue",
|
||||
"type",
|
||||
"is_group",
|
||||
"column_break0",
|
||||
"status",
|
||||
"priority",
|
||||
"task_weight",
|
||||
"completed_by",
|
||||
"color",
|
||||
"parent_task",
|
||||
"sb_timeline",
|
||||
"exp_start_date",
|
||||
"expected_time",
|
||||
"column_break_11",
|
||||
"exp_end_date",
|
||||
"progress",
|
||||
"is_milestone",
|
||||
"sb_details",
|
||||
"description",
|
||||
"sb_depends_on",
|
||||
"depends_on",
|
||||
"depends_on_tasks",
|
||||
"sb_actual",
|
||||
"act_start_date",
|
||||
"actual_time",
|
||||
"column_break_15",
|
||||
"act_end_date",
|
||||
"sb_costing",
|
||||
"total_costing_amount",
|
||||
"total_expense_claim",
|
||||
"column_break_20",
|
||||
"total_billing_amount",
|
||||
"sb_more_info",
|
||||
"review_date",
|
||||
"closing_date",
|
||||
"column_break_22",
|
||||
"department",
|
||||
"company",
|
||||
"lft",
|
||||
"rgt",
|
||||
"old_parent"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "subject",
|
||||
"fieldtype": "Data",
|
||||
"in_global_search": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Subject",
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "project",
|
||||
"fieldtype": "Link",
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Project",
|
||||
"oldfieldname": "project",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Project",
|
||||
"remember_last_selected_value": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "issue",
|
||||
"fieldtype": "Link",
|
||||
"label": "Issue",
|
||||
"options": "Issue"
|
||||
},
|
||||
{
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Link",
|
||||
"label": "Type",
|
||||
"options": "Task Type"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"default": "0",
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Is Group"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Status",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "status",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Open\nWorking\nPending Review\nOverdue\nCompleted\nCancelled"
|
||||
},
|
||||
{
|
||||
"fieldname": "priority",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Priority",
|
||||
"oldfieldname": "priority",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Low\nMedium\nHigh\nUrgent",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "color",
|
||||
"fieldtype": "Color",
|
||||
"label": "Color"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "parent_task",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Parent Task",
|
||||
"options": "Task",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"collapsible_depends_on": "eval:doc.__islocal",
|
||||
"fieldname": "sb_timeline",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Timeline"
|
||||
},
|
||||
{
|
||||
"fieldname": "exp_start_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Expected Start Date",
|
||||
"oldfieldname": "exp_start_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "expected_time",
|
||||
"fieldtype": "Float",
|
||||
"label": "Expected Time (in hours)",
|
||||
"oldfieldname": "exp_total_hrs",
|
||||
"oldfieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fetch_from": "type.weight",
|
||||
"fieldname": "task_weight",
|
||||
"fieldtype": "Float",
|
||||
"label": "Weight"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "exp_end_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Expected End Date",
|
||||
"oldfieldname": "exp_end_date",
|
||||
"oldfieldtype": "Date",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "progress",
|
||||
"fieldtype": "Percent",
|
||||
"label": "% Progress",
|
||||
"no_copy": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "is_milestone",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Is Milestone"
|
||||
},
|
||||
{
|
||||
"fieldname": "sb_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Details",
|
||||
"oldfieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"in_preview": 1,
|
||||
"label": "Task Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text Editor",
|
||||
"print_width": "300px",
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"fieldname": "sb_depends_on",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Dependencies",
|
||||
"oldfieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "depends_on",
|
||||
"fieldtype": "Table",
|
||||
"label": "Dependent Tasks",
|
||||
"options": "Task Depends On"
|
||||
},
|
||||
{
|
||||
"fieldname": "depends_on_tasks",
|
||||
"fieldtype": "Code",
|
||||
"hidden": 1,
|
||||
"label": "Depends on Tasks",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "sb_actual",
|
||||
"fieldtype": "Section Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"fieldname": "act_start_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Actual Start Date (via Time Sheet)",
|
||||
"oldfieldname": "act_start_date",
|
||||
"oldfieldtype": "Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "actual_time",
|
||||
"fieldtype": "Float",
|
||||
"label": "Actual Time (in hours)",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_15",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "act_end_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Actual End Date (via Time Sheet)",
|
||||
"oldfieldname": "act_end_date",
|
||||
"oldfieldtype": "Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "sb_costing",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Costing"
|
||||
},
|
||||
{
|
||||
"fieldname": "total_costing_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Costing Amount (via Time Sheet)",
|
||||
"oldfieldname": "actual_budget",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "total_expense_claim",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Expense Claim (via Expense Claim)",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_20",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "total_billing_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Billing Amount (via Time Sheet)",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "sb_more_info",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "More Info"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.status == \"Closed\" || doc.status == \"Pending Review\"",
|
||||
"fieldname": "review_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Review Date",
|
||||
"oldfieldname": "review_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.status == \"Closed\"",
|
||||
"fieldname": "closing_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Closing Date",
|
||||
"oldfieldname": "closing_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_22",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "department",
|
||||
"fieldtype": "Link",
|
||||
"label": "Department",
|
||||
"options": "Department"
|
||||
},
|
||||
{
|
||||
"fetch_from": "project.company",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"remember_last_selected_value": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "lft",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "rgt",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Old Parent",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "completed_by",
|
||||
"fieldtype": "Link",
|
||||
"label": "Completed By",
|
||||
"no_copy": 1,
|
||||
"options": "User"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-check",
|
||||
"idx": 1,
|
||||
"is_tree": 1,
|
||||
"links": [],
|
||||
"max_attachments": 0,
|
||||
"modified": "2020-07-03 12:36:04.960457",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Task",
|
||||
"nsm_parent_field": "parent_task",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Projects User",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"search_fields": "subject",
|
||||
"show_name_in_global_search": 1,
|
||||
"show_preview_popup": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"timeline_field": "project",
|
||||
"title_field": "subject",
|
||||
"track_seen": 1
|
||||
}
|
||||
@@ -24,6 +24,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
|
||||
if (item.discount_amount) {
|
||||
item.rate = flt((item.rate_with_margin) - (item.discount_amount), precision('rate', item));
|
||||
item.discount_percentage = 100 * flt(item.discount_amount) / flt(item.rate_with_margin);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -522,6 +522,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
company: me.frm.doc.company,
|
||||
order_type: me.frm.doc.order_type,
|
||||
is_pos: cint(me.frm.doc.is_pos),
|
||||
is_return: cint(me.frm.doc.is_return),
|
||||
is_subcontracted: me.frm.doc.is_subcontracted,
|
||||
transaction_date: me.frm.doc.transaction_date || me.frm.doc.posting_date,
|
||||
ignore_pricing_rule: me.frm.doc.ignore_pricing_rule,
|
||||
|
||||
@@ -469,6 +469,33 @@ erpnext.utils.update_child_items = function(opts) {
|
||||
read_only: 0,
|
||||
disabled: 0,
|
||||
label: __('Item Code')
|
||||
}, {
|
||||
fieldtype:'Link',
|
||||
fieldname:'uom',
|
||||
options: 'UOM',
|
||||
read_only: 0,
|
||||
label: __('UOM'),
|
||||
reqd: 1,
|
||||
onchange: function () {
|
||||
frappe.call({
|
||||
method: "erpnext.stock.get_item_details.get_conversion_factor",
|
||||
args: { item_code: this.doc.item_code, uom: this.value },
|
||||
callback: r => {
|
||||
if(!r.exc) {
|
||||
if (this.doc.conversion_factor == r.message.conversion_factor) return;
|
||||
|
||||
const docname = this.doc.docname;
|
||||
dialog.fields_dict.trans_items.df.data.some(doc => {
|
||||
if (doc.docname == docname) {
|
||||
doc.conversion_factor = r.message.conversion_factor;
|
||||
dialog.fields_dict.trans_items.grid.refresh();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
}, {
|
||||
fieldtype:'Float',
|
||||
fieldname:"qty",
|
||||
@@ -552,6 +579,7 @@ erpnext.utils.update_child_items = function(opts) {
|
||||
"conversion_factor": d.conversion_factor,
|
||||
"qty": d.qty,
|
||||
"rate": d.rate,
|
||||
"uom": d.uom
|
||||
});
|
||||
this.data = dialog.fields_dict.trans_items.df.data;
|
||||
dialog.fields_dict.trans_items.grid.refresh();
|
||||
|
||||
@@ -133,6 +133,7 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
() => me.update_batch_serial_no_items(),
|
||||
() => {
|
||||
refresh_field("items");
|
||||
refresh_field("packed_items");
|
||||
if (me.callback) {
|
||||
return me.callback(me.item);
|
||||
}
|
||||
@@ -147,7 +148,7 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
if (this.item.serial_no) {
|
||||
this.dialog.fields_dict.serial_no.set_value(this.item.serial_no);
|
||||
}
|
||||
|
||||
|
||||
if (this.has_batch && !this.has_serial_no && d.batch_no) {
|
||||
this.frm.doc.items.forEach(data => {
|
||||
if(data.item_code == d.item_code) {
|
||||
@@ -229,7 +230,7 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
this.map_row_values(row, batch, 'batch_no',
|
||||
'selected_qty', this.values.warehouse);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
update_serial_no_item() {
|
||||
@@ -248,7 +249,7 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
filters: { 'name': ["in", selected_serial_nos]},
|
||||
fields: ["batch_no", "name"]
|
||||
}).then((data) => {
|
||||
// data = [{batch_no: 'batch-1', name: "SR-001"},
|
||||
// data = [{batch_no: 'batch-1', name: "SR-001"},
|
||||
// {batch_no: 'batch-2', name: "SR-003"}, {batch_no: 'batch-2', name: "SR-004"}]
|
||||
const batch_serial_map = data.reduce((acc, d) => {
|
||||
if (!acc[d['batch_no']]) acc[d['batch_no']] = [];
|
||||
@@ -296,6 +297,8 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
} else {
|
||||
row.warehouse = values.warehouse || warehouse;
|
||||
}
|
||||
|
||||
this.frm.dirty();
|
||||
},
|
||||
|
||||
update_total_qty: function() {
|
||||
|
||||
@@ -24,9 +24,8 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "reference_invoice",
|
||||
"fieldtype": "Link",
|
||||
"label": "Reference Invoice",
|
||||
"options": "Sales Invoice"
|
||||
"fieldtype": "Data",
|
||||
"label": "Reference Invoice"
|
||||
},
|
||||
{
|
||||
"fieldname": "headers",
|
||||
@@ -64,7 +63,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2020-12-24 21:09:38.882866",
|
||||
"modified": "2021-01-13 12:06:57.253111",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Regional",
|
||||
"name": "E Invoice Request Log",
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"field_order": [
|
||||
"enable",
|
||||
"section_break_2",
|
||||
"sandbox_mode",
|
||||
"credentials",
|
||||
"auth_token",
|
||||
"token_expiry"
|
||||
@@ -41,12 +42,18 @@
|
||||
"label": "Credentials",
|
||||
"mandatory_depends_on": "enable",
|
||||
"options": "E Invoice User"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "sandbox_mode",
|
||||
"fieldtype": "Check",
|
||||
"label": "Sandbox Mode"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2020-12-22 15:34:57.280044",
|
||||
"modified": "2021-01-13 12:04:49.449199",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Regional",
|
||||
"name": "E Invoice Settings",
|
||||
|
||||
@@ -20,6 +20,7 @@ states = [
|
||||
'Jharkhand',
|
||||
'Karnataka',
|
||||
'Kerala',
|
||||
'Ladakh',
|
||||
'Lakshadweep Islands',
|
||||
'Madhya Pradesh',
|
||||
'Maharashtra',
|
||||
@@ -59,6 +60,7 @@ state_numbers = {
|
||||
"Jharkhand": "20",
|
||||
"Karnataka": "29",
|
||||
"Kerala": "32",
|
||||
"Ladakh": "38",
|
||||
"Lakshadweep Islands": "31",
|
||||
"Madhya Pradesh": "23",
|
||||
"Maharashtra": "27",
|
||||
@@ -80,4 +82,4 @@ state_numbers = {
|
||||
"West Bengal": "19",
|
||||
}
|
||||
|
||||
number_state_mapping = {v: k for k, v in iteritems(state_numbers)}
|
||||
number_state_mapping = {v: k for k, v in iteritems(state_numbers)}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
{item_list}
|
||||
],
|
||||
"ValDtls": {{
|
||||
"AssVal": "{invoice_value_details.base_net_total}",
|
||||
"AssVal": "{invoice_value_details.base_total}",
|
||||
"CgstVal": "{invoice_value_details.total_cgst_amt}",
|
||||
"SgstVal": "{invoice_value_details.total_sgst_amt}",
|
||||
"IgstVal": "{invoice_value_details.total_igst_amt}",
|
||||
|
||||
@@ -22,6 +22,9 @@ erpnext.setup_einvoice_actions = (doctype) => {
|
||||
|
||||
if (!irn && !__unsaved) {
|
||||
const action = () => {
|
||||
if (frm.doc.__unsaved) {
|
||||
frappe.throw(__('Please save the document to generate IRN.'));
|
||||
}
|
||||
frappe.call({
|
||||
method: 'erpnext.regional.india.e_invoice.utils.get_einvoice',
|
||||
args: { doctype, docname: name },
|
||||
|
||||
@@ -11,19 +11,22 @@ import json
|
||||
import base64
|
||||
import frappe
|
||||
import traceback
|
||||
import io
|
||||
from frappe import _, bold
|
||||
from pyqrcode import create as qrcreate
|
||||
from frappe.integrations.utils import make_post_request, make_get_request
|
||||
from erpnext.regional.india.utils import get_gst_accounts, get_place_of_supply
|
||||
from frappe.utils.data import cstr, cint, formatdate as format_date, flt, time_diff_in_seconds, now_datetime, add_to_date
|
||||
from frappe.utils.data import cstr, cint, formatdate as format_date, flt, time_diff_in_seconds, now_datetime, add_to_date, get_link_to_form
|
||||
|
||||
def validate_einvoice_fields(doc):
|
||||
einvoicing_enabled = cint(frappe.db.get_value('E Invoice Settings', 'E Invoice Settings', 'enable'))
|
||||
invalid_doctype = doc.doctype not in ['Sales Invoice']
|
||||
invalid_doctype = doc.doctype != 'Sales Invoice'
|
||||
invalid_supply_type = doc.get('gst_category') not in ['Registered Regular', 'SEZ', 'Overseas', 'Deemed Export']
|
||||
company_transaction = doc.get('billing_address_gstin') == doc.get('company_gstin')
|
||||
no_taxes_applied = len(doc.get('taxes', [])) == 0
|
||||
|
||||
if not einvoicing_enabled or invalid_doctype or invalid_supply_type or company_transaction: return
|
||||
if not einvoicing_enabled or invalid_doctype or invalid_supply_type or company_transaction or no_taxes_applied:
|
||||
return
|
||||
|
||||
if doc.docstatus == 0 and doc._action == 'save':
|
||||
if doc.irn:
|
||||
@@ -34,7 +37,7 @@ def validate_einvoice_fields(doc):
|
||||
elif doc.docstatus == 1 and doc._action == 'submit' and not doc.irn:
|
||||
frappe.throw(_('You must generate IRN before submitting the document.'), title=_('Missing IRN'))
|
||||
|
||||
elif doc.docstatus == 2 and doc._action == 'cancel' and not doc.irn_cancelled:
|
||||
elif doc.irn and doc.docstatus == 2 and doc._action == 'cancel' and not doc.irn_cancelled:
|
||||
frappe.throw(_('You must cancel IRN before cancelling the document.'), title=_('Cancel Not Allowed'))
|
||||
|
||||
def raise_document_name_too_long_error():
|
||||
@@ -84,29 +87,32 @@ def get_doc_details(invoice):
|
||||
))
|
||||
|
||||
def get_party_details(address_name):
|
||||
address = frappe.get_all('Address', filters={'name': address_name}, fields=['*'])[0]
|
||||
gstin = address.get('gstin')
|
||||
d = frappe.get_all('Address', filters={'name': address_name}, fields=['*'])[0]
|
||||
|
||||
gstin_details = get_gstin_details(gstin)
|
||||
legal_name = gstin_details.get('LegalName')
|
||||
location = gstin_details.get('AddrLoc') or address.get('city')
|
||||
state_code = gstin_details.get('StateCode')
|
||||
pincode = gstin_details.get('AddrPncd')
|
||||
address_line1 = '{} {}'.format(gstin_details.get('AddrBno'), gstin_details.get('AddrFlno'))
|
||||
address_line2 = '{} {}'.format(gstin_details.get('AddrBnm'), gstin_details.get('AddrSt'))
|
||||
email_id = address.get('email_id')
|
||||
phone = address.get('phone')
|
||||
# get last 10 digit
|
||||
phone = phone.replace(" ", "")[-10:] if phone else ''
|
||||
if (not d.gstin
|
||||
or not d.city
|
||||
or not d.pincode
|
||||
or not d.address_title
|
||||
or not d.address_line1
|
||||
or not d.gst_state_number):
|
||||
|
||||
if state_code == 97:
|
||||
frappe.throw(
|
||||
msg=_('Address lines, city, pincode, gstin is mandatory for address {}. Please set them and try again.').format(
|
||||
get_link_to_form('Address', address_name)
|
||||
),
|
||||
title=_('Missing Address Fields')
|
||||
)
|
||||
|
||||
if d.gst_state_number == 97:
|
||||
# according to einvoice standard
|
||||
pincode = 999999
|
||||
|
||||
return frappe._dict(dict(
|
||||
gstin=gstin, legal_name=legal_name, location=location,
|
||||
pincode=pincode, state_code=state_code, address_line1=address_line1,
|
||||
address_line2=address_line2, email=email_id, phone=phone
|
||||
gstin=d.gstin, legal_name=d.address_title,
|
||||
location=d.city, pincode=d.pincode,
|
||||
state_code=d.gst_state_number,
|
||||
address_line1=d.address_line1,
|
||||
address_line2=d.address_line2
|
||||
))
|
||||
|
||||
def get_gstin_details(gstin):
|
||||
@@ -127,14 +133,22 @@ def get_gstin_details(gstin):
|
||||
return GSPConnector.get_gstin_details(gstin)
|
||||
|
||||
def get_overseas_address_details(address_name):
|
||||
address_title, address_line1, address_line2, city, phone, email_id = frappe.db.get_value(
|
||||
'Address', address_name, ['address_title', 'address_line1', 'address_line2', 'city', 'phone', 'email_id']
|
||||
address_title, address_line1, address_line2, city = frappe.db.get_value(
|
||||
'Address', address_name, ['address_title', 'address_line1', 'address_line2', 'city']
|
||||
)
|
||||
|
||||
if not address_title or not address_line1 or not city:
|
||||
frappe.throw(
|
||||
msg=_('Address lines and city is mandatory for address {}. Please set them and try again.').format(
|
||||
get_link_to_form('Address', address_name)
|
||||
),
|
||||
title=_('Missing Address Fields')
|
||||
)
|
||||
|
||||
return frappe._dict(dict(
|
||||
gstin='URP', legal_name=address_title, address_line1=address_line1,
|
||||
address_line2=address_line2, email=email_id, phone=phone,
|
||||
pincode=999999, state_code=96, place_of_supply=96, location=city
|
||||
gstin='URP', legal_name=address_title, location=city,
|
||||
address_line1=address_line1, address_line2=address_line2,
|
||||
pincode=999999, state_code=96, place_of_supply=96
|
||||
))
|
||||
|
||||
def get_item_list(invoice):
|
||||
@@ -146,9 +160,10 @@ def get_item_list(invoice):
|
||||
item.update(d.as_dict())
|
||||
|
||||
item.sr_no = d.idx
|
||||
item.discount_amount = abs(item.discount_amount * item.qty)
|
||||
item.description = d.item_name
|
||||
item.description = d.item_name.replace('"', '\\"')
|
||||
|
||||
item.qty = abs(item.qty)
|
||||
item.discount_amount = 0
|
||||
item.unit_rate = abs(item.base_net_amount / item.qty)
|
||||
item.gross_amount = abs(item.base_net_amount)
|
||||
item.taxable_value = abs(item.base_net_amount)
|
||||
@@ -156,6 +171,7 @@ def get_item_list(invoice):
|
||||
item.batch_expiry_date = frappe.db.get_value('Batch', d.batch_no, 'expiry_date') if d.batch_no else None
|
||||
item.batch_expiry_date = format_date(item.batch_expiry_date, 'dd/mm/yyyy') if item.batch_expiry_date else None
|
||||
item.is_service_item = 'N' if frappe.db.get_value('Item', d.item_code, 'is_stock_item') else 'Y'
|
||||
item.serial_no = ""
|
||||
|
||||
item = update_item_taxes(invoice, item)
|
||||
|
||||
@@ -180,32 +196,40 @@ def update_item_taxes(invoice, item):
|
||||
item[attr] = 0
|
||||
|
||||
for t in invoice.taxes:
|
||||
# this contains item wise tax rate & tax amount (incl. discount)
|
||||
item_tax_detail = json.loads(t.item_wise_tax_detail).get(item.item_code)
|
||||
if t.account_head in gst_accounts_list:
|
||||
item_tax_rate = item_tax_detail[0]
|
||||
# item tax amount excluding discount amount
|
||||
item_tax_amount = (item_tax_rate / 100) * item.base_net_amount
|
||||
|
||||
if t.account_head in gst_accounts.cess_account:
|
||||
item_tax_amount_after_discount = item_tax_detail[1]
|
||||
if t.charge_type == 'On Item Quantity':
|
||||
item.cess_nadv_amount += abs(item_tax_detail[1])
|
||||
item.cess_nadv_amount += abs(item_tax_amount_after_discount)
|
||||
else:
|
||||
item.cess_rate += item_tax_detail[0]
|
||||
item.cess_amount += abs(item_tax_detail[1])
|
||||
elif t.account_head in gst_accounts.igst_account:
|
||||
item.tax_rate += item_tax_detail[0]
|
||||
item.igst_amount += abs(item_tax_detail[1])
|
||||
elif t.account_head in gst_accounts.sgst_account:
|
||||
item.tax_rate += item_tax_detail[0]
|
||||
item.sgst_amount += abs(item_tax_detail[1])
|
||||
elif t.account_head in gst_accounts.cgst_account:
|
||||
item.tax_rate += item_tax_detail[0]
|
||||
item.cgst_amount += abs(item_tax_detail[1])
|
||||
|
||||
item.cess_rate += item_tax_rate
|
||||
item.cess_amount += abs(item_tax_amount_after_discount)
|
||||
|
||||
for tax_type in ['igst', 'cgst', 'sgst']:
|
||||
if t.account_head in gst_accounts['{}_account'.format(tax_type)]:
|
||||
item.tax_rate += item_tax_rate
|
||||
item['{}_amount'.format(tax_type)] += abs(item_tax_amount)
|
||||
|
||||
return item
|
||||
|
||||
def get_invoice_value_details(invoice):
|
||||
invoice_value_details = frappe._dict(dict())
|
||||
invoice_value_details.base_net_total = abs(invoice.base_net_total)
|
||||
invoice_value_details.invoice_discount_amt = invoice.discount_amount if invoice.discount_amount and invoice.discount_amount > 0 else 0
|
||||
# discount amount cannnot be -ve in an e-invoice, so if -ve include discount in round_off
|
||||
invoice_value_details.round_off = invoice.rounding_adjustment - (invoice.discount_amount if invoice.discount_amount and invoice.discount_amount < 0 else 0)
|
||||
|
||||
if invoice.apply_discount_on == 'Net Total' and invoice.discount_amount:
|
||||
invoice_value_details.base_total = abs(invoice.base_total)
|
||||
invoice_value_details.invoice_discount_amt = invoice.base_discount_amount
|
||||
else:
|
||||
invoice_value_details.base_total = abs(invoice.base_net_total)
|
||||
# since tax already considers discount amount
|
||||
invoice_value_details.invoice_discount_amt = 0
|
||||
|
||||
invoice_value_details.round_off = invoice.base_rounding_adjustment
|
||||
invoice_value_details.base_grand_total = abs(invoice.base_rounded_total) or abs(invoice.base_grand_total)
|
||||
invoice_value_details.grand_total = abs(invoice.rounded_total) or abs(invoice.grand_total)
|
||||
|
||||
@@ -225,13 +249,12 @@ def update_invoice_taxes(invoice, invoice_value_details):
|
||||
for t in invoice.taxes:
|
||||
if t.account_head in gst_accounts_list:
|
||||
if t.account_head in gst_accounts.cess_account:
|
||||
# using after discount amt since item also uses after discount amt for cess calc
|
||||
invoice_value_details.total_cess_amt += abs(t.base_tax_amount_after_discount_amount)
|
||||
elif t.account_head in gst_accounts.igst_account:
|
||||
invoice_value_details.total_igst_amt += abs(t.base_tax_amount_after_discount_amount)
|
||||
elif t.account_head in gst_accounts.sgst_account:
|
||||
invoice_value_details.total_sgst_amt += abs(t.base_tax_amount_after_discount_amount)
|
||||
elif t.account_head in gst_accounts.cgst_account:
|
||||
invoice_value_details.total_cgst_amt += abs(t.base_tax_amount_after_discount_amount)
|
||||
|
||||
for tax_type in ['igst', 'cgst', 'sgst']:
|
||||
if t.account_head in gst_accounts['{}_account'.format(tax_type)]:
|
||||
invoice_value_details['total_{}_amt'.format(tax_type)] += abs(t.base_tax_amount_after_discount_amount)
|
||||
else:
|
||||
invoice_value_details.total_other_charges += abs(t.base_tax_amount_after_discount_amount)
|
||||
|
||||
@@ -272,7 +295,25 @@ def get_eway_bill_details(invoice):
|
||||
vehicle_type=vehicle_type[invoice.gst_vehicle_type]
|
||||
))
|
||||
|
||||
def validate_mandatory_fields(invoice):
|
||||
if not invoice.company_address:
|
||||
frappe.throw(_('Company Address is mandatory to fetch company GSTIN details.'), title=_('Missing Fields'))
|
||||
if not invoice.customer_address:
|
||||
frappe.throw(_('Customer Address is mandatory to fetch customer GSTIN details.'), title=_('Missing Fields'))
|
||||
if not frappe.db.get_value('Address', invoice.company_address, 'gstin'):
|
||||
frappe.throw(
|
||||
_('GSTIN is mandatory to fetch company GSTIN details. Please enter GSTIN in selected company address.'),
|
||||
title=_('Missing Fields')
|
||||
)
|
||||
if invoice.gst_category != 'Overseas' and not frappe.db.get_value('Address', invoice.customer_address, 'gstin'):
|
||||
frappe.throw(
|
||||
_('GSTIN is mandatory to fetch customer GSTIN details. Please enter GSTIN in selected customer address.'),
|
||||
title=_('Missing Fields')
|
||||
)
|
||||
|
||||
def make_einvoice(invoice):
|
||||
validate_mandatory_fields(invoice)
|
||||
|
||||
schema = read_json('einv_template')
|
||||
|
||||
transaction_details = get_transaction_details(invoice)
|
||||
@@ -291,7 +332,10 @@ def make_einvoice(invoice):
|
||||
|
||||
shipping_details = payment_details = prev_doc_details = eway_bill_details = frappe._dict({})
|
||||
if invoice.shipping_address_name and invoice.customer_address != invoice.shipping_address_name:
|
||||
shipping_details = get_party_details(invoice.shipping_address_name)
|
||||
if invoice.gst_category == 'Overseas':
|
||||
shipping_details = get_overseas_address_details(invoice.shipping_address_name)
|
||||
else:
|
||||
shipping_details = get_party_details(invoice.shipping_address_name)
|
||||
|
||||
if invoice.is_pos and invoice.base_paid_amount:
|
||||
payment_details = get_payment_details(invoice)
|
||||
@@ -358,7 +402,7 @@ def validate_einvoice(validations, einvoice, errors=[]):
|
||||
# remove empty dicts
|
||||
einvoice.pop(fieldname, None)
|
||||
continue
|
||||
|
||||
|
||||
# convert to int or str
|
||||
if value_type == 'string':
|
||||
einvoice[fieldname] = str(value)
|
||||
@@ -390,18 +434,22 @@ class RequestFailed(Exception): pass
|
||||
class GSPConnector():
|
||||
def __init__(self, doctype=None, docname=None):
|
||||
self.e_invoice_settings = frappe.get_cached_doc('E Invoice Settings')
|
||||
sandbox_mode = self.e_invoice_settings.sandbox_mode
|
||||
|
||||
self.invoice = frappe.get_cached_doc(doctype, docname) if doctype and docname else None
|
||||
self.credentials = self.get_credentials()
|
||||
|
||||
self.base_url = 'https://gsp.adaequare.com/'
|
||||
self.authenticate_url = self.base_url + 'gsp/authenticate?grant_type=token'
|
||||
self.gstin_details_url = self.base_url + 'test/enriched/ei/api/master/gstin'
|
||||
self.generate_irn_url = self.base_url + 'test/enriched/ei/api/invoice'
|
||||
self.irn_details_url = self.base_url + 'test/enriched/ei/api/invoice/irn'
|
||||
self.cancel_irn_url = self.base_url + 'test/enriched/ei/api/invoice/cancel'
|
||||
self.cancel_ewaybill_url = self.base_url + '/test/enriched/ei/api/ewayapi'
|
||||
self.generate_ewaybill_url = self.base_url + 'test/enriched/ei/api/ewaybill'
|
||||
|
||||
# authenticate url is same for sandbox & live
|
||||
self.authenticate_url = 'https://gsp.adaequare.com/gsp/authenticate?grant_type=token'
|
||||
self.base_url = 'https://gsp.adaequare.com' if not sandbox_mode else 'https://gsp.adaequare.com/test'
|
||||
|
||||
self.cancel_irn_url = self.base_url + '/enriched/ei/api/invoice/cancel'
|
||||
self.irn_details_url = self.base_url + '/enriched/ei/api/invoice/irn'
|
||||
self.generate_irn_url = self.base_url + '/enriched/ei/api/invoice'
|
||||
self.gstin_details_url = self.base_url + '/enriched/ei/api/master/gstin'
|
||||
self.cancel_ewaybill_url = self.base_url + '/enriched/ewb/ewayapi?action=CANEWB'
|
||||
self.generate_ewaybill_url = self.base_url + '/enriched/ei/api/ewaybill'
|
||||
|
||||
def get_credentials(self):
|
||||
if self.invoice:
|
||||
gstin = self.get_seller_gstin()
|
||||
@@ -442,7 +490,7 @@ class GSPConnector():
|
||||
"data": json.dumps(data, indent=4) if isinstance(data, dict) else data,
|
||||
"response": json.dumps(res, indent=4) if res else None
|
||||
})
|
||||
request_log.insert(ignore_permissions=True)
|
||||
request_log.save(ignore_permissions=True)
|
||||
frappe.db.commit()
|
||||
|
||||
def fetch_auth_token(self):
|
||||
@@ -455,7 +503,8 @@ class GSPConnector():
|
||||
res = self.make_request('post', self.authenticate_url, headers)
|
||||
self.e_invoice_settings.auth_token = "{} {}".format(res.get('token_type'), res.get('access_token'))
|
||||
self.e_invoice_settings.token_expiry = add_to_date(None, seconds=res.get('expires_in'))
|
||||
self.e_invoice_settings.save()
|
||||
self.e_invoice_settings.save(ignore_permissions=True)
|
||||
self.e_invoice_settings.reload()
|
||||
|
||||
except Exception:
|
||||
self.log_error(res)
|
||||
@@ -633,6 +682,8 @@ class GSPConnector():
|
||||
'cancelRsnCode': reason,
|
||||
'cancelRmrk': remark
|
||||
}, indent=4)
|
||||
headers["username"] = headers["user_name"]
|
||||
del headers["user_name"]
|
||||
|
||||
try:
|
||||
res = self.make_request('post', self.cancel_ewaybill_url, headers, data)
|
||||
@@ -726,25 +777,26 @@ class GSPConnector():
|
||||
'label': _('IRN Generated')
|
||||
}
|
||||
self.update_invoice()
|
||||
|
||||
|
||||
def attach_qrcode_image(self):
|
||||
qrcode = self.invoice.signed_qr_code
|
||||
doctype = self.invoice.doctype
|
||||
docname = self.invoice.name
|
||||
filename = 'QRCode_{}.png'.format(docname).replace(os.path.sep, "__")
|
||||
|
||||
_file = frappe.new_doc('File')
|
||||
_file.update({
|
||||
'file_name': 'QRCode_{}.png'.format(docname),
|
||||
'attached_to_doctype': doctype,
|
||||
'attached_to_name': docname,
|
||||
'content': 'qrcode',
|
||||
'is_private': 1
|
||||
})
|
||||
_file.insert()
|
||||
frappe.db.commit()
|
||||
qr_image = io.BytesIO()
|
||||
url = qrcreate(qrcode, error='L')
|
||||
abs_file_path = os.path.abspath(_file.get_full_path())
|
||||
url.png(abs_file_path, scale=2, quiet_zone=1)
|
||||
url.png(qr_image, scale=2, quiet_zone=1)
|
||||
_file = frappe.get_doc({
|
||||
"doctype": "File",
|
||||
"file_name": filename,
|
||||
"attached_to_doctype": doctype,
|
||||
"attached_to_name": docname,
|
||||
"attached_to_field": "qrcode_image",
|
||||
"is_private": 1,
|
||||
"content": qr_image.getvalue()})
|
||||
_file.save()
|
||||
frappe.db.commit()
|
||||
|
||||
self.invoice.qrcode_image = _file.file_url
|
||||
|
||||
|
||||
@@ -168,5 +168,10 @@
|
||||
"state_number": "37",
|
||||
"state_code": "AD",
|
||||
"state_name": "Andhra Pradesh (New)"
|
||||
},
|
||||
{
|
||||
"state_number": "38",
|
||||
"state_code": "LA",
|
||||
"state_name": "Ladakh"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -22,4 +22,4 @@ erpnext.setup_gst_reminder_button = (doctype) => {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
@@ -7,7 +7,7 @@ import frappe, os, json
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
from frappe.permissions import add_permission, update_permission_property
|
||||
from erpnext.regional.india import states
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from erpnext.accounts.utils import get_fiscal_year, FiscalYearError
|
||||
from frappe.utils import today
|
||||
|
||||
def setup(company=None, patch=True):
|
||||
@@ -273,11 +273,21 @@ def make_custom_fields(update=True):
|
||||
'options': 'Supplier',
|
||||
'print_hide': 1
|
||||
},
|
||||
{
|
||||
'fieldname': 'transporter_name',
|
||||
'label': 'Transporter Name',
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'transporter',
|
||||
'fetch_from': 'transporter.name',
|
||||
'read_only': 1,
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
{
|
||||
'fieldname': 'gst_transporter_id',
|
||||
'label': 'GST Transporter ID',
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'transporter',
|
||||
'insert_after': 'transporter_name',
|
||||
'fetch_from': 'transporter.gst_transporter_id',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
@@ -319,11 +329,18 @@ def make_custom_fields(update=True):
|
||||
'insert_after': 'distance'
|
||||
},
|
||||
{
|
||||
'fieldname': 'transporter_name',
|
||||
'label': 'Transporter Name',
|
||||
'fieldtype': 'Data',
|
||||
'fieldname': 'transporter_address',
|
||||
'label': 'Transporter Address Name',
|
||||
'fieldtype': 'Link',
|
||||
'insert_after': 'transporter_col_break',
|
||||
'fetch_from': 'transporter.name',
|
||||
'options': 'Address',
|
||||
'print_hide': 1
|
||||
},
|
||||
{
|
||||
'fieldname': 'transporter_address_display',
|
||||
'label': 'Transporter Address Preview',
|
||||
'fieldtype': 'Small Text',
|
||||
'insert_after': 'transporter_address',
|
||||
'read_only': 1,
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
@@ -333,7 +350,8 @@ def make_custom_fields(update=True):
|
||||
'label': 'Mode of Transport',
|
||||
'fieldtype': 'Select',
|
||||
'options': '\nRoad\nAir\nRail\nShip',
|
||||
'insert_after': 'transporter_name',
|
||||
'default': 'Road',
|
||||
'insert_after': 'transporter_address_display',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
},
|
||||
@@ -567,13 +585,18 @@ def set_salary_components(docs):
|
||||
|
||||
def set_tax_withholding_category(company):
|
||||
accounts = []
|
||||
fiscal_year = None
|
||||
abbr = frappe.get_value("Company", company, "abbr")
|
||||
tds_account = frappe.get_value("Account", 'TDS Payable - {0}'.format(abbr), 'name')
|
||||
|
||||
if company and tds_account:
|
||||
accounts = [dict(company=company, account=tds_account)]
|
||||
|
||||
fiscal_year = get_fiscal_year(today(), company=company)[0]
|
||||
try:
|
||||
fiscal_year = get_fiscal_year(today(), verbose=0, company=company)[0]
|
||||
except FiscalYearError:
|
||||
pass
|
||||
|
||||
docs = get_tds_details(accounts, fiscal_year)
|
||||
|
||||
for d in docs:
|
||||
@@ -588,11 +611,14 @@ def set_tax_withholding_category(company):
|
||||
if accounts:
|
||||
doc.append("accounts", accounts[0])
|
||||
|
||||
# if fiscal year don't match with any of the already entered data, append rate row
|
||||
fy_exist = [k for k in doc.get('rates') if k.get('fiscal_year')==fiscal_year]
|
||||
if not fy_exist:
|
||||
doc.append("rates", d.get('rates')[0])
|
||||
|
||||
if fiscal_year:
|
||||
# if fiscal year don't match with any of the already entered data, append rate row
|
||||
fy_exist = [k for k in doc.get('rates') if k.get('fiscal_year')==fiscal_year]
|
||||
if not fy_exist:
|
||||
doc.append("rates", d.get('rates')[0])
|
||||
|
||||
doc.flags.ignore_permissions = True
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.save()
|
||||
|
||||
def set_tds_account(docs, company):
|
||||
|
||||
@@ -12,6 +12,7 @@ from erpnext.regional.india import number_state_mapping
|
||||
from six import string_types
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
from frappe.contacts.doctype.address.address import get_address_display
|
||||
from frappe.model.utils import get_fetch_values
|
||||
|
||||
def validate_gstin_for_india(doc, method):
|
||||
@@ -93,8 +94,7 @@ def validate_gstin_check_digit(gstin, label='GSTIN'):
|
||||
total += digit
|
||||
factor = 2 if factor == 1 else 1
|
||||
if gstin[-1] != code_point_chars[((mod - (total % mod)) % mod)]:
|
||||
frappe.throw(_("""Invalid {0}! The check digit validation has failed.
|
||||
Please ensure you've typed the {0} correctly.""").format(label))
|
||||
frappe.throw(_("""Invalid {0}! The check digit validation has failed. Please ensure you've typed the {0} correctly.""").format(label))
|
||||
|
||||
def get_itemised_tax_breakup_header(item_doctype, tax_accounts):
|
||||
if frappe.get_meta(item_doctype).has_field('gst_hsn_code'):
|
||||
@@ -138,6 +138,30 @@ def get_itemised_tax_breakup_data(doc, account_wise=False):
|
||||
def set_place_of_supply(doc, method=None):
|
||||
doc.place_of_supply = get_place_of_supply(doc, doc.doctype)
|
||||
|
||||
def set_transporter_address(doc, method=None):
|
||||
country = frappe.get_cached_value('Company', doc.company, 'country')
|
||||
if country != 'India':
|
||||
return
|
||||
|
||||
if doc.get("transporter_address"):
|
||||
# once supplier is set, address can be selected from multiple transporter addresses
|
||||
doc.transporter_address_display = get_address_display(doc.get("transporter_address"))
|
||||
return
|
||||
|
||||
transporter_address = frappe.db.get_value("Dynamic Link", {
|
||||
'link_doctype': 'Supplier',
|
||||
'link_name': doc.get('transporter'),
|
||||
'parenttype': 'Address'
|
||||
}, "parent")
|
||||
|
||||
if not transporter_address:
|
||||
doc.transporter_address = ""
|
||||
doc.transporter_address_display = ""
|
||||
return
|
||||
|
||||
doc.transporter_address = transporter_address
|
||||
doc.transporter_address_display = get_address_display(transporter_address)
|
||||
|
||||
# don't remove this function it is used in tests
|
||||
def test_method():
|
||||
'''test function'''
|
||||
@@ -169,7 +193,7 @@ def get_regional_address_details(party_details, doctype, company):
|
||||
if is_internal_transfer(party_details, doctype):
|
||||
party_details.taxes_and_charges = ''
|
||||
party_details.taxes = ''
|
||||
return
|
||||
return party_details
|
||||
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
|
||||
master_doctype = "Sales Taxes and Charges Template"
|
||||
@@ -177,11 +201,11 @@ def get_regional_address_details(party_details, doctype, company):
|
||||
get_tax_template_for_sez(party_details, master_doctype, company, 'Customer')
|
||||
get_tax_template_based_on_category(master_doctype, company, party_details)
|
||||
|
||||
if party_details.get('taxes_and_charges') and return_taxes:
|
||||
if party_details.get('taxes_and_charges'):
|
||||
return party_details
|
||||
|
||||
if not party_details.company_gstin:
|
||||
return
|
||||
return party_details
|
||||
|
||||
elif doctype in ("Purchase Invoice", "Purchase Order", "Purchase Receipt"):
|
||||
master_doctype = "Purchase Taxes and Charges Template"
|
||||
@@ -189,15 +213,15 @@ def get_regional_address_details(party_details, doctype, company):
|
||||
get_tax_template_for_sez(party_details, master_doctype, company, 'Supplier')
|
||||
get_tax_template_based_on_category(master_doctype, company, party_details)
|
||||
|
||||
if party_details.get('taxes_and_charges') and return_taxes:
|
||||
if party_details.get('taxes_and_charges'):
|
||||
return party_details
|
||||
|
||||
if not party_details.supplier_gstin:
|
||||
return
|
||||
return party_details
|
||||
|
||||
if not party_details.place_of_supply: return
|
||||
if not party_details.place_of_supply: return party_details
|
||||
|
||||
if not party_details.company_gstin: return
|
||||
if not party_details.company_gstin: return party_details
|
||||
|
||||
if ((doctype in ("Sales Invoice", "Delivery Note", "Sales Order") and party_details.company_gstin
|
||||
and party_details.company_gstin[:2] != party_details.place_of_supply[:2]) or (doctype in ("Purchase Invoice",
|
||||
@@ -207,12 +231,11 @@ def get_regional_address_details(party_details, doctype, company):
|
||||
default_tax = get_tax_template(master_doctype, company, 0, party_details.company_gstin[:2])
|
||||
|
||||
if not default_tax:
|
||||
return
|
||||
return party_details
|
||||
party_details["taxes_and_charges"] = default_tax
|
||||
party_details.taxes = get_taxes_and_charges(master_doctype, default_tax)
|
||||
|
||||
if return_taxes:
|
||||
return party_details
|
||||
return party_details
|
||||
|
||||
def update_party_details(party_details, doctype):
|
||||
for address_field in ['shipping_address', 'company_address', 'supplier_address', 'shipping_address_name', 'customer_address']:
|
||||
@@ -251,7 +274,7 @@ def get_tax_template(master_doctype, company, is_inter_state, state_code):
|
||||
if tax_category.gst_state == number_state_mapping[state_code] or \
|
||||
(not default_tax and not tax_category.gst_state):
|
||||
default_tax = frappe.db.get_value(master_doctype,
|
||||
{'disabled': 0, 'tax_category': tax_category.name}, 'name')
|
||||
{'company': company, 'disabled': 0, 'tax_category': tax_category.name}, 'name')
|
||||
return default_tax
|
||||
|
||||
def get_tax_template_for_sez(party_details, master_doctype, company, party_type):
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -255,15 +255,16 @@ class Gstr1Report(object):
|
||||
|
||||
for item_code, tax_amounts in item_wise_tax_detail.items():
|
||||
tax_rate = tax_amounts[0]
|
||||
if cgst_or_sgst:
|
||||
tax_rate *= 2
|
||||
if parent not in self.cgst_sgst_invoices:
|
||||
self.cgst_sgst_invoices.append(parent)
|
||||
if tax_rate:
|
||||
if cgst_or_sgst:
|
||||
tax_rate *= 2
|
||||
if parent not in self.cgst_sgst_invoices:
|
||||
self.cgst_sgst_invoices.append(parent)
|
||||
|
||||
rate_based_dict = self.items_based_on_tax_rate\
|
||||
.setdefault(parent, {}).setdefault(tax_rate, [])
|
||||
if item_code not in rate_based_dict:
|
||||
rate_based_dict.append(item_code)
|
||||
rate_based_dict = self.items_based_on_tax_rate\
|
||||
.setdefault(parent, {}).setdefault(tax_rate, [])
|
||||
if item_code not in rate_based_dict:
|
||||
rate_based_dict.append(item_code)
|
||||
except ValueError:
|
||||
continue
|
||||
if unidentified_gst_accounts:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
frappe.query_reports["IRS 1099"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"company",
|
||||
"fieldname": "company",
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
@@ -13,7 +13,7 @@ frappe.query_reports["IRS 1099"] = {
|
||||
"width": 80,
|
||||
},
|
||||
{
|
||||
"fieldname":"fiscal_year",
|
||||
"fieldname": "fiscal_year",
|
||||
"label": __("Fiscal Year"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Fiscal Year",
|
||||
@@ -22,7 +22,7 @@ frappe.query_reports["IRS 1099"] = {
|
||||
"width": 80,
|
||||
},
|
||||
{
|
||||
"fieldname":"supplier_group",
|
||||
"fieldname": "supplier_group",
|
||||
"label": __("Supplier Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Supplier Group",
|
||||
@@ -32,16 +32,16 @@ frappe.query_reports["IRS 1099"] = {
|
||||
},
|
||||
],
|
||||
|
||||
onload: function(query_report) {
|
||||
onload: function (query_report) {
|
||||
query_report.page.add_inner_button(__("Print IRS 1099 Forms"), () => {
|
||||
build_1099_print(query_report);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function build_1099_print(query_report){
|
||||
function build_1099_print(query_report) {
|
||||
let filters = JSON.stringify(query_report.get_values());
|
||||
let w = window.open('/api/method/erpnext.regional.report.irs_1099.irs_1099.irs_1099_print?' +
|
||||
'&filters=' + encodeURIComponent(filters));
|
||||
'&filters=' + encodeURIComponent(filters));
|
||||
// w.print();
|
||||
}
|
||||
|
||||
@@ -1,31 +1,41 @@
|
||||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import json
|
||||
from frappe import _, _dict
|
||||
from frappe.utils import nowdate
|
||||
from frappe.utils.data import fmt_money
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
|
||||
from PyPDF2 import PdfFileWriter
|
||||
|
||||
import frappe
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from frappe import _
|
||||
from frappe.utils import cstr, nowdate
|
||||
from frappe.utils.data import fmt_money
|
||||
from frappe.utils.jinja import render_template
|
||||
from frappe.utils.pdf import get_pdf
|
||||
from frappe.utils.print_format import read_multi_pdf
|
||||
from frappe.utils.jinja import render_template
|
||||
|
||||
IRS_1099_FORMS_FILE_EXTENSION = ".pdf"
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
filters = filters if isinstance(filters, _dict) else _dict(filters)
|
||||
filters = filters if isinstance(filters, frappe._dict) else frappe._dict(filters)
|
||||
if not filters:
|
||||
filters.setdefault('fiscal_year', get_fiscal_year(nowdate())[0])
|
||||
filters.setdefault('company', frappe.db.get_default("company"))
|
||||
|
||||
region = frappe.db.get_value("Company", fieldname = ["country"], filters = { "name": filters.company })
|
||||
region = frappe.db.get_value("Company",
|
||||
filters={"name": filters.company},
|
||||
fieldname=["country"])
|
||||
|
||||
if region != 'United States':
|
||||
return [],[]
|
||||
return [], []
|
||||
|
||||
data = []
|
||||
columns = get_columns()
|
||||
conditions = ""
|
||||
if filters.supplier_group:
|
||||
conditions += "AND s.supplier_group = %s" %frappe.db.escape(filters.get("supplier_group"))
|
||||
|
||||
data = frappe.db.sql("""
|
||||
SELECT
|
||||
s.supplier_group as "supplier_group",
|
||||
@@ -33,20 +43,25 @@ def execute(filters=None):
|
||||
s.tax_id as "tax_id",
|
||||
SUM(gl.debit_in_account_currency) AS "payments"
|
||||
FROM
|
||||
`tabGL Entry` gl INNER JOIN `tabSupplier` s
|
||||
`tabGL Entry` gl
|
||||
INNER JOIN `tabSupplier` s
|
||||
WHERE
|
||||
s.name = gl.party
|
||||
AND s.irs_1099 = 1
|
||||
AND gl.fiscal_year = %(fiscal_year)s
|
||||
AND gl.party_type = "Supplier"
|
||||
AND s.irs_1099 = 1
|
||||
AND gl.fiscal_year = %(fiscal_year)s
|
||||
AND gl.party_type = "Supplier"
|
||||
AND gl.company = %(company)s
|
||||
{conditions}
|
||||
|
||||
GROUP BY
|
||||
gl.party
|
||||
|
||||
|
||||
ORDER BY
|
||||
gl.party DESC""", {"fiscal_year": filters.fiscal_year,
|
||||
"supplier_group": filters.supplier_group,
|
||||
"company": filters.company}, as_dict=True)
|
||||
gl.party DESC""".format(conditions=conditions), {
|
||||
"fiscal_year": filters.fiscal_year,
|
||||
"company": filters.company
|
||||
}, as_dict=True)
|
||||
|
||||
return columns, data
|
||||
|
||||
|
||||
@@ -70,14 +85,13 @@ def get_columns():
|
||||
"fieldname": "tax_id",
|
||||
"label": _("Tax ID"),
|
||||
"fieldtype": "Data",
|
||||
"width": 120
|
||||
"width": 200
|
||||
},
|
||||
{
|
||||
|
||||
"fieldname": "payments",
|
||||
"label": _("Total Payments"),
|
||||
"fieldtype": "Currency",
|
||||
"width": 120
|
||||
"width": 200
|
||||
}
|
||||
]
|
||||
|
||||
@@ -87,23 +101,33 @@ def irs_1099_print(filters):
|
||||
if not filters:
|
||||
frappe._dict({
|
||||
"company": frappe.db.get_default("Company"),
|
||||
"fiscal_year": frappe.db.get_default("fiscal_year")})
|
||||
"fiscal_year": frappe.db.get_default("Fiscal Year")
|
||||
})
|
||||
else:
|
||||
filters = frappe._dict(json.loads(filters))
|
||||
|
||||
fiscal_year_doc = get_fiscal_year(fiscal_year=filters.fiscal_year, as_dict=True)
|
||||
fiscal_year = cstr(fiscal_year_doc.year_start_date.year)
|
||||
|
||||
company_address = get_payer_address_html(filters.company)
|
||||
company_tin = frappe.db.get_value("Company", filters.company, "tax_id")
|
||||
|
||||
columns, data = execute(filters)
|
||||
template = frappe.get_doc("Print Format", "IRS 1099 Form").html
|
||||
output = PdfFileWriter()
|
||||
|
||||
for row in data:
|
||||
row["fiscal_year"] = fiscal_year
|
||||
row["company"] = filters.company
|
||||
row["company_tin"] = company_tin
|
||||
row["payer_street_address"] = company_address
|
||||
row["recipient_street_address"], row["recipient_city_state"] = get_street_address_html("Supplier", row.supplier)
|
||||
row["recipient_street_address"], row["recipient_city_state"] = get_street_address_html(
|
||||
"Supplier", row.supplier)
|
||||
row["payments"] = fmt_money(row["payments"], precision=0, currency="USD")
|
||||
frappe._dict(row)
|
||||
pdf = get_pdf(render_template(template, row), output=output if output else None)
|
||||
frappe.local.response.filename = filters.fiscal_year + " " + filters.company + " IRS 1099 Forms"
|
||||
|
||||
frappe.local.response.filename = "{0} {1} IRS 1099 Forms{2}".format(filters.fiscal_year,
|
||||
filters.company, IRS_1099_FORMS_FILE_EXTENSION)
|
||||
frappe.local.response.filecontent = read_multi_pdf(output)
|
||||
frappe.local.response.type = "download"
|
||||
|
||||
@@ -119,36 +143,45 @@ def get_payer_address_html(company):
|
||||
ORDER BY
|
||||
address_type="Postal" DESC, address_type="Billing" DESC
|
||||
LIMIT 1
|
||||
""", {"company": company}, as_dict=True)
|
||||
""", {"company": company}, as_dict=True)
|
||||
|
||||
address_display = ""
|
||||
if address_list:
|
||||
company_address = address_list[0]["name"]
|
||||
return frappe.get_doc("Address", company_address).get_display()
|
||||
else:
|
||||
return ""
|
||||
address_display = frappe.get_doc("Address", company_address).get_display()
|
||||
|
||||
return address_display
|
||||
|
||||
|
||||
def get_street_address_html(party_type, party):
|
||||
address_list = frappe.db.sql("""
|
||||
SELECT
|
||||
link.parent
|
||||
FROM `tabDynamic Link` link, `tabAddress` address
|
||||
WHERE link.parenttype = "Address"
|
||||
AND link.link_name = %(party)s
|
||||
ORDER BY address.address_type="Postal" DESC,
|
||||
FROM
|
||||
`tabDynamic Link` link,
|
||||
`tabAddress` address
|
||||
WHERE
|
||||
link.parenttype = "Address"
|
||||
AND link.link_name = %(party)s
|
||||
ORDER BY
|
||||
address.address_type="Postal" DESC,
|
||||
address.address_type="Billing" DESC
|
||||
LIMIT 1
|
||||
""", {"party": party}, as_dict=True)
|
||||
""", {"party": party}, as_dict=True)
|
||||
|
||||
street_address = city_state = ""
|
||||
if address_list:
|
||||
supplier_address = address_list[0]["parent"]
|
||||
doc = frappe.get_doc("Address", supplier_address)
|
||||
|
||||
if doc.address_line2:
|
||||
street = doc.address_line1 + "<br>\n" + doc.address_line2 + "<br>\n"
|
||||
street_address = doc.address_line1 + "<br>\n" + doc.address_line2 + "<br>\n"
|
||||
else:
|
||||
street = doc.address_line1 + "<br>\n"
|
||||
city = doc.city + ", " if doc.city else ""
|
||||
city = city + doc.state + " " if doc.state else city
|
||||
city = city + doc.pincode if doc.pincode else city
|
||||
city += "<br>\n"
|
||||
return street, city
|
||||
else:
|
||||
return "", ""
|
||||
street_address = doc.address_line1 + "<br>\n"
|
||||
|
||||
city_state = doc.city + ", " if doc.city else ""
|
||||
city_state = city_state + doc.state + " " if doc.state else city_state
|
||||
city_state = city_state + doc.pincode if doc.pincode else city_state
|
||||
city_state += "<br>\n"
|
||||
|
||||
return street_address, city_state
|
||||
|
||||
@@ -502,7 +502,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
make_delivery_note: function() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.selling.doctype.sales_order.sales_order.make_delivery_note",
|
||||
frm: me.frm
|
||||
frm: this.frm
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -319,11 +319,14 @@ class TestSalesOrder(unittest.TestCase):
|
||||
self.assertEqual(get_reserved_qty("_Test Item Home Desktop 100"),
|
||||
existing_reserved_qty_item2 + 20)
|
||||
|
||||
def test_add_new_item_in_update_child_qty_rate(self):
|
||||
def test_update_child_adding_new_item(self):
|
||||
so = make_sales_order(item_code= "_Test Item", qty=4)
|
||||
create_dn_against_so(so.name, 4)
|
||||
make_sales_invoice(so.name)
|
||||
|
||||
prev_total = so.get("base_total")
|
||||
prev_total_in_words = so.get("base_in_words")
|
||||
|
||||
first_item_of_so = so.get("items")[0]
|
||||
trans_item = json.dumps([
|
||||
{'item_code' : first_item_of_so.item_code, 'rate' : first_item_of_so.rate, \
|
||||
@@ -339,7 +342,13 @@ class TestSalesOrder(unittest.TestCase):
|
||||
self.assertEqual(so.get("items")[-1].amount, 1400)
|
||||
self.assertEqual(so.status, 'To Deliver and Bill')
|
||||
|
||||
def test_remove_item_in_update_child_qty_rate(self):
|
||||
updated_total = so.get("base_total")
|
||||
updated_total_in_words = so.get("base_in_words")
|
||||
|
||||
self.assertEqual(updated_total, prev_total+1400)
|
||||
self.assertNotEqual(updated_total_in_words, prev_total_in_words)
|
||||
|
||||
def test_update_child_removing_item(self):
|
||||
so = make_sales_order(**{
|
||||
"item_list": [{
|
||||
"item_code": '_Test Item',
|
||||
@@ -382,7 +391,7 @@ class TestSalesOrder(unittest.TestCase):
|
||||
self.assertEqual(so.status, 'To Deliver and Bill')
|
||||
|
||||
|
||||
def test_update_child_qty_rate(self):
|
||||
def test_update_child(self):
|
||||
so = make_sales_order(item_code= "_Test Item", qty=4)
|
||||
create_dn_against_so(so.name, 4)
|
||||
make_sales_invoice(so.name)
|
||||
@@ -419,7 +428,7 @@ class TestSalesOrder(unittest.TestCase):
|
||||
self.assertEqual(so.items[0].rate, 200.34669)
|
||||
make_property_setter("Sales Order Item", "rate", "precision", precision, "Currency")
|
||||
|
||||
def test_update_child_qty_rate_perm(self):
|
||||
def test_update_child_perm(self):
|
||||
so = make_sales_order(item_code= "_Test Item", qty=4)
|
||||
|
||||
user = 'test@example.com'
|
||||
@@ -472,7 +481,7 @@ class TestSalesOrder(unittest.TestCase):
|
||||
workflow.is_active = 0
|
||||
workflow.save()
|
||||
|
||||
def test_update_child_qty_rate_product_bundle(self):
|
||||
def test_update_child_product_bundle(self):
|
||||
# test Update Items with product bundle
|
||||
if not frappe.db.exists("Item", "_Product Bundle Item"):
|
||||
bundle_item = make_item("_Product Bundle Item", {"is_stock_item": 0})
|
||||
@@ -492,6 +501,20 @@ class TestSalesOrder(unittest.TestCase):
|
||||
so.reload()
|
||||
self.assertEqual(so.packed_items[0].qty, 4)
|
||||
|
||||
# test uom and conversion factor change
|
||||
update_uom_conv_factor = json.dumps([{
|
||||
'item_code': so.get("items")[0].item_code,
|
||||
'rate': so.get("items")[0].rate,
|
||||
'qty': so.get("items")[0].qty,
|
||||
'uom': "_Test UOM 1",
|
||||
'conversion_factor': 2,
|
||||
'docname': so.get("items")[0].name
|
||||
}])
|
||||
update_child_qty_rate('Sales Order', update_uom_conv_factor, so.name)
|
||||
|
||||
so.reload()
|
||||
self.assertEqual(so.packed_items[0].qty, 8)
|
||||
|
||||
def test_update_child_with_tax_template(self):
|
||||
"""
|
||||
Test Action: Create a SO with one item having its tax account head already in the SO.
|
||||
|
||||
@@ -155,7 +155,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
var me = this;
|
||||
if (this.frm.doc.customer) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.loyalty_program.loyalty_program.get_loyalty_program_details",
|
||||
method: "erpnext.accounts.doctype.loyalty_program.loyalty_program.get_loyalty_program_details_with_points",
|
||||
args: {
|
||||
"customer": me.frm.doc.customer,
|
||||
"expiry_date": me.frm.doc.posting_date,
|
||||
|
||||
@@ -10,8 +10,8 @@ from frappe.utils.nestedset import get_descendants_of
|
||||
def execute(filters=None):
|
||||
filters = frappe._dict(filters or {})
|
||||
if filters.from_date > filters.to_date:
|
||||
frappe.throw(_('From Date cannot be greater than To Date'))
|
||||
|
||||
frappe.throw(_("From Date cannot be greater than To Date"))
|
||||
|
||||
columns = get_columns(filters)
|
||||
data = get_data(filters)
|
||||
return columns, data
|
||||
@@ -145,14 +145,16 @@ def get_data(filters):
|
||||
company_list.append(filters.get("company"))
|
||||
|
||||
customer_details = get_customer_details()
|
||||
item_details = get_item_details()
|
||||
sales_order_records = get_sales_order_details(company_list, filters)
|
||||
|
||||
for record in sales_order_records:
|
||||
customer_record = customer_details.get(record.customer)
|
||||
item_record = item_details.get(record.item_code)
|
||||
row = {
|
||||
"item_code": record.item_code,
|
||||
"item_name": record.item_name,
|
||||
"item_group": record.item_group,
|
||||
"item_name": item_record.item_name,
|
||||
"item_group": item_record.item_group,
|
||||
"description": record.description,
|
||||
"quantity": record.qty,
|
||||
"uom": record.uom,
|
||||
@@ -187,8 +189,8 @@ def get_conditions(filters):
|
||||
return conditions
|
||||
|
||||
def get_customer_details():
|
||||
details = frappe.get_all('Customer',
|
||||
fields=['name', 'customer_name', "customer_group"])
|
||||
details = frappe.get_all("Customer",
|
||||
fields=["name", "customer_name", "customer_group"])
|
||||
customer_details = {}
|
||||
for d in details:
|
||||
customer_details.setdefault(d.name, frappe._dict({
|
||||
@@ -197,15 +199,25 @@ def get_customer_details():
|
||||
}))
|
||||
return customer_details
|
||||
|
||||
def get_item_details():
|
||||
details = frappe.db.get_all("Item",
|
||||
fields=["item_code", "item_name", "item_group"])
|
||||
item_details = {}
|
||||
for d in details:
|
||||
item_details.setdefault(d.item_code, frappe._dict({
|
||||
"item_name": d.item_name,
|
||||
"item_group": d.item_group
|
||||
}))
|
||||
return item_details
|
||||
|
||||
def get_sales_order_details(company_list, filters):
|
||||
conditions = get_conditions(filters)
|
||||
|
||||
return frappe.db.sql("""
|
||||
SELECT
|
||||
so_item.item_code, so_item.item_name, so_item.item_group,
|
||||
so_item.description, so_item.qty, so_item.uom,
|
||||
so_item.base_rate, so_item.base_amount, so.name,
|
||||
so.transaction_date, so.customer, so.territory,
|
||||
so_item.item_code, so_item.description, so_item.qty,
|
||||
so_item.uom, so_item.base_rate, so_item.base_amount,
|
||||
so.name, so.transaction_date, so.customer,so.territory,
|
||||
so.project, so_item.delivered_qty,
|
||||
so_item.billed_amt, so.company
|
||||
FROM
|
||||
|
||||
@@ -26,7 +26,8 @@ def delete_company_transactions(company_name):
|
||||
tabDocField where fieldtype='Link' and options='Company'"""):
|
||||
if doctype not in ("Account", "Cost Center", "Warehouse", "Budget",
|
||||
"Party Account", "Employee", "Sales Taxes and Charges Template",
|
||||
"Purchase Taxes and Charges Template", "POS Profile", 'BOM'):
|
||||
"Purchase Taxes and Charges Template", "POS Profile", 'BOM',
|
||||
"Item default", "Customer", "Supplier"):
|
||||
delete_for_doctype(doctype, company_name)
|
||||
|
||||
# reset company values
|
||||
|
||||
@@ -427,6 +427,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
"basic_rate": 1.0
|
||||
})
|
||||
se_doc.get("items")[1].update({
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"qty": 3.0,
|
||||
"transfer_qty": 3.0,
|
||||
"s_warehouse": "_Test Warehouse 1 - _TC",
|
||||
@@ -537,7 +538,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
|
||||
mr = make_material_request(item_code='_Test FG Item', material_request_type='Manufacture',
|
||||
uom="_Test UOM 1", conversion_factor=12)
|
||||
|
||||
|
||||
requested_qty = self._get_requested_qty('_Test FG Item', '_Test Warehouse - _TC')
|
||||
|
||||
self.assertEqual(requested_qty, existing_requested_qty + 120)
|
||||
|
||||
@@ -52,10 +52,24 @@ class QualityInspection(Document):
|
||||
doctype = 'Stock Entry Detail'
|
||||
|
||||
if self.reference_type and self.reference_name:
|
||||
frappe.db.sql("""update `tab{child_doc}` t1, `tab{parent_doc}` t2
|
||||
set t1.quality_inspection = %s, t2.modified = %s
|
||||
where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name"""
|
||||
.format(parent_doc=self.reference_type, child_doc=doctype),
|
||||
conditions = ""
|
||||
if self.batch_no and self.docstatus == 1:
|
||||
conditions += " and t1.batch_no = '%s'"%(self.batch_no)
|
||||
|
||||
if self.docstatus == 2: # if cancel, then remove qi link wherever same name
|
||||
conditions += " and t1.quality_inspection = '%s'"%(self.name)
|
||||
|
||||
frappe.db.sql("""
|
||||
UPDATE
|
||||
`tab{child_doc}` t1, `tab{parent_doc}` t2
|
||||
SET
|
||||
t1.quality_inspection = %s, t2.modified = %s
|
||||
WHERE
|
||||
t1.parent = %s
|
||||
and t1.item_code = %s
|
||||
and t1.parent = t2.name
|
||||
{conditions}
|
||||
""".format(parent_doc=self.reference_type, child_doc=doctype, conditions=conditions),
|
||||
(quality_inspection, self.modified, self.reference_name, self.item_code))
|
||||
|
||||
@frappe.whitelist()
|
||||
|
||||
@@ -488,6 +488,8 @@ class StockEntry(StockController):
|
||||
|
||||
if self.purpose in ["Manufacture", "Repack"]:
|
||||
for d in self.get("items"):
|
||||
if d.set_basic_rate_manually: continue
|
||||
|
||||
if (d.transfer_qty and (d.bom_no or d.t_warehouse)
|
||||
and (getattr(self, "pro_doc", frappe._dict()).scrap_warehouse != d.t_warehouse)):
|
||||
|
||||
@@ -499,7 +501,7 @@ class StockEntry(StockController):
|
||||
if raw_material_cost and self.purpose == "Manufacture":
|
||||
d.basic_rate = flt((raw_material_cost - scrap_material_cost) / flt(d.transfer_qty), d.precision("basic_rate"))
|
||||
d.basic_amount = flt((raw_material_cost - scrap_material_cost), d.precision("basic_amount"))
|
||||
elif self.purpose == "Repack" and total_fg_qty and not d.set_basic_rate_manually:
|
||||
elif self.purpose == "Repack" and total_fg_qty:
|
||||
d.basic_rate = flt(raw_material_cost) / flt(total_fg_qty)
|
||||
d.basic_amount = d.basic_rate * flt(d.qty)
|
||||
|
||||
@@ -1010,7 +1012,7 @@ class StockEntry(StockController):
|
||||
wo = frappe.get_doc("Work Order", self.work_order)
|
||||
wo_items = frappe.get_all('Work Order Item',
|
||||
filters={'parent': self.work_order},
|
||||
fields=["item_code", "required_qty", "consumed_qty", "transferred_qty"]
|
||||
fields=["item_code", "required_qty", "consumed_qty", "transferred_qty", "source_warehouse"]
|
||||
)
|
||||
|
||||
work_order_qty = wo.material_transferred_for_manufacturing or wo.qty
|
||||
@@ -1028,9 +1030,13 @@ class StockEntry(StockController):
|
||||
qty = req_qty_each * flt(self.fg_completed_qty)
|
||||
|
||||
if qty > 0:
|
||||
from_warehouse = wo.wip_warehouse
|
||||
if wo.skip_transfer and not wo.from_wip_warehouse:
|
||||
from_warehouse = item.source_warehouse
|
||||
|
||||
self.add_to_stock_entry_detail({
|
||||
item.item_code: {
|
||||
"from_warehouse": wo.wip_warehouse,
|
||||
"from_warehouse": from_warehouse,
|
||||
"to_warehouse": "",
|
||||
"qty": qty,
|
||||
"item_name": item.item_name,
|
||||
@@ -1109,7 +1115,10 @@ class StockEntry(StockController):
|
||||
else:
|
||||
qty = (req_qty_each * flt(self.fg_completed_qty)) - remaining_qty
|
||||
else:
|
||||
qty = req_qty_each * flt(self.fg_completed_qty)
|
||||
if self.flags.backflush_based_on == "Material Transferred for Manufacture":
|
||||
qty = (item.qty/trans_qty) * flt(self.fg_completed_qty)
|
||||
else:
|
||||
qty = req_qty_each * flt(self.fg_completed_qty)
|
||||
|
||||
elif backflushed_materials.get(item.item_code):
|
||||
for d in backflushed_materials.get(item.item_code):
|
||||
@@ -1117,7 +1126,8 @@ class StockEntry(StockController):
|
||||
if (qty > req_qty):
|
||||
qty = (qty/trans_qty) * flt(self.fg_completed_qty)
|
||||
|
||||
if consumed_qty:
|
||||
if consumed_qty and frappe.db.get_single_value("Manufacturing Settings",
|
||||
"material_consumption"):
|
||||
qty -= consumed_qty
|
||||
|
||||
if cint(frappe.get_cached_value('UOM', item.stock_uom, 'must_be_whole_number')):
|
||||
@@ -1241,9 +1251,8 @@ class StockEntry(StockController):
|
||||
mreq_item = frappe.db.get_value("Material Request Item",
|
||||
{"name": item.material_request_item, "parent": item.material_request},
|
||||
["item_code", "warehouse", "idx"], as_dict=True)
|
||||
if mreq_item.item_code != item.item_code or \
|
||||
mreq_item.warehouse != (item.s_warehouse if self.purpose== "Material Issue" else item.t_warehouse):
|
||||
frappe.throw(_("Item or Warehouse for row {0} does not match Material Request").format(item.idx),
|
||||
if mreq_item.item_code != item.item_code:
|
||||
frappe.throw(_("Item for row {0} does not match Material Request").format(item.idx),
|
||||
frappe.MappingMismatchError)
|
||||
|
||||
def validate_batch(self):
|
||||
|
||||
@@ -494,7 +494,7 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:parent.purpose===\"Repack\" && doc.t_warehouse",
|
||||
"depends_on": "eval:in_list([\"Repack\", \"Manufacture\"], parent.purpose) && doc.t_warehouse",
|
||||
"fieldname": "set_basic_rate_manually",
|
||||
"fieldtype": "Check",
|
||||
"label": "Set Basic Rate Manually"
|
||||
@@ -502,7 +502,7 @@
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2020-09-04 12:12:35.668198",
|
||||
"modified": "2021-01-05 15:05:04.891447",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Entry Detail",
|
||||
|
||||
@@ -25,10 +25,11 @@ class StockLedgerEntry(Document):
|
||||
|
||||
def validate(self):
|
||||
self.flags.ignore_submit_comment = True
|
||||
from erpnext.stock.utils import validate_warehouse_company
|
||||
from erpnext.stock.utils import validate_warehouse_company, validate_disabled_warehouse
|
||||
self.validate_mandatory()
|
||||
self.validate_item()
|
||||
self.validate_batch()
|
||||
validate_disabled_warehouse(self.warehouse)
|
||||
validate_warehouse_company(self.warehouse, self.company)
|
||||
self.scrub_posting_time()
|
||||
self.validate_and_set_fiscal_year()
|
||||
|
||||
@@ -216,7 +216,7 @@ class StockReconciliation(StockController):
|
||||
if row.qty and not row.valuation_rate:
|
||||
frappe.throw(_("Valuation Rate required for Item {0} at row {1}").format(row.item_code, row.idx))
|
||||
|
||||
if ((previous_sle and row.qty == previous_sle.get("qty_after_transaction")
|
||||
if (not item.has_batch_no and (previous_sle and row.qty == previous_sle.get("qty_after_transaction")
|
||||
and (row.valuation_rate == previous_sle.get("valuation_rate") or row.qty == 0))
|
||||
or (not previous_sle and not row.qty)):
|
||||
continue
|
||||
|
||||
@@ -72,7 +72,9 @@ def get_item_details(args, doc=None, for_validate=False, overwrite_warehouse=Tru
|
||||
|
||||
update_party_blanket_order(args, out)
|
||||
|
||||
get_price_list_rate(args, item, out)
|
||||
if not doc or cint(doc.get('is_return')) == 0:
|
||||
# get price list rate only if the invoice is not a credit or debit note
|
||||
get_price_list_rate(args, item, out)
|
||||
|
||||
if args.customer and cint(args.is_pos):
|
||||
out.update(get_pos_profile_item_details(args.company, args))
|
||||
|
||||
@@ -61,9 +61,11 @@ frappe.query_reports["Batch-Wise Balance History"] = {
|
||||
"options": "Batch",
|
||||
"get_query": function() {
|
||||
let item_code = frappe.query_report.get_filter_value('item_code');
|
||||
return {
|
||||
filters: {
|
||||
"item": item_code
|
||||
if (item_code) {
|
||||
return {
|
||||
filters: {
|
||||
"item": item_code
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,8 @@ def get_stock_ledger_entries(filters):
|
||||
from `tabItem` {item_conditions}) item
|
||||
where item_code = item.name and
|
||||
company = %(company)s and
|
||||
posting_date <= %(to_date)s
|
||||
posting_date <= %(to_date)s and
|
||||
is_cancelled != 1
|
||||
{sle_conditions}
|
||||
order by posting_date, posting_time, sle.creation, actual_qty""" #nosec
|
||||
.format(item_conditions=get_item_conditions(filters),
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
from frappe import _
|
||||
import json
|
||||
from frappe.utils import flt, cstr, nowdate, nowtime
|
||||
from frappe.utils import flt, cstr, nowdate, nowtime, get_link_to_form
|
||||
|
||||
from six import string_types
|
||||
|
||||
@@ -279,6 +279,10 @@ def is_group_warehouse(warehouse):
|
||||
if frappe.db.get_value("Warehouse", warehouse, "is_group"):
|
||||
frappe.throw(_("Group node warehouse is not allowed to select for transactions"))
|
||||
|
||||
def validate_disabled_warehouse(warehouse):
|
||||
if frappe.db.get_value("Warehouse", warehouse, "disabled"):
|
||||
frappe.throw(_("Disabled Warehouse {0} cannot be used for this transaction.").format(get_link_to_form('Warehouse', warehouse)))
|
||||
|
||||
def update_included_uom_in_report(columns, result, include_uom, conversion_factors):
|
||||
if not include_uom or not conversion_factors:
|
||||
return
|
||||
|
||||
@@ -3,9 +3,9 @@ frappe
|
||||
gocardless-pro==1.11.0
|
||||
googlemaps==3.1.1
|
||||
pandas==0.24.2
|
||||
plaid-python==6.0.0
|
||||
plaid-python>=7.0.0
|
||||
PyGithub==1.44.1
|
||||
python-stdnum==1.12
|
||||
Unidecode==1.1.1
|
||||
WooCommerce==2.1.1
|
||||
pycryptodome==3.9.8
|
||||
pycryptodome==3.9.8
|
||||
|
||||
Reference in New Issue
Block a user