mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 07:29:22 +00:00
Merge branch 'version-12-hotfix' into cash_flow_mapper_fix
This commit is contained in:
@@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '12.20.0'
|
__version__ = '12.21.0'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ class JournalEntry(AccountsController):
|
|||||||
self.validate_entries_for_advance()
|
self.validate_entries_for_advance()
|
||||||
self.validate_multi_currency()
|
self.validate_multi_currency()
|
||||||
self.set_amounts_in_company_currency()
|
self.set_amounts_in_company_currency()
|
||||||
self.validate_total_debit_and_credit()
|
|
||||||
|
# Do not validate while importing via data import
|
||||||
|
if not frappe.flags.in_import:
|
||||||
|
self.validate_total_debit_and_credit()
|
||||||
|
|
||||||
self.validate_against_jv()
|
self.validate_against_jv()
|
||||||
self.validate_reference_doc()
|
self.validate_reference_doc()
|
||||||
self.set_against_account()
|
self.set_against_account()
|
||||||
|
|||||||
21
erpnext/change_log/v12/v12_21_0.md
Normal file
21
erpnext/change_log/v12/v12_21_0.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
## Version 12.21.0 Release Notes
|
||||||
|
|
||||||
|
|
||||||
|
### Fixes & Enhancements
|
||||||
|
|
||||||
|
- Incorrect qty calculated for sub-contracted raw materials in purchase receipt ([#25443](https://github.com/frappe/erpnext/pull/25443))
|
||||||
|
- Update cost center in the item table fetched from POS Profile in v12 ([#25612](https://github.com/frappe/erpnext/pull/25612))
|
||||||
|
- Total stock summary report not working ([#25552](https://github.com/frappe/erpnext/pull/25552))
|
||||||
|
- Timeout error while loading warehouse tree ([#25693](https://github.com/frappe/erpnext/pull/25693))
|
||||||
|
- RCM rounding precision ([#25410](https://github.com/frappe/erpnext/pull/25410))
|
||||||
|
- Change subcontracted item display ([#25426](https://github.com/frappe/erpnext/pull/25426))
|
||||||
|
- Remove invalid changes added due to merge conflict ([#25437](https://github.com/frappe/erpnext/pull/25437))
|
||||||
|
- Add document type field for e-invoicing (Italy) ([#25420](https://github.com/frappe/erpnext/pull/25420))
|
||||||
|
- Issue in project custom status ([#25453](https://github.com/frappe/erpnext/pull/25453))
|
||||||
|
- Employee Separation ([#25504](https://github.com/frappe/erpnext/pull/25504))
|
||||||
|
- State code for Other Territory ([#25422](https://github.com/frappe/erpnext/pull/25422))
|
||||||
|
- Remove invalid changes added due to merge conflict ([#25405](https://github.com/frappe/erpnext/pull/25405))
|
||||||
|
- Check for None in item.schedule_date before setting ([#25589](https://github.com/frappe/erpnext/pull/25589))
|
||||||
|
- Can't multiply sequence by non-int of type 'float' ([#25385](https://github.com/frappe/erpnext/pull/25385))
|
||||||
|
- Filter using purpose, make requested changes ([#25388](https://github.com/frappe/erpnext/pull/25388))
|
||||||
|
- Purchase from registered composition dealer ([#25419](https://github.com/frappe/erpnext/pull/25419))
|
||||||
@@ -146,8 +146,9 @@ def sync_transactions(bank, bank_account):
|
|||||||
transactions = get_transactions(bank=bank, bank_account=bank_account, start_date=start_date, end_date=end_date)
|
transactions = get_transactions(bank=bank, bank_account=bank_account, start_date=start_date, end_date=end_date)
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for transaction in reversed(transactions):
|
if transactions:
|
||||||
result += new_bank_transaction(transaction)
|
for transaction in reversed(transactions):
|
||||||
|
result += new_bank_transaction(transaction)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
last_transaction_date = frappe.db.get_value('Bank Transaction', result.pop(), 'date')
|
last_transaction_date = frappe.db.get_value('Bank Transaction', result.pop(), 'date')
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, erpnext
|
import frappe, erpnext
|
||||||
from frappe.utils import cint, nowdate
|
from frappe.utils import cint, flt
|
||||||
from frappe import throw, _
|
from frappe import throw, _
|
||||||
|
from collections import defaultdict
|
||||||
from frappe.utils.nestedset import NestedSet
|
from frappe.utils.nestedset import NestedSet
|
||||||
from erpnext.stock import get_warehouse_account
|
from erpnext.stock import get_warehouse_account
|
||||||
from frappe.contacts.address_and_contact import load_address_and_contact
|
from frappe.contacts.address_and_contact import load_address_and_contact
|
||||||
@@ -29,7 +30,6 @@ class Warehouse(NestedSet):
|
|||||||
self.set_onload('account', account)
|
self.set_onload('account', account)
|
||||||
load_address_and_contact(self)
|
load_address_and_contact(self)
|
||||||
|
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
self.update_nsm_model()
|
self.update_nsm_model()
|
||||||
|
|
||||||
@@ -140,8 +140,6 @@ class Warehouse(NestedSet):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_children(doctype, parent=None, company=None, is_root=False):
|
def get_children(doctype, parent=None, company=None, is_root=False):
|
||||||
from erpnext.stock.utils import get_stock_value_from_bin
|
|
||||||
|
|
||||||
if is_root:
|
if is_root:
|
||||||
parent = ""
|
parent = ""
|
||||||
|
|
||||||
@@ -154,13 +152,48 @@ def get_children(doctype, parent=None, company=None, is_root=False):
|
|||||||
|
|
||||||
warehouses = frappe.get_list(doctype, fields=fields, filters=filters, order_by='name')
|
warehouses = frappe.get_list(doctype, fields=fields, filters=filters, order_by='name')
|
||||||
|
|
||||||
|
company_currency = ''
|
||||||
|
if company:
|
||||||
|
company_currency = frappe.get_cached_value('Company', company, 'default_currency')
|
||||||
|
|
||||||
|
warehouse_wise_value = get_warehouse_wise_stock_value(company)
|
||||||
|
|
||||||
# return warehouses
|
# return warehouses
|
||||||
for wh in warehouses:
|
for wh in warehouses:
|
||||||
wh["balance"] = get_stock_value_from_bin(warehouse=wh.value)
|
wh["balance"] = warehouse_wise_value.get(wh.value)
|
||||||
if company:
|
if company_currency:
|
||||||
wh["company_currency"] = frappe.db.get_value('Company', company, 'default_currency')
|
wh["company_currency"] = company_currency
|
||||||
return warehouses
|
return warehouses
|
||||||
|
|
||||||
|
def get_warehouse_wise_stock_value(company):
|
||||||
|
warehouses = frappe.get_all('Warehouse',
|
||||||
|
fields = ['name', 'parent_warehouse'], filters = {'company': company})
|
||||||
|
parent_warehouse = {d.name : d.parent_warehouse for d in warehouses}
|
||||||
|
|
||||||
|
filters = {'warehouse': ('in', [data.name for data in warehouses])}
|
||||||
|
bin_data = frappe.get_all('Bin', fields = ['sum(stock_value) as stock_value', 'warehouse'],
|
||||||
|
filters = filters, group_by = 'warehouse')
|
||||||
|
|
||||||
|
warehouse_wise_stock_value = defaultdict(float)
|
||||||
|
for row in bin_data:
|
||||||
|
if not row.stock_value:
|
||||||
|
continue
|
||||||
|
|
||||||
|
warehouse_wise_stock_value[row.warehouse] = row.stock_value
|
||||||
|
update_value_in_parent_warehouse(warehouse_wise_stock_value,
|
||||||
|
parent_warehouse, row.warehouse, row.stock_value)
|
||||||
|
|
||||||
|
return warehouse_wise_stock_value
|
||||||
|
|
||||||
|
def update_value_in_parent_warehouse(warehouse_wise_stock_value, parent_warehouse_dict, warehouse, stock_value):
|
||||||
|
parent_warehouse = parent_warehouse_dict.get(warehouse)
|
||||||
|
if not parent_warehouse:
|
||||||
|
return
|
||||||
|
|
||||||
|
warehouse_wise_stock_value[parent_warehouse] += flt(stock_value)
|
||||||
|
update_value_in_parent_warehouse(warehouse_wise_stock_value, parent_warehouse_dict,
|
||||||
|
parent_warehouse, stock_value)
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def add_node():
|
def add_node():
|
||||||
from frappe.desk.treeview import make_tree_args
|
from frappe.desk.treeview import make_tree_args
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ frappe.treeview_settings['Warehouse'] = {
|
|||||||
onrender: function(node) {
|
onrender: function(node) {
|
||||||
if (node.data && node.data.balance!==undefined) {
|
if (node.data && node.data.balance!==undefined) {
|
||||||
$('<span class="balance-area pull-right text-muted small">'
|
$('<span class="balance-area pull-right text-muted small">'
|
||||||
+ format_currency(Math.abs(node.data.balance), node.data.company_currency)
|
+ format_currency((node.data.balance), node.data.company_currency)
|
||||||
+ '</span>').insertBefore(node.$ul);
|
+ '</span>').insertBefore(node.$ul);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user