Merge branch 'develop' into version-12
This commit is contained in:
commit
5888efbb4e
@ -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.1.3'
|
__version__ = '12.1.4'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -446,6 +446,10 @@ class ReceivablePayableReport(object):
|
|||||||
|
|
||||||
row.age = (getdate(self.age_as_on) - getdate(entry_date)).days or 0
|
row.age = (getdate(self.age_as_on) - getdate(entry_date)).days or 0
|
||||||
index = None
|
index = None
|
||||||
|
|
||||||
|
if not (self.filters.range1 and self.filters.range2 and self.filters.range3 and self.filters.range4):
|
||||||
|
self.filters.range1, self.filters.range2, self.filters.range3, self.filters.range4 = 30, 60, 90, 120
|
||||||
|
|
||||||
for i, days in enumerate([self.filters.range1, self.filters.range2, self.filters.range3, self.filters.range4]):
|
for i, days in enumerate([self.filters.range1, self.filters.range2, self.filters.range3, self.filters.range4]):
|
||||||
if row.age <= days:
|
if row.age <= days:
|
||||||
index = i
|
index = i
|
||||||
|
@ -286,14 +286,14 @@ class PartyLedgerSummaryReport(object):
|
|||||||
|
|
||||||
if parties and accounts:
|
if parties and accounts:
|
||||||
if len(parties) == 1:
|
if len(parties) == 1:
|
||||||
party = parties.keys()[0]
|
party = list(parties.keys())[0]
|
||||||
for account, amount in iteritems(accounts):
|
for account, amount in iteritems(accounts):
|
||||||
self.party_adjustment_accounts.add(account)
|
self.party_adjustment_accounts.add(account)
|
||||||
self.party_adjustment_details.setdefault(party, {})
|
self.party_adjustment_details.setdefault(party, {})
|
||||||
self.party_adjustment_details[party].setdefault(account, 0)
|
self.party_adjustment_details[party].setdefault(account, 0)
|
||||||
self.party_adjustment_details[party][account] += amount
|
self.party_adjustment_details[party][account] += amount
|
||||||
elif len(accounts) == 1 and not has_irrelevant_entry:
|
elif len(accounts) == 1 and not has_irrelevant_entry:
|
||||||
account = accounts.keys()[0]
|
account = list(accounts.keys())[0]
|
||||||
self.party_adjustment_accounts.add(account)
|
self.party_adjustment_accounts.add(account)
|
||||||
for party, amount in iteritems(parties):
|
for party, amount in iteritems(parties):
|
||||||
self.party_adjustment_details.setdefault(party, {})
|
self.party_adjustment_details.setdefault(party, {})
|
||||||
|
@ -4,11 +4,14 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
|
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||||
from frappe.utils import getdate, flt
|
from frappe.utils import getdate, flt
|
||||||
|
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
if not filters: filters = {}
|
if not filters:
|
||||||
|
filters = {}
|
||||||
|
|
||||||
validate_filters(filters)
|
validate_filters(filters)
|
||||||
|
|
||||||
columns = get_columns(filters)
|
columns = get_columns(filters)
|
||||||
@ -19,18 +22,28 @@ def execute(filters=None):
|
|||||||
for d in entries:
|
for d in entries:
|
||||||
invoice = invoice_details.get(d.against_voucher) or frappe._dict()
|
invoice = invoice_details.get(d.against_voucher) or frappe._dict()
|
||||||
|
|
||||||
if d.reference_type=="Purchase Invoice":
|
if d.reference_type == "Purchase Invoice":
|
||||||
payment_amount = flt(d.debit) or -1 * flt(d.credit)
|
payment_amount = flt(d.debit) or -1 * flt(d.credit)
|
||||||
else:
|
else:
|
||||||
payment_amount = flt(d.credit) or -1 * flt(d.debit)
|
payment_amount = flt(d.credit) or -1 * flt(d.debit)
|
||||||
|
|
||||||
row = [d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher,
|
d.update({
|
||||||
invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks]
|
"range1": 0,
|
||||||
|
"range2": 0,
|
||||||
|
"range3": 0,
|
||||||
|
"range4": 0,
|
||||||
|
"outstanding": payment_amount
|
||||||
|
})
|
||||||
|
|
||||||
if d.against_voucher:
|
if d.against_voucher:
|
||||||
row += get_ageing_data(30, 60, 90, 120, d.posting_date, invoice.posting_date, payment_amount)
|
ReceivablePayableReport(filters).get_ageing_data(invoice.posting_date, d)
|
||||||
else:
|
|
||||||
row += ["", "", "", "", ""]
|
row = [
|
||||||
|
d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher,
|
||||||
|
invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks,
|
||||||
|
d.age, d.range1, d.range2, d.range3, d.range4
|
||||||
|
]
|
||||||
|
|
||||||
if invoice.due_date:
|
if invoice.due_date:
|
||||||
row.append((getdate(d.posting_date) - getdate(invoice.due_date)).days or 0)
|
row.append((getdate(d.posting_date) - getdate(invoice.due_date)).days or 0)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ def calculate_next_due_date(periodicity, start_date = None, end_date = None, las
|
|||||||
if not start_date and not last_completion_date:
|
if not start_date and not last_completion_date:
|
||||||
start_date = frappe.utils.now()
|
start_date = frappe.utils.now()
|
||||||
|
|
||||||
if last_completion_date and (last_completion_date > start_date or not start_date):
|
if last_completion_date and ((start_date and last_completion_date > start_date) or not start_date):
|
||||||
start_date = last_completion_date
|
start_date = last_completion_date
|
||||||
if periodicity == 'Daily':
|
if periodicity == 'Daily':
|
||||||
next_due_date = add_days(start_date, 1)
|
next_due_date = add_days(start_date, 1)
|
||||||
@ -71,10 +71,11 @@ def calculate_next_due_date(periodicity, start_date = None, end_date = None, las
|
|||||||
next_due_date = add_years(start_date, 2)
|
next_due_date = add_years(start_date, 2)
|
||||||
if periodicity == 'Quarterly':
|
if periodicity == 'Quarterly':
|
||||||
next_due_date = add_months(start_date, 3)
|
next_due_date = add_months(start_date, 3)
|
||||||
if end_date and (start_date >= end_date or last_completion_date >= end_date or next_due_date):
|
if end_date and ((start_date and start_date >= end_date) or (last_completion_date and last_completion_date >= end_date) or next_due_date):
|
||||||
next_due_date = ""
|
next_due_date = ""
|
||||||
return next_due_date
|
return next_due_date
|
||||||
|
|
||||||
|
|
||||||
def update_maintenance_log(asset_maintenance, item_code, item_name, task):
|
def update_maintenance_log(asset_maintenance, item_code, item_name, task):
|
||||||
asset_maintenance_log = frappe.get_value("Asset Maintenance Log", {"asset_maintenance": asset_maintenance,
|
asset_maintenance_log = frappe.get_value("Asset Maintenance Log", {"asset_maintenance": asset_maintenance,
|
||||||
"task": task.maintenance_task, "maintenance_status": ('in',['Planned','Overdue'])})
|
"task": task.maintenance_task, "maintenance_status": ('in',['Planned','Overdue'])})
|
||||||
|
@ -10,7 +10,8 @@ frappe.ui.form.on("Purchase Order", {
|
|||||||
frm.custom_make_buttons = {
|
frm.custom_make_buttons = {
|
||||||
'Purchase Receipt': 'Receipt',
|
'Purchase Receipt': 'Receipt',
|
||||||
'Purchase Invoice': 'Invoice',
|
'Purchase Invoice': 'Invoice',
|
||||||
'Stock Entry': 'Material to Supplier'
|
'Stock Entry': 'Material to Supplier',
|
||||||
|
'Payment Entry': 'Payment'
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.set_query("reserve_warehouse", "supplied_items", function() {
|
frm.set_query("reserve_warehouse", "supplied_items", function() {
|
||||||
@ -196,10 +197,10 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
if(items.length >= 1){
|
if(items.length >= 1){
|
||||||
me.raw_material_data = [];
|
me.raw_material_data = [];
|
||||||
me.show_dialog = 1;
|
me.show_dialog = 1;
|
||||||
let title = "";
|
let title = __('Transfer Material to Supplier');
|
||||||
let fields = [
|
let fields = [
|
||||||
{fieldtype:'Section Break', label: __('Raw Materials')},
|
{fieldtype:'Section Break', label: __('Raw Materials')},
|
||||||
{fieldname: 'sub_con_rm_items', fieldtype: 'Table',
|
{fieldname: 'sub_con_rm_items', fieldtype: 'Table', label: __('Items'),
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
fieldtype:'Data',
|
fieldtype:'Data',
|
||||||
@ -271,7 +272,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
'item_code': item.main_item_code,
|
'item_code': item.main_item_code,
|
||||||
'rm_item_code': item.rm_item_code,
|
'rm_item_code': item.rm_item_code,
|
||||||
'item_name': item.rm_item_code,
|
'item_name': item.rm_item_code,
|
||||||
'qty': item.required_qty,
|
'qty': item.required_qty - item.supplied_qty,
|
||||||
'warehouse':item.reserve_warehouse,
|
'warehouse':item.reserve_warehouse,
|
||||||
'rate':item.rate,
|
'rate':item.rate,
|
||||||
'amount':item.amount,
|
'amount':item.amount,
|
||||||
|
@ -60,8 +60,8 @@ def get_data(args):
|
|||||||
existing_attendance = {}
|
existing_attendance = {}
|
||||||
if existing_attendance_records \
|
if existing_attendance_records \
|
||||||
and tuple([getdate(date), employee.name]) in existing_attendance_records \
|
and tuple([getdate(date), employee.name]) in existing_attendance_records \
|
||||||
and getdate(employee.date_of_joining) >= getdate(date) \
|
and getdate(employee.date_of_joining) <= getdate(date) \
|
||||||
and getdate(employee.relieving_date) <= getdate(date):
|
and getdate(employee.relieving_date) >= getdate(date):
|
||||||
existing_attendance = existing_attendance_records[tuple([getdate(date), employee.name])]
|
existing_attendance = existing_attendance_records[tuple([getdate(date), employee.name])]
|
||||||
row = [
|
row = [
|
||||||
existing_attendance and existing_attendance.name or "",
|
existing_attendance and existing_attendance.name or "",
|
||||||
|
@ -648,7 +648,7 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
|
|||||||
item_dict[item.item_code] = item
|
item_dict[item.item_code] = item
|
||||||
|
|
||||||
for item, item_details in item_dict.items():
|
for item, item_details in item_dict.items():
|
||||||
for d in [["Account", "expense_account", "default_expense_account"],
|
for d in [["Account", "expense_account", "stock_adjustment_account"],
|
||||||
["Cost Center", "cost_center", "cost_center"], ["Warehouse", "default_warehouse", ""]]:
|
["Cost Center", "cost_center", "cost_center"], ["Warehouse", "default_warehouse", ""]]:
|
||||||
company_in_record = frappe.db.get_value(d[0], item_details.get(d[1]), "company")
|
company_in_record = frappe.db.get_value(d[0], item_details.get(d[1]), "company")
|
||||||
if not item_details.get(d[1]) or (company_in_record and company != company_in_record):
|
if not item_details.get(d[1]) or (company_in_record and company != company_in_record):
|
||||||
|
@ -105,7 +105,6 @@ class JobCard(Document):
|
|||||||
for_quantity, time_in_mins = 0, 0
|
for_quantity, time_in_mins = 0, 0
|
||||||
from_time_list, to_time_list = [], []
|
from_time_list, to_time_list = [], []
|
||||||
|
|
||||||
|
|
||||||
for d in frappe.get_all('Job Card',
|
for d in frappe.get_all('Job Card',
|
||||||
filters = {'docstatus': 1, 'operation_id': self.operation_id}):
|
filters = {'docstatus': 1, 'operation_id': self.operation_id}):
|
||||||
doc = frappe.get_doc('Job Card', d.name)
|
doc = frappe.get_doc('Job Card', d.name)
|
||||||
@ -125,8 +124,8 @@ class JobCard(Document):
|
|||||||
if data.name == self.operation_id:
|
if data.name == self.operation_id:
|
||||||
data.completed_qty = for_quantity
|
data.completed_qty = for_quantity
|
||||||
data.actual_operation_time = time_in_mins
|
data.actual_operation_time = time_in_mins
|
||||||
data.actual_start_time = min(from_time_list)
|
data.actual_start_time = min(from_time_list) if from_time_list else None
|
||||||
data.actual_end_time = max(to_time_list)
|
data.actual_end_time = max(to_time_list) if to_time_list else None
|
||||||
|
|
||||||
wo.flags.ignore_validate_update_after_submit = True
|
wo.flags.ignore_validate_update_after_submit = True
|
||||||
wo.update_operation_status()
|
wo.update_operation_status()
|
||||||
|
@ -11,7 +11,8 @@ frappe.ui.form.on("Sales Order", {
|
|||||||
'Sales Invoice': 'Invoice',
|
'Sales Invoice': 'Invoice',
|
||||||
'Material Request': 'Material Request',
|
'Material Request': 'Material Request',
|
||||||
'Purchase Order': 'Purchase Order',
|
'Purchase Order': 'Purchase Order',
|
||||||
'Project': 'Project'
|
'Project': 'Project',
|
||||||
|
'Payment Entry': "Payment"
|
||||||
}
|
}
|
||||||
frm.add_fetch('customer', 'tax_id', 'tax_id');
|
frm.add_fetch('customer', 'tax_id', 'tax_id');
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
args: {
|
args: {
|
||||||
item_code: item.item_code,
|
item_code: item.item_code,
|
||||||
warehouse: item.warehouse,
|
warehouse: item.warehouse,
|
||||||
has_batch_no: has_batch_no,
|
has_batch_no: has_batch_no || 0,
|
||||||
stock_qty: item.stock_qty,
|
stock_qty: item.stock_qty,
|
||||||
serial_no: item.serial_no || "",
|
serial_no: item.serial_no || "",
|
||||||
},
|
},
|
||||||
|
@ -808,7 +808,7 @@ def get_serial_no_details(item_code, warehouse, stock_qty, serial_no):
|
|||||||
return {'serial_no': serial_no}
|
return {'serial_no': serial_no}
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_bin_details_and_serial_nos(item_code, warehouse, has_batch_no, stock_qty=None, serial_no=None):
|
def get_bin_details_and_serial_nos(item_code, warehouse, has_batch_no=None, stock_qty=None, serial_no=None):
|
||||||
bin_details_and_serial_nos = {}
|
bin_details_and_serial_nos = {}
|
||||||
bin_details_and_serial_nos.update(get_bin_details(item_code, warehouse))
|
bin_details_and_serial_nos.update(get_bin_details(item_code, warehouse))
|
||||||
if flt(stock_qty) > 0:
|
if flt(stock_qty) > 0:
|
||||||
|
@ -15,8 +15,8 @@ def execute(filters=None):
|
|||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
columns = [
|
columns = [
|
||||||
_("Company") + ":Link/Item:250",
|
_("Company") + ":Link/Company:250",
|
||||||
_("Warehouse") + ":Link/Item:150",
|
_("Warehouse") + ":Link/Warehouse:150",
|
||||||
_("Item") + ":Link/Item:150",
|
_("Item") + ":Link/Item:150",
|
||||||
_("Description") + "::300",
|
_("Description") + "::300",
|
||||||
_("Current Qty") + ":Float:100",
|
_("Current Qty") + ":Float:100",
|
||||||
@ -30,7 +30,7 @@ def get_total_stock(filters):
|
|||||||
|
|
||||||
if filters.get("group_by") == "Warehouse":
|
if filters.get("group_by") == "Warehouse":
|
||||||
if filters.get("company"):
|
if filters.get("company"):
|
||||||
conditions += " AND warehouse.company = %s" % frappe.db.escape(filters.get("company"), percent=False)
|
conditions += " AND warehouse.company = '%s'" % frappe.db.escape(filters.get("company"), percent=False)
|
||||||
|
|
||||||
conditions += " GROUP BY ledger.warehouse, item.item_code"
|
conditions += " GROUP BY ledger.warehouse, item.item_code"
|
||||||
columns += "'' as company, ledger.warehouse"
|
columns += "'' as company, ledger.warehouse"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user