Merge branch 'develop' of https://github.com/frappe/erpnext into sla_fix
This commit is contained in:
commit
e9b159c500
File diff suppressed because it is too large
Load Diff
@ -80,27 +80,24 @@ def get_data(filters):
|
||||
sales_invoice_data = get_sales_details(filters)
|
||||
|
||||
for item in items:
|
||||
row = {
|
||||
"item_group": item.item_group,
|
||||
"item": item.name,
|
||||
"item_name": item.item_name
|
||||
}
|
||||
|
||||
if sales_invoice_data.get(item.name):
|
||||
item_obj = sales_invoice_data[item.name]
|
||||
if item_obj.days_since_last_order > cint(filters['days']):
|
||||
row = {
|
||||
row.update({
|
||||
"territory": item_obj.territory,
|
||||
"item_group": item_obj.item_group,
|
||||
"item": item_obj.name,
|
||||
"item_name": item_obj.item_name,
|
||||
"customer": item_obj.customer,
|
||||
"last_order_date": item_obj.last_order_date,
|
||||
"qty": item_obj.qty,
|
||||
"days_since_last_order": item_obj.days_since_last_order
|
||||
}
|
||||
data.append(row)
|
||||
else:
|
||||
row = {
|
||||
"item_group": item.item_group,
|
||||
"item": item.name,
|
||||
"item_name": item.item_name
|
||||
}
|
||||
data.append(row)
|
||||
})
|
||||
|
||||
data.append(row)
|
||||
|
||||
return data
|
||||
|
||||
|
@ -403,7 +403,7 @@ def make_purchase_invoice(source_name, target_doc=None):
|
||||
or item.get("buying_cost_center")
|
||||
or item_group.get("buying_cost_center"))
|
||||
|
||||
doc = get_mapped_doc("Purchase Order", source_name, {
|
||||
fields = {
|
||||
"Purchase Order": {
|
||||
"doctype": "Purchase Invoice",
|
||||
"field_map": {
|
||||
@ -426,8 +426,16 @@ def make_purchase_invoice(source_name, target_doc=None):
|
||||
"Purchase Taxes and Charges": {
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"add_if_empty": True
|
||||
},
|
||||
}
|
||||
|
||||
if frappe.get_single("Accounts Settings").automatically_fetch_payment_terms == 1:
|
||||
fields["Payment Schedule"] = {
|
||||
"doctype": "Payment Schedule",
|
||||
"add_if_empty": True
|
||||
}
|
||||
}, target_doc, postprocess)
|
||||
|
||||
doc = get_mapped_doc("Purchase Order", source_name, fields, target_doc, postprocess)
|
||||
|
||||
return doc
|
||||
|
||||
|
@ -6,7 +6,7 @@ import unittest
|
||||
import frappe
|
||||
import frappe.defaults
|
||||
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
|
||||
from frappe.utils import flt, add_days, nowdate
|
||||
from frappe.utils import flt, add_days, nowdate, getdate
|
||||
from erpnext.stock.doctype.item.test_item import make_item
|
||||
from erpnext.buying.doctype.purchase_order.purchase_order import (make_purchase_receipt, make_purchase_invoice, make_rm_stock_entry as make_subcontract_transfer_entry)
|
||||
from erpnext.stock.doctype.material_request.test_material_request import make_material_request
|
||||
@ -142,9 +142,9 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
po.submit()
|
||||
|
||||
self.assertEqual(po.payment_schedule[0].payment_amount, 2500.0)
|
||||
self.assertEqual(po.payment_schedule[0].due_date, po.transaction_date)
|
||||
self.assertEqual(getdate(po.payment_schedule[0].due_date), getdate(po.transaction_date))
|
||||
self.assertEqual(po.payment_schedule[1].payment_amount, 2500.0)
|
||||
self.assertEqual(po.payment_schedule[1].due_date, add_days(po.transaction_date, 30))
|
||||
self.assertEqual(getdate(po.payment_schedule[1].due_date), add_days(getdate(po.transaction_date), 30))
|
||||
pi = make_purchase_invoice(po.name)
|
||||
pi.save()
|
||||
|
||||
@ -152,9 +152,9 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
self.assertEqual(len(pi.get("items", [])), 1)
|
||||
|
||||
self.assertEqual(pi.payment_schedule[0].payment_amount, 2500.0)
|
||||
self.assertEqual(pi.payment_schedule[0].due_date, po.transaction_date)
|
||||
self.assertEqual(getdate(pi.payment_schedule[0].due_date), getdate(po.transaction_date))
|
||||
self.assertEqual(pi.payment_schedule[1].payment_amount, 2500.0)
|
||||
self.assertEqual(pi.payment_schedule[1].due_date, add_days(po.transaction_date, 30))
|
||||
self.assertEqual(getdate(pi.payment_schedule[1].due_date), add_days(getdate(po.transaction_date), 30))
|
||||
|
||||
def test_subcontracting(self):
|
||||
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
|
||||
@ -303,6 +303,10 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
make_stock_entry(target="_Test Warehouse - _TC", qty=10, basic_rate=100)
|
||||
make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item Home Desktop 100",
|
||||
qty=20, basic_rate=100)
|
||||
make_stock_entry(target="_Test Warehouse 1 - _TC", item_code="_Test Item",
|
||||
qty=30, basic_rate=100)
|
||||
make_stock_entry(target="_Test Warehouse 1 - _TC", item_code="_Test Item Home Desktop 100",
|
||||
qty=30, basic_rate=100)
|
||||
|
||||
bin1 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
@ -349,6 +353,11 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
|
||||
self.assertEquals(bin5.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
|
||||
|
||||
make_stock_entry(target="_Test Warehouse 1 - _TC", item_code="_Test Item",
|
||||
qty=40, basic_rate=100)
|
||||
make_stock_entry(target="_Test Warehouse 1 - _TC", item_code="_Test Item Home Desktop 100",
|
||||
qty=40, basic_rate=100)
|
||||
|
||||
# make Purchase Receipt against PO
|
||||
pr = make_purchase_receipt(po.name)
|
||||
pr.supplier_warehouse = "_Test Warehouse 1 - _TC"
|
||||
|
@ -599,3 +599,5 @@ erpnext.patches.v11_1.set_variant_based_on
|
||||
erpnext.patches.v11_1.woocommerce_set_creation_user
|
||||
erpnext.patches.v11_1.set_salary_details_submittable
|
||||
erpnext.patches.v11_1.rename_depends_on_lwp
|
||||
execute:frappe.delete_doc("Report", "Inactive Items")
|
||||
erpnext.patches.v11_1.delete_scheduling_tool
|
||||
|
9
erpnext/patches/v11_1/delete_scheduling_tool.py
Normal file
9
erpnext/patches/v11_1/delete_scheduling_tool.py
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
if frappe.db.exists("DocType", "Scheduling Tool"):
|
||||
frappe.delete_doc("DocType", "Scheduling Tool", ignore_permissions=True)
|
@ -97,6 +97,10 @@ class ItemVariantsCacheManager:
|
||||
for key in keys:
|
||||
frappe.cache().hdel(key, self.item_code)
|
||||
|
||||
def rebuild_cache(self):
|
||||
self.clear_cache()
|
||||
enqueue_build_cache(self.item_code)
|
||||
|
||||
|
||||
def build_cache(item_code):
|
||||
frappe.cache().hset('item_cache_build_in_progress', item_code, 1)
|
||||
|
@ -358,7 +358,8 @@ class Project(Document):
|
||||
if not self.get('deleted_task_list'): return
|
||||
|
||||
for d in self.get('deleted_task_list'):
|
||||
frappe.delete_doc("Task", d)
|
||||
# unlink project
|
||||
frappe.db.set_value('Task', d, 'project', '')
|
||||
|
||||
self.deleted_task_list = []
|
||||
|
||||
|
@ -163,6 +163,13 @@ class Task(NestedSet):
|
||||
if check_if_child_exists(self.name):
|
||||
throw(_("Child Task exists for this Task. You can not delete this Task."))
|
||||
|
||||
if self.project:
|
||||
tasks = frappe.get_doc('Project', self.project).tasks
|
||||
for task in tasks:
|
||||
if task.get('task_id') == self.name:
|
||||
frappe.delete_doc('Project Task', task.name)
|
||||
|
||||
|
||||
self.update_nsm_model()
|
||||
|
||||
def update_status(self):
|
||||
|
@ -123,5 +123,6 @@ frappe.ui.form.on("Customer", {
|
||||
},
|
||||
validate: function(frm) {
|
||||
if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
|
||||
|
||||
},
|
||||
});
|
@ -60,6 +60,10 @@ class Customer(TransactionBase):
|
||||
if self.loyalty_program == customer.loyalty_program and not self.loyalty_program_tier:
|
||||
self.loyalty_program_tier = customer.loyalty_program_tier
|
||||
|
||||
if self.sales_team:
|
||||
if sum([member.allocated_percentage for member in self.sales_team]) != 100:
|
||||
frappe.throw(_("Total contribution percentage should be equal to 100"))
|
||||
|
||||
def check_customer_group_change(self):
|
||||
frappe.flags.customer_group_changed = False
|
||||
|
||||
|
@ -964,7 +964,7 @@ def invalidate_item_variants_cache_for_website(doc):
|
||||
|
||||
if item_code:
|
||||
item_cache = ItemVariantsCacheManager(item_code)
|
||||
item_cache.clear_cache()
|
||||
item_cache.rebuild_cache()
|
||||
|
||||
|
||||
def check_stock_uom_with_bin(item, stock_uom):
|
||||
|
@ -1116,7 +1116,7 @@ class StockEntry(StockController):
|
||||
frappe.MappingMismatchError)
|
||||
|
||||
def validate_batch(self):
|
||||
if self.purpose in ["Material Transfer for Manufacture", "Manufacture", "Repack", "Send to Subcontractor", "Material Issue"]:
|
||||
if self.purpose in ["Material Transfer for Manufacture", "Manufacture", "Repack", "Send to Subcontractor"]:
|
||||
for item in self.get("items"):
|
||||
if item.batch_no:
|
||||
disabled = frappe.db.get_value("Batch", item.batch_no, "disabled")
|
||||
|
@ -40,6 +40,13 @@ $(document).ready(function() {
|
||||
right: 0%;
|
||||
width: 100%;
|
||||
}
|
||||
{% include "templates/styles/card_style.css" %}
|
||||
header, footer {
|
||||
display: none;
|
||||
}
|
||||
html, body {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user