Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b4b31fdf7 | ||
|
|
ec25117ab0 | ||
|
|
dfa013e73f | ||
|
|
f2791f8898 | ||
|
|
66773229a4 | ||
|
|
ead48094b6 | ||
|
|
d6822ddd7c | ||
|
|
4944fb33ce | ||
|
|
845f1c636e | ||
|
|
98dbccd1d6 | ||
|
|
7346ff3d08 | ||
|
|
21761c204c | ||
|
|
87f3ba139e | ||
|
|
11498cac94 | ||
|
|
7a31f6aaca | ||
|
|
7d5a2390dd | ||
|
|
081c3ec476 | ||
|
|
e2f054cc27 | ||
|
|
7e98eb3ab7 | ||
|
|
8462f4ad2c | ||
|
|
add4c96280 | ||
|
|
45b5da0826 | ||
|
|
dc24d0151c | ||
|
|
c452b4b7cc | ||
|
|
335763da49 | ||
|
|
5bd8cfd9fe | ||
|
|
2ed025e62d | ||
|
|
836f9f34e4 | ||
|
|
98a8fae7c2 | ||
|
|
690f8b9323 | ||
|
|
79ffc2b3a7 | ||
|
|
13b3b070e3 | ||
|
|
2878cc7757 | ||
|
|
d57e793bf3 | ||
|
|
4d32afde30 | ||
|
|
ad3fd5166b | ||
|
|
010657145d | ||
|
|
973f78e7d3 | ||
|
|
5aa465ae44 | ||
|
|
28777bf693 | ||
|
|
2fbafab4b2 | ||
|
|
b09ed41c52 | ||
|
|
cdba583a25 | ||
|
|
2d916436c5 | ||
|
|
7ee9e9d06b | ||
|
|
b72abbc402 | ||
|
|
ce7b238e88 | ||
|
|
f082b3d8a1 | ||
|
|
eda4265dbc | ||
|
|
a9eae0b424 | ||
|
|
c3fc490d53 | ||
|
|
108e935744 | ||
|
|
eac82039e3 | ||
|
|
e0a8f2d859 | ||
|
|
fcca772383 | ||
|
|
c5fb88c1cd | ||
|
|
aacb0a702e | ||
|
|
f3a9d788bf | ||
|
|
6203cf7f04 | ||
|
|
4ec5d5594b | ||
|
|
a3cb828ed3 | ||
|
|
5e13e0c316 | ||
|
|
bfeb7c4a57 | ||
|
|
43f627a83a | ||
|
|
d0b3a3734e | ||
|
|
94365fa035 | ||
|
|
e0ce9407cb | ||
|
|
dea3fb0d64 | ||
|
|
1dae1c40b9 | ||
|
|
fd654a06e8 | ||
|
|
5bf1f89da7 | ||
|
|
b6c8c7436f | ||
|
|
1dc8ff5220 | ||
|
|
06d81822fd | ||
|
|
0c883500bb | ||
|
|
4ce020f521 | ||
|
|
11cb9de10a | ||
|
|
f9b63dd36a | ||
|
|
282695f536 | ||
|
|
809abdf295 | ||
|
|
79dc136d50 |
@@ -1 +1,2 @@
|
||||
__version__ = '4.20.2'
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '4.24.1'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
test_records = frappe.get_test_records('Budget Distribution')
|
||||
test_records = frappe.get_test_records('Budget Distribution')
|
||||
|
||||
@@ -18,17 +18,17 @@ class CForm(Document):
|
||||
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
|
||||
|
||||
if inv and inv[0][0] != 'Yes':
|
||||
frappe.throw("C-form is not applicable for Invoice: %s" % d.invoice_no)
|
||||
frappe.throw("C-form is not applicable for Invoice: {0}".format(d.invoice_no))
|
||||
|
||||
elif inv and inv[0][1] and inv[0][1] != self.name:
|
||||
frappe.throw("""Invoice %s is tagged in another C-form: %s.
|
||||
frappe.throw("""Invoice {0} is tagged in another C-form: {1}.
|
||||
If you want to change C-form no for this invoice,
|
||||
please remove invoice no from the previous c-form and then try again""" %
|
||||
(d.invoice_no, inv[0][1]))
|
||||
please remove invoice no from the previous c-form and then try again"""\
|
||||
.format(d.invoice_no, inv[0][1]))
|
||||
|
||||
elif not inv:
|
||||
frappe.throw("Row %s: Invoice %s is invalid, it might be cancelled / does not exist. \
|
||||
Please enter a valid Invoice" % d.idx, d.invoice_no)
|
||||
frappe.throw("Row {0}: Invoice {1} is invalid, it might be cancelled / does not exist. \
|
||||
Please enter a valid Invoice".format(d.idx, d.invoice_no))
|
||||
|
||||
def on_update(self):
|
||||
""" Update C-Form No on invoices"""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
account_properties = {
|
||||
"Deutscher Kontenplan SKR03": {
|
||||
"Bilanzkonten": {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -405,12 +405,12 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
# Hence the first condition is an "OR"
|
||||
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.report_type = "Profit and Loss"
|
||||
or tabAccount.account_type = "Expense Account")
|
||||
or tabAccount.account_type in ("Expense Account", "Fixed Asset"))
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
|
||||
and tabAccount.company = %(company)s
|
||||
and tabAccount.{key} LIKE %(txt)s
|
||||
{mcond}""".format(key=searchfield, mcond=get_match_cond(doctype)),
|
||||
{'company': filters['company'], 'txt': "%%{0}%%".format(txt)})
|
||||
|
||||
@@ -244,7 +244,7 @@ cur_frm.cscript.hide_fields = function(doc) {
|
||||
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, true);
|
||||
}
|
||||
|
||||
item_flds_stock = ['serial_no', 'batch_no', 'actual_qty', 'expense_account', 'warehouse']
|
||||
item_flds_stock = ['serial_no', 'batch_no', 'actual_qty', 'actual_batch_qty', 'expense_account', 'warehouse']
|
||||
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_stock,
|
||||
(cint(doc.update_stock)==1 ? true : false));
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
if cint(self.update_stock):
|
||||
self.validate_item_code()
|
||||
self.validate_warehouse()
|
||||
self.update_current_stock()
|
||||
self.validate_delivery_note()
|
||||
|
||||
@@ -350,6 +351,11 @@ class SalesInvoice(SellingController):
|
||||
if not d.item_code:
|
||||
msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
|
||||
|
||||
def validate_warehouse(self):
|
||||
for d in self.get('entries'):
|
||||
if not d.warehouse:
|
||||
frappe.throw(_("Warehouse required at Row No {0}").format(d.idx))
|
||||
|
||||
def validate_delivery_note(self):
|
||||
for d in self.get("entries"):
|
||||
if d.delivery_note:
|
||||
@@ -605,11 +611,10 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
|
||||
|
||||
and tabAccount.company = %(company)s
|
||||
and tabAccount.{key} LIKE %(txt)s
|
||||
{mcond}""".format(key=searchfield, mcond=get_match_cond(doctype)),
|
||||
{'company': filters['company'], 'txt': "%%{0}%%".format(txt)})
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_delivery_note(source_name, target_doc=None):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest, json, copy
|
||||
|
||||
@@ -339,6 +339,19 @@
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"fieldname": "actual_batch_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Available Batch Qty at Warehouse",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"fieldname": "actual_qty",
|
||||
@@ -439,7 +452,7 @@
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2014-09-09 05:35:36.019576",
|
||||
"modified": "2015-03-10 14:56:45.641026",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Item",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -161,7 +161,8 @@ def add_total_row(out, balance_must_be, period_list):
|
||||
def get_accounts(company, root_type):
|
||||
# root lft, rgt
|
||||
root_account = frappe.db.sql("""select lft, rgt from `tabAccount`
|
||||
where company=%s and root_type=%s order by lft limit 1""",
|
||||
where company=%s and root_type=%s and ifnull(parent_account, '') = ''
|
||||
order by lft limit 1""",
|
||||
(company, root_type), as_dict=True)
|
||||
|
||||
if not root_account:
|
||||
|
||||
@@ -10,40 +10,40 @@ def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
columns = get_columns()
|
||||
last_col = len(columns)
|
||||
|
||||
|
||||
item_list = get_items(filters)
|
||||
aii_account_map = get_aii_accounts()
|
||||
if item_list:
|
||||
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
|
||||
|
||||
|
||||
data = []
|
||||
for d in item_list:
|
||||
expense_account = d.expense_account or aii_account_map.get(d.company)
|
||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
|
||||
d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order,
|
||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
|
||||
d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order,
|
||||
d.purchase_receipt, expense_account, d.qty, d.base_rate, d.base_amount]
|
||||
for tax in tax_accounts:
|
||||
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
|
||||
|
||||
total_tax = sum(row[last_col:])
|
||||
row += [total_tax, d.base_amount + total_tax]
|
||||
|
||||
|
||||
data.append(row)
|
||||
|
||||
|
||||
return columns, data
|
||||
|
||||
|
||||
|
||||
|
||||
def get_columns():
|
||||
return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
|
||||
_("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier") + ":Link/Customer:120",
|
||||
_("Supplier Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
|
||||
_("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100",
|
||||
_("Expense Account") + ":Link/Account:140", _("Qty") + ":Float:120", _("Rate") + ":Currency:120",
|
||||
return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
|
||||
_("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier") + ":Link/Customer:120",
|
||||
_("Supplier Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
|
||||
_("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100",
|
||||
_("Expense Account") + ":Link/Account:140", _("Qty") + ":Float:120", _("Rate") + ":Currency:120",
|
||||
_("Amount") + ":Currency:120"]
|
||||
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
|
||||
|
||||
for opts in (("company", " and company=%(company)s"),
|
||||
("account", " and pi.credit_to = %(account)s"),
|
||||
("item_code", " and pi_item.item_code = %(item_code)s"),
|
||||
@@ -53,48 +53,56 @@ def get_conditions(filters):
|
||||
conditions += opts[1]
|
||||
|
||||
return conditions
|
||||
|
||||
|
||||
def get_items(filters):
|
||||
conditions = get_conditions(filters)
|
||||
match_conditions = frappe.build_match_conditions("Purchase Invoice")
|
||||
|
||||
return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
|
||||
pi.supplier, pi.remarks, pi_item.item_code, pi_item.item_name, pi_item.item_group,
|
||||
pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt,
|
||||
|
||||
return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
|
||||
pi.supplier, pi.remarks, pi.net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group,
|
||||
pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt,
|
||||
pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name
|
||||
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
|
||||
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
|
||||
where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
|
||||
order by pi.posting_date desc, pi_item.item_code desc""" % (conditions, match_conditions), filters, as_dict=1)
|
||||
|
||||
|
||||
def get_aii_accounts():
|
||||
return dict(frappe.db.sql("select name, stock_received_but_not_billed from tabCompany"))
|
||||
|
||||
|
||||
def get_tax_accounts(item_list, columns):
|
||||
import json
|
||||
item_tax = {}
|
||||
tax_accounts = []
|
||||
|
||||
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail
|
||||
from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
|
||||
and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
|
||||
and parent in (%s)""" % ', '.join(['%s']*len(item_list)), tuple([item.parent for item in item_list]))
|
||||
|
||||
for parent, account_head, item_wise_tax_detail in tax_details:
|
||||
|
||||
invoice_wise_items = {}
|
||||
for d in item_list:
|
||||
invoice_wise_items.setdefault(d.parent, []).append(d)
|
||||
|
||||
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
|
||||
from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
|
||||
and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
|
||||
and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)), tuple(invoice_wise_items.keys()))
|
||||
|
||||
for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
|
||||
if account_head not in tax_accounts:
|
||||
tax_accounts.append(account_head)
|
||||
|
||||
|
||||
if item_wise_tax_detail:
|
||||
try:
|
||||
item_wise_tax_detail = json.loads(item_wise_tax_detail)
|
||||
for item, tax_amount in item_wise_tax_detail.items():
|
||||
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
|
||||
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
|
||||
|
||||
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
elif charge_type == "Actual" and tax_amount:
|
||||
for d in invoice_wise_items.get(parent, []):
|
||||
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
|
||||
(tax_amount * d.base_amount) / d.net_total
|
||||
|
||||
tax_accounts.sort()
|
||||
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
|
||||
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
|
||||
|
||||
return item_tax, tax_accounts
|
||||
return item_tax, tax_accounts
|
||||
|
||||
@@ -14,36 +14,36 @@ def execute(filters=None):
|
||||
item_list = get_items(filters)
|
||||
if item_list:
|
||||
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
|
||||
|
||||
|
||||
data = []
|
||||
for d in item_list:
|
||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
|
||||
d.customer_name, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,
|
||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
|
||||
d.customer_name, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,
|
||||
d.delivery_note, d.income_account, d.qty, d.base_rate, d.base_amount]
|
||||
|
||||
|
||||
for tax in tax_accounts:
|
||||
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
|
||||
|
||||
total_tax = sum(row[last_col:])
|
||||
row += [total_tax, d.base_amount + total_tax]
|
||||
|
||||
|
||||
data.append(row)
|
||||
|
||||
|
||||
return columns, data
|
||||
|
||||
|
||||
def get_columns():
|
||||
return [
|
||||
_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
|
||||
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
|
||||
_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
|
||||
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
|
||||
_("Customer Account") + ":Link/Account:120", _("Territory") + ":Link/Territory:80",
|
||||
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100",
|
||||
_("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140",
|
||||
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100",
|
||||
_("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140",
|
||||
_("Qty") + ":Float:120", _("Rate") + ":Currency:120", _("Amount") + ":Currency:120"
|
||||
]
|
||||
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
|
||||
|
||||
for opts in (("company", " and company=%(company)s"),
|
||||
("account", " and si.debit_to = %(account)s"),
|
||||
("item_code", " and si_item.item_code = %(item_code)s"),
|
||||
@@ -53,32 +53,36 @@ def get_conditions(filters):
|
||||
conditions += opts[1]
|
||||
|
||||
return conditions
|
||||
|
||||
|
||||
def get_items(filters):
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
|
||||
si.customer, si.remarks, si.territory, si.company, si_item.item_code, si_item.item_name,
|
||||
si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
|
||||
return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
|
||||
si.customer, si.remarks, si.territory, si.company, si.net_total, si_item.item_code, si_item.item_name,
|
||||
si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
|
||||
si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name
|
||||
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
|
||||
where si.name = si_item.parent and si.docstatus = 1 %s
|
||||
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
|
||||
where si.name = si_item.parent and si.docstatus = 1 %s
|
||||
order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)
|
||||
|
||||
|
||||
def get_tax_accounts(item_list, columns):
|
||||
import json
|
||||
item_tax = {}
|
||||
tax_accounts = []
|
||||
|
||||
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail
|
||||
from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
|
||||
|
||||
invoice_wise_items = {}
|
||||
for d in item_list:
|
||||
invoice_wise_items.setdefault(d.parent, []).append(d)
|
||||
|
||||
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
|
||||
from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
|
||||
and docstatus = 1 and ifnull(account_head, '') != ''
|
||||
and parent in (%s)""" % ', '.join(['%s']*len(item_list)),
|
||||
tuple([item.parent for item in item_list]))
|
||||
|
||||
for parent, account_head, item_wise_tax_detail in tax_details:
|
||||
and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)),
|
||||
tuple(invoice_wise_items.keys()))
|
||||
|
||||
for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
|
||||
if account_head not in tax_accounts:
|
||||
tax_accounts.append(account_head)
|
||||
|
||||
|
||||
if item_wise_tax_detail:
|
||||
try:
|
||||
item_wise_tax_detail = json.loads(item_wise_tax_detail)
|
||||
@@ -87,9 +91,13 @@ def get_tax_accounts(item_list, columns):
|
||||
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
elif charge_type == "Actual" and tax_amount:
|
||||
for d in invoice_wise_items.get(parent, []):
|
||||
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
|
||||
flt((tax_amount * d.base_amount) / d.net_total)
|
||||
|
||||
tax_accounts.sort()
|
||||
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
|
||||
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
|
||||
|
||||
return item_tax, tax_accounts
|
||||
return item_tax, tax_accounts
|
||||
|
||||
@@ -209,26 +209,17 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
|
||||
calculate_totals: function() {
|
||||
var tax_count = this.frm.tax_doclist.length;
|
||||
this.frm.doc.grand_total = flt(tax_count ?
|
||||
this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
|
||||
this.frm.doc.grand_total_import = flt(tax_count ?
|
||||
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
|
||||
this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
|
||||
|
||||
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
||||
precision("total_tax"));
|
||||
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax"));
|
||||
|
||||
this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
|
||||
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
|
||||
|
||||
// rounded totals
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
|
||||
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
||||
}
|
||||
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
|
||||
this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
|
||||
}
|
||||
|
||||
// other charges added/deducted
|
||||
this.frm.doc.other_charges_added = 0.0
|
||||
this.frm.doc.other_charges_deducted = 0.0
|
||||
@@ -246,6 +237,16 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
frappe.model.round_floats_in(this.frm.doc,
|
||||
["other_charges_added", "other_charges_deducted"]);
|
||||
}
|
||||
|
||||
this.frm.doc.grand_total_import = flt((this.frm.doc.other_charges_added || this.frm.doc.other_charges_deducted) ?
|
||||
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
|
||||
|
||||
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
|
||||
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
|
||||
this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
|
||||
}
|
||||
|
||||
this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added /
|
||||
this.frm.doc.conversion_rate, precision("other_charges_added_import"));
|
||||
this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted /
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
from frappe.widgets.moduleview import add_setup_section
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -112,6 +112,8 @@ class AccountsController(TransactionBase):
|
||||
if item.get("item_code"):
|
||||
args = parent_dict.copy()
|
||||
args.update(item.as_dict())
|
||||
if not args.get("transaction_date"):
|
||||
args["transaction_date"] = args.get("posting_date")
|
||||
ret = get_item_details(args)
|
||||
|
||||
for fieldname, value in ret.items():
|
||||
@@ -183,6 +185,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
self.calculate_net_total()
|
||||
self.calculate_taxes()
|
||||
self.manipulate_grand_total_for_inclusive_tax()
|
||||
self.calculate_totals()
|
||||
self._cleanup()
|
||||
|
||||
@@ -351,6 +354,22 @@ class AccountsController(TransactionBase):
|
||||
self.precision(base_field, item))
|
||||
item.set(base_field, value_in_company_currency)
|
||||
|
||||
def manipulate_grand_total_for_inclusive_tax(self):
|
||||
# if fully inclusive taxes and diff
|
||||
if (self.meta.get_field("net_total_export") and self.tax_doclist
|
||||
and all(cint(t.included_in_print_rate) for t in self.tax_doclist)):
|
||||
|
||||
last_tax = self.tax_doclist[-1]
|
||||
|
||||
diff = self.net_total_export - flt(last_tax.total / self.conversion_rate,
|
||||
self.precision("grand_total_export"))
|
||||
|
||||
if diff and abs(diff) <= (2.0 / 10**(self.precision("tax_amount", last_tax))):
|
||||
adjustment_amount = flt(diff * self.conversion_rate, self.precision("tax_amount", last_tax))
|
||||
last_tax.tax_amount += adjustment_amount
|
||||
last_tax.tax_amount_after_discount_amount += adjustment_amount
|
||||
last_tax.total += adjustment_amount
|
||||
|
||||
def calculate_total_advance(self, parenttype, advance_parentfield):
|
||||
if self.doctype == parenttype and self.docstatus < 2:
|
||||
sum_of_allocated_amount = sum([flt(adv.allocated_amount, self.precision("allocated_amount", adv))
|
||||
|
||||
@@ -91,8 +91,7 @@ class BuyingController(StockController):
|
||||
item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)),
|
||||
self.precision("rate", item))
|
||||
|
||||
item.amount = flt(item.rate * item.qty,
|
||||
self.precision("amount", item))
|
||||
item.amount = flt(item.rate * item.qty, self.precision("amount", item))
|
||||
item.item_tax_amount = 0.0;
|
||||
|
||||
self._set_in_company_currency(item, "amount", "base_amount")
|
||||
@@ -111,20 +110,14 @@ class BuyingController(StockController):
|
||||
|
||||
def calculate_totals(self):
|
||||
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
|
||||
self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
|
||||
if self.tax_doclist else self.net_total_import
|
||||
|
||||
self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax"))
|
||||
|
||||
self.grand_total = flt(self.grand_total, self.precision("grand_total"))
|
||||
self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
|
||||
|
||||
if self.meta.get_field("rounded_total"):
|
||||
self.rounded_total = rounded(self.grand_total)
|
||||
|
||||
if self.meta.get_field("rounded_total_import"):
|
||||
self.rounded_total_import = rounded(self.grand_total_import)
|
||||
|
||||
if self.meta.get_field("other_charges_added"):
|
||||
self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.tax_doclist
|
||||
if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]),
|
||||
@@ -135,6 +128,14 @@ class BuyingController(StockController):
|
||||
if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]),
|
||||
self.precision("other_charges_deducted"))
|
||||
|
||||
self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
|
||||
if (self.other_charges_added or self.other_charges_deducted) else self.net_total_import
|
||||
|
||||
self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
|
||||
|
||||
if self.meta.get_field("rounded_total_import"):
|
||||
self.rounded_total_import = rounded(self.grand_total_import)
|
||||
|
||||
if self.meta.get_field("other_charges_added_import"):
|
||||
self.other_charges_added_import = flt(self.other_charges_added /
|
||||
self.conversion_rate, self.precision("other_charges_added_import"))
|
||||
|
||||
@@ -218,10 +218,11 @@ class SellingController(StockController):
|
||||
def calculate_totals(self):
|
||||
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
|
||||
|
||||
self.grand_total_export = flt(self.grand_total / self.conversion_rate)
|
||||
|
||||
self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))
|
||||
|
||||
self.grand_total_export = flt(self.grand_total / self.conversion_rate) \
|
||||
if (self.other_charges_total or self.discount_amount) else self.net_total_export
|
||||
|
||||
self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export +
|
||||
flt(self.discount_amount), self.precision("other_charges_total_export"))
|
||||
|
||||
@@ -390,6 +391,7 @@ class SellingController(StockController):
|
||||
'qty': d.qty,
|
||||
'reserved_qty': reserved_qty_for_main_item,
|
||||
'uom': d.stock_uom,
|
||||
'stock_uom': d.stock_uom,
|
||||
'batch_no': cstr(d.get("batch_no")).strip(),
|
||||
'serial_no': cstr(d.get("serial_no")).strip(),
|
||||
'name': d.name
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import frappe.permissions
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from __future__ import unicode_literals
|
||||
app_name = "erpnext"
|
||||
app_title = "ERPNext"
|
||||
app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors"
|
||||
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "4.20.2"
|
||||
app_version = "4.24.1"
|
||||
|
||||
error_report_email = "support@erpnext.com"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
test_ignore = ["Leave Block List"]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
test_records = frappe.get_test_records('Leave Allocation')
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -45,7 +45,7 @@ class SalarySlip(TransactionBase):
|
||||
|
||||
def get_leave_details(self, lwp=None):
|
||||
if not self.fiscal_year:
|
||||
self.fiscal_year = frappe.get_default("fiscal_year")
|
||||
self.fiscal_year = frappe.db.get_default("fiscal_year")
|
||||
if not self.month:
|
||||
self.month = "%02d" % getdate(nowdate()).month
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -27,7 +27,7 @@ class BOM(Document):
|
||||
self.validate_main_item()
|
||||
|
||||
from erpnext.utilities.transaction_base import validate_uom_is_integer
|
||||
validate_uom_is_integer(self, "stock_uom", "qty")
|
||||
validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")
|
||||
|
||||
self.validate_operations()
|
||||
self.validate_materials()
|
||||
@@ -395,30 +395,23 @@ def get_bom_items_as_dict(bom, qty=1, fetch_exploded=1):
|
||||
item.expense_account as expense_account,
|
||||
item.buying_cost_center as cost_center
|
||||
from
|
||||
`tab%(table)s` bom_item, `tabBOM` bom, `tabItem` item
|
||||
`tab{table}` bom_item, `tabBOM` bom, `tabItem` item
|
||||
where
|
||||
bom_item.parent = bom.name
|
||||
and bom_item.docstatus < 2
|
||||
and bom_item.parent = "%(bom)s"
|
||||
and bom_item.parent = %(bom)s
|
||||
and item.name = bom_item.item_code
|
||||
%(conditions)s
|
||||
{conditions}
|
||||
group by item_code, stock_uom"""
|
||||
|
||||
if fetch_exploded:
|
||||
items = frappe.db.sql(query % {
|
||||
"qty": qty,
|
||||
"table": "BOM Explosion Item",
|
||||
"bom": bom,
|
||||
"conditions": """and ifnull(item.is_pro_applicable, 'No') = 'No'
|
||||
and ifnull(item.is_sub_contracted_item, 'No') = 'No' """
|
||||
}, as_dict=True)
|
||||
query = query.format(table="BOM Explosion Item",
|
||||
conditions="""and ifnull(item.is_pro_applicable, 'No') = 'No'
|
||||
and ifnull(item.is_sub_contracted_item, 'No') = 'No' """)
|
||||
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
|
||||
else:
|
||||
items = frappe.db.sql(query % {
|
||||
"qty": qty,
|
||||
"table": "BOM Item",
|
||||
"bom": bom,
|
||||
"conditions": ""
|
||||
}, as_dict=True)
|
||||
query = query.format(table="BOM Item", conditions="")
|
||||
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
|
||||
|
||||
# make unique
|
||||
for item in items:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -93,3 +93,6 @@ erpnext.patches.v4_2.recalculate_bom_costs
|
||||
erpnext.patches.v4_2.discount_amount
|
||||
erpnext.patches.v4_2.update_landed_cost_voucher
|
||||
erpnext.patches.v4_2.set_item_has_batch
|
||||
erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle
|
||||
erpnext.patches.v4_2.repost_reserved_qty
|
||||
erpnext.patches.v4_2.repost_sle_for_si_with_no_warehouse
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import frappe.model
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.templates.pages.style_settings import default_properties
|
||||
|
||||
|
||||
12
erpnext/patches/v4_2/repost_reserved_qty.py
Normal file
12
erpnext/patches/v4_2/repost_reserved_qty.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.utilities.repost_stock import update_bin_qty, get_reserved_qty
|
||||
|
||||
def execute():
|
||||
for item_code, warehouse in frappe.db.sql("select item_code, warehouse from tabBin where ifnull(reserved_qty, 0) < 0"):
|
||||
update_bin_qty(item_code, warehouse, {
|
||||
"reserved_qty": get_reserved_qty(item_code, warehouse)
|
||||
})
|
||||
34
erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py
Normal file
34
erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.stock.stock_ledger import NegativeStockError
|
||||
|
||||
def execute():
|
||||
si_list = frappe.db.sql("""select distinct si.name
|
||||
from `tabSales Invoice Item` si_item, `tabSales Invoice` si
|
||||
where si.name = si_item.parent and si.modified > '2015-02-16' and si.docstatus=1
|
||||
and ifnull(si_item.warehouse, '') = '' and ifnull(si.update_stock, 0) = 1
|
||||
order by posting_date, posting_time""", as_dict=1)
|
||||
|
||||
failed_list = []
|
||||
for si in si_list:
|
||||
try:
|
||||
si_doc = frappe.get_doc("Sales Invoice", si.name)
|
||||
si_doc.docstatus = 2
|
||||
si_doc.on_cancel()
|
||||
|
||||
si_doc.docstatus = 1
|
||||
si_doc.set_missing_item_details()
|
||||
si_doc.on_submit()
|
||||
frappe.db.commit()
|
||||
except:
|
||||
failed_list.append(si.name)
|
||||
frappe.local.stockledger_exceptions = None
|
||||
frappe.db.rollback()
|
||||
|
||||
print "Failed to repost: ", failed_list
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
11
erpnext/patches/v4_2/update_stock_uom_for_dn_in_sle.py
Normal file
11
erpnext/patches/v4_2/update_stock_uom_for_dn_in_sle.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("""update `tabStock Ledger Entry` sle, tabItem item
|
||||
set sle.stock_uom = item.stock_uom
|
||||
where sle.voucher_type="Delivery Note" and item.name = sle.item_code
|
||||
and sle.stock_uom != item.stock_uom""")
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, unittest
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
@@ -148,7 +148,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
order_type: me.frm.doc.order_type,
|
||||
is_pos: cint(me.frm.doc.is_pos),
|
||||
is_subcontracted: me.frm.doc.is_subcontracted,
|
||||
transaction_date: me.frm.doc.transaction_date,
|
||||
transaction_date: me.frm.doc.transaction_date || me.frm.doc.posting_date,
|
||||
ignore_pricing_rule: me.frm.doc.ignore_pricing_rule,
|
||||
doctype: item.doctype,
|
||||
name: item.name,
|
||||
@@ -404,23 +404,27 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
_set_values_for_item_list: function(children) {
|
||||
var me = this;
|
||||
var price_list_rate_changed = false;
|
||||
$.each(children, function(i, d) {
|
||||
for(var i=0, l=children.length; i<l; i++) {
|
||||
var d = children[i];
|
||||
var existing_pricing_rule = frappe.model.get_value(d.doctype, d.name, "pricing_rule");
|
||||
$.each(d, function(k, v) {
|
||||
|
||||
for(var k in d) {
|
||||
var v = d[k];
|
||||
if (["doctype", "name"].indexOf(k)===-1) {
|
||||
if(k=="price_list_rate") {
|
||||
if(flt(v) != flt(d.price_list_rate)) price_list_rate_changed = true;
|
||||
}
|
||||
frappe.model.set_value(d.doctype, d.name, k, v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// if pricing rule set as blank from an existing value, apply price_list
|
||||
if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rule) {
|
||||
me.apply_price_list(frappe.get_doc(d.doctype, d.name));
|
||||
}
|
||||
}
|
||||
|
||||
if(!price_list_rate_changed) me.calculate_taxes_and_totals();
|
||||
});
|
||||
if(!price_list_rate_changed) me.calculate_taxes_and_totals();
|
||||
},
|
||||
|
||||
apply_price_list: function(item) {
|
||||
@@ -628,6 +632,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
this.determine_exclusive_rate && this.determine_exclusive_rate();
|
||||
this.calculate_net_total();
|
||||
this.calculate_taxes();
|
||||
this.manipulate_grand_total_for_inclusive_tax && this.manipulate_grand_total_for_inclusive_tax();
|
||||
this.calculate_totals();
|
||||
this._cleanup();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, json
|
||||
from frappe.utils import flt
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe.utils import flt
|
||||
|
||||
@@ -43,8 +43,8 @@ def get_so_details():
|
||||
|
||||
def get_last_so_amt(customer):
|
||||
res = frappe.db.sql("""select net_total from `tabSales Order`
|
||||
where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc
|
||||
limit 1""" % {'customer':customer})
|
||||
where customer = %(customer)s and docstatus = 1 order by transaction_date desc
|
||||
limit 1""", {'customer':customer})
|
||||
|
||||
return res and res[0][0] or 0
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.139224",
|
||||
"modified": "2015-02-02 11:39:57.231750",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Lead Details",
|
||||
"owner": "Administrator",
|
||||
"query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2), \n\t\ttabAddress.state, tabAddress.pincode, tabAddress.country\n\t) as 'Address::180',\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\",\n `tabLead`.owner as \"Owner:Link/User:120\"\nFROM\n\t`tabLead`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.lead=`tabLead`.name\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
|
||||
"query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2)\n\t) as 'Address::180',\n\t`tabAddress`.state as \"State::100\",\n\t`tabAddress`.pincode as \"Pincode::70\",\n\t`tabAddress`.country as \"Country::100\",\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\",\n `tabLead`.owner as \"Owner:Link/User:120\"\nFROM\n\t`tabLead`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.lead=`tabLead`.name\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
|
||||
"ref_doctype": "Lead",
|
||||
"report_name": "Lead Details",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -215,6 +215,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
},
|
||||
|
||||
warehouse: function(doc, cdt, cdn) {
|
||||
var me = this;
|
||||
this.batch_no(doc, cdt, cdn);
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
if(item.item_code && item.warehouse) {
|
||||
return this.frm.call({
|
||||
@@ -342,10 +344,13 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
var tax_count = this.frm.tax_doclist.length;
|
||||
|
||||
this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
|
||||
this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate);
|
||||
|
||||
this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
||||
precision("other_charges_total"));
|
||||
|
||||
this.frm.doc.grand_total_export = (this.frm.doc.other_charges_total || this.frm.doc.discount_amount) ?
|
||||
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_export;
|
||||
|
||||
this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export -
|
||||
this.frm.doc.net_total_export + flt(this.frm.doc.discount_amount),
|
||||
precision("other_charges_total_export"));
|
||||
@@ -453,6 +458,29 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
});
|
||||
},
|
||||
|
||||
manipulate_grand_total_for_inclusive_tax: function() {
|
||||
// if fully inclusive taxes and diff
|
||||
if (this.frm.tax_doclist.length) {
|
||||
var all_inclusive = frappe.utils.all(this.frm.tax_doclist.map(function(d) {
|
||||
return cint(d.included_in_print_rate);
|
||||
}));
|
||||
|
||||
if (all_inclusive) {
|
||||
var last_tax = this.frm.tax_doclist.slice(-1)[0];
|
||||
|
||||
var diff = this.frm.doc.net_total_export
|
||||
- flt(last_tax.total / this.frm.doc.conversion_rate, precision("grand_total_export"));
|
||||
|
||||
if ( diff && Math.abs(diff) <= (2.0 / Math.pow(10, precision("tax_amount", last_tax))) ) {
|
||||
var adjustment_amount = flt(diff * this.frm.doc.conversion_rate, precision("tax_amount", last_tax));
|
||||
last_tax.tax_amount += adjustment_amount;
|
||||
last_tax.tax_amount_after_discount += adjustment_amount;
|
||||
last_tax.total += adjustment_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_cleanup: function() {
|
||||
this._super();
|
||||
this.frm.doc.in_words = this.frm.doc.in_words_export = "";
|
||||
@@ -473,6 +501,21 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
},
|
||||
|
||||
batch_no: function(doc, cdt, cdn) {
|
||||
var me = this;
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
return this.frm.call({
|
||||
method: "erpnext.stock.get_item_details.get_batch_qty",
|
||||
child: item,
|
||||
args: {
|
||||
"batch_no": item.batch_no,
|
||||
"warehouse": item.warehouse,
|
||||
"item_code": item.item_code
|
||||
},
|
||||
"fieldname": "actual_batch_qty"
|
||||
});
|
||||
},
|
||||
|
||||
set_dynamic_labels: function() {
|
||||
this._super();
|
||||
this.set_sales_bom_help(this.frm.doc);
|
||||
|
||||
@@ -94,6 +94,9 @@ class AuthorizationControl(TransactionBase):
|
||||
self.validate_auth_rule(doctype_name, auth_value, based_on, add_cond, company)
|
||||
|
||||
def validate_approving_authority(self, doctype_name,company, total, doc_obj = ''):
|
||||
if not frappe.db.count("Authorization Rule"):
|
||||
return
|
||||
|
||||
av_dis = 0
|
||||
if doc_obj:
|
||||
price_list_rate, base_rate = 0, 0
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
test_ignore = ["Account", "Cost Center"]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# pre loaded
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
test_ignore = ["Price List"]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
test_dependencies = ["Employee"]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe.exceptions import ValidationError
|
||||
|
||||
@@ -314,6 +314,19 @@
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"fieldname": "actual_batch_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Available Batch Qty at Warehouse",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"fieldname": "actual_qty",
|
||||
@@ -426,7 +439,7 @@
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2014-09-09 05:35:37.460939",
|
||||
"modified": "2015-03-10 12:21:17.028911",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Delivery Note Item",
|
||||
|
||||
@@ -138,10 +138,11 @@ class PurchaseReceipt(BuyingController):
|
||||
pr_qty = flt(d.qty) * flt(d.conversion_factor)
|
||||
|
||||
if pr_qty:
|
||||
val_rate_db_precision = 6 if cint(self.precision("valuation_rate")) <= 6 else 9
|
||||
sl_entries.append(self.get_sl_entries(d, {
|
||||
"actual_qty": flt(pr_qty),
|
||||
"serial_no": cstr(d.serial_no).strip(),
|
||||
"incoming_rate": d.valuation_rate
|
||||
"incoming_rate": flt(d.valuation_rate, val_rate_db_precision)
|
||||
}))
|
||||
|
||||
if flt(d.rejected_qty) > 0:
|
||||
@@ -288,14 +289,16 @@ class PurchaseReceipt(BuyingController):
|
||||
if d.item_code in stock_items and flt(d.valuation_rate) and flt(d.qty):
|
||||
if warehouse_account.get(d.warehouse):
|
||||
|
||||
val_rate_db_precision = 6 if cint(self.precision("valuation_rate")) <= 6 else 9
|
||||
|
||||
# warehouse account
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": warehouse_account[d.warehouse],
|
||||
"against": stock_rbnb,
|
||||
"cost_center": d.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"debit": flt(flt(d.valuation_rate) * flt(d.qty) * flt(d.conversion_factor),
|
||||
self.precision("valuation_rate", d))
|
||||
"debit": flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
|
||||
self.precision("base_amount", d))
|
||||
}))
|
||||
|
||||
# stock received but not billed
|
||||
@@ -329,6 +332,24 @@ class PurchaseReceipt(BuyingController):
|
||||
"credit": flt(d.rm_supp_cost)
|
||||
}))
|
||||
|
||||
# divisional loss adjustment
|
||||
if not self.get("other_charges"):
|
||||
sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
|
||||
self.precision("base_amount", d))
|
||||
|
||||
distributed_amount = flt(flt(d.base_amount, self.precision("base_amount", d))) + \
|
||||
flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost)
|
||||
|
||||
divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_amount", d))
|
||||
if divisional_loss:
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": stock_rbnb,
|
||||
"against": warehouse_account[d.warehouse],
|
||||
"cost_center": d.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"debit": divisional_loss
|
||||
}))
|
||||
|
||||
elif d.warehouse not in warehouse_with_no_account or \
|
||||
d.rejected_warehouse not in warehouse_with_no_account:
|
||||
warehouse_with_no_account.append(d.warehouse)
|
||||
|
||||
@@ -24,6 +24,12 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
};
|
||||
};
|
||||
|
||||
this.frm.fields_dict.bom_no.get_query = function() {
|
||||
return {
|
||||
filters:{ 'docstatus': 1 }
|
||||
};
|
||||
};
|
||||
|
||||
this.frm.fields_dict.mtn_details.grid.get_field('item_code').get_query = function() {
|
||||
if(in_list(["Sales Return", "Purchase Return"], me.frm.doc.purpose) &&
|
||||
me.get_doctype_docname()) {
|
||||
|
||||
@@ -237,11 +237,6 @@
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "fold",
|
||||
"fieldtype": "Fold",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
|
||||
"fieldname": "sb1",
|
||||
@@ -339,6 +334,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "fold",
|
||||
"fieldtype": "Fold",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.purpose==\"Sales Return\" || doc.purpose==\"Purchase Return\")",
|
||||
"fieldname": "contact_section",
|
||||
@@ -585,7 +585,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2014-09-16 15:56:37.514676",
|
||||
"modified": "2015-01-29 11:26:46.968041",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Entry",
|
||||
|
||||
@@ -109,8 +109,8 @@ class StockEntry(StockController):
|
||||
def validate_warehouse(self, pro_obj):
|
||||
"""perform various (sometimes conditional) validations on warehouse"""
|
||||
|
||||
source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return"]
|
||||
target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return"]
|
||||
source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return", "Subcontract"]
|
||||
target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return", "Subcontract"]
|
||||
|
||||
validate_for_manufacture_repack = any([d.bom_no for d in self.get("mtn_details")])
|
||||
|
||||
@@ -467,6 +467,9 @@ class StockEntry(StockController):
|
||||
"Subcontract"]:
|
||||
if self.production_order and self.purpose == "Material Transfer":
|
||||
item_dict = self.get_pending_raw_materials(pro_obj)
|
||||
if self.to_warehouse and pro_obj:
|
||||
for item in item_dict.values():
|
||||
item["to_warehouse"] = pro_obj.wip_warehouse
|
||||
else:
|
||||
if not self.fg_completed_qty:
|
||||
frappe.throw(_("Manufacturing Quantity is mandatory"))
|
||||
@@ -474,7 +477,8 @@ class StockEntry(StockController):
|
||||
for item in item_dict.values():
|
||||
if pro_obj:
|
||||
item["from_warehouse"] = pro_obj.wip_warehouse
|
||||
item["to_warehouse"] = ""
|
||||
|
||||
item["to_warehouse"] = self.to_warehouse if self.purpose=="Subcontract" else ""
|
||||
|
||||
# add raw materials to Stock Entry Detail table
|
||||
self.add_to_stock_entry_detail(item_dict)
|
||||
@@ -525,7 +529,7 @@ class StockEntry(StockController):
|
||||
item_dict = get_bom_items_as_dict(self.bom_no, qty=qty, fetch_exploded = self.use_multi_level_bom)
|
||||
|
||||
for item in item_dict.values():
|
||||
item.from_warehouse = item.default_warehouse
|
||||
item.from_warehouse = self.from_warehouse or item.default_warehouse
|
||||
|
||||
return item_dict
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user