Merge branch 'develop' into mergify/bp/develop/pr-27792

This commit is contained in:
Deepesh Garg 2021-10-05 17:22:24 +05:30 committed by GitHub
commit fee54023a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 32 deletions

View File

@ -2023,11 +2023,7 @@ class TestSalesInvoice(unittest.TestCase):
frappe.local.enable_perpetual_inventory['_Test Company 1'] = old_perpetual_inventory
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", old_negative_stock)
def test_sle_if_target_warehouse_exists_accidentally(self):
"""
Check if inward entry exists if Target Warehouse accidentally exists
but Customer is not an internal customer.
"""
def test_sle_for_target_warehouse(self):
se = make_stock_entry(
item_code="138-CMS Shoe",
target="Finished Goods - _TC",
@ -2048,9 +2044,9 @@ class TestSalesInvoice(unittest.TestCase):
sles = frappe.get_all("Stock Ledger Entry", filters={"voucher_no": si.name},
fields=["name", "actual_qty"])
# check if only one SLE for outward entry is created
self.assertEqual(len(sles), 1)
self.assertEqual(sles[0].actual_qty, -1)
# check if both SLEs are created
self.assertEqual(len(sles), 2)
self.assertEqual(sum(d.actual_qty for d in sles), 0.0)
# tear down
si.cancel()

View File

@ -424,7 +424,7 @@ class SellingController(StockController):
or (cint(self.is_return) and self.docstatus==2)):
sl_entries.append(self.get_sle_for_source_warehouse(d))
if d.target_warehouse and self.get("is_internal_customer"):
if d.target_warehouse:
sl_entries.append(self.get_sle_for_target_warehouse(d))
if d.warehouse and ((not cint(self.is_return) and self.docstatus==2)
@ -559,6 +559,12 @@ class SellingController(StockController):
frappe.throw(_("Row {0}: Delivery Warehouse ({1}) and Customer Warehouse ({2}) can not be same")
.format(d.idx, warehouse, warehouse))
if not self.get("is_internal_customer") and any(d.get("target_warehouse") for d in items):
msg = _("Target Warehouse is set for some items but the customer is not an internal customer.")
msg += " " + _("This {} will be treated as material transfer.").format(_(self.doctype))
frappe.msgprint(msg, title="Internal Transfer", alert=True)
def validate_items(self):
# validate items to see if they have is_sales_item enabled
from erpnext.controllers.buying_controller import validate_item_type

View File

@ -51,7 +51,7 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
}
}
add_lead_to_prospect (frm) {
add_lead_to_prospect () {
frappe.prompt([
{
fieldname: 'prospect',
@ -65,7 +65,7 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
frappe.call({
method: 'erpnext.crm.doctype.lead.lead.add_lead_to_prospect',
args: {
'lead': frm.doc.name,
'lead': cur_frm.doc.name,
'prospect': data.prospect
},
callback: function(r) {
@ -79,41 +79,41 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
}, __('Add Lead to Prospect'), __('Add'));
}
make_customer (frm) {
make_customer () {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.lead.lead.make_customer",
frm: frm
frm: cur_frm
})
}
make_opportunity (frm) {
make_opportunity () {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
frm: frm
frm: cur_frm
})
}
make_quotation (frm) {
make_quotation () {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.lead.lead.make_quotation",
frm: frm
frm: cur_frm
})
}
make_prospect (frm) {
make_prospect () {
frappe.model.with_doctype("Prospect", function() {
let prospect = frappe.model.get_new_doc("Prospect");
prospect.company_name = frm.doc.company_name;
prospect.no_of_employees = frm.doc.no_of_employees;
prospect.industry = frm.doc.industry;
prospect.market_segment = frm.doc.market_segment;
prospect.territory = frm.doc.territory;
prospect.fax = frm.doc.fax;
prospect.website = frm.doc.website;
prospect.prospect_owner = frm.doc.lead_owner;
prospect.company_name = cur_frm.doc.company_name;
prospect.no_of_employees = cur_frm.doc.no_of_employees;
prospect.industry = cur_frm.doc.industry;
prospect.market_segment = cur_frm.doc.market_segment;
prospect.territory = cur_frm.doc.territory;
prospect.fax = cur_frm.doc.fax;
prospect.website = cur_frm.doc.website;
prospect.prospect_owner = cur_frm.doc.lead_owner;
let lead_prospect_row = frappe.model.add_child(prospect, 'prospect_lead');
lead_prospect_row.lead = frm.doc.name;
lead_prospect_row.lead = cur_frm.doc.name;
frappe.set_route("Form", "Prospect", prospect.name);
});

View File

@ -47,7 +47,7 @@ class MaintenanceSchedule(TransactionBase):
"Yearly": 365
}
for item in self.items:
if item.periodicity and item.start_date:
if item.periodicity and item.periodicity != "Random" and item.start_date:
if not item.end_date:
if item.no_of_visits:
item.end_date = add_days(item.start_date, item.no_of_visits * days_in_period[item.periodicity])

View File

@ -185,7 +185,6 @@ class DeliveryNote(SellingController):
if not d['warehouse'] and frappe.db.get_value("Item", d['item_code'], "is_stock_item") == 1:
frappe.throw(_("Warehouse required for stock Item {0}").format(d["item_code"]))
def update_current_stock(self):
if self.get("_action") and self._action != "update_after_submit":
for d in self.get('items'):

View File

@ -468,7 +468,7 @@
"width": "100px"
},
{
"depends_on": "eval:parent.is_internal_customer",
"depends_on": "eval:parent.is_internal_customer || doc.target_warehouse",
"fieldname": "target_warehouse",
"fieldtype": "Link",
"hidden": 1,
@ -759,7 +759,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-02-23 01:04:08.588104",
"modified": "2021-10-05 12:12:44.018872",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",
@ -767,4 +767,4 @@
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC"
}
}