Merge branch 'develop' into more_asset_bug_fixes
This commit is contained in:
commit
ef56060166
@ -4,7 +4,7 @@
|
|||||||
# the repo. Unless a later match takes precedence,
|
# the repo. Unless a later match takes precedence,
|
||||||
|
|
||||||
erpnext/accounts/ @nextchamp-saqib @deepeshgarg007 @ruthra-kumar
|
erpnext/accounts/ @nextchamp-saqib @deepeshgarg007 @ruthra-kumar
|
||||||
erpnext/assets/ @nextchamp-saqib @deepeshgarg007 @ruthra-kumar
|
erpnext/assets/ @anandbaburajan @deepeshgarg007
|
||||||
erpnext/loan_management/ @nextchamp-saqib @deepeshgarg007
|
erpnext/loan_management/ @nextchamp-saqib @deepeshgarg007
|
||||||
erpnext/regional @nextchamp-saqib @deepeshgarg007 @ruthra-kumar
|
erpnext/regional @nextchamp-saqib @deepeshgarg007 @ruthra-kumar
|
||||||
erpnext/selling @nextchamp-saqib @deepeshgarg007 @ruthra-kumar
|
erpnext/selling @nextchamp-saqib @deepeshgarg007 @ruthra-kumar
|
||||||
|
@ -124,12 +124,11 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
frappe.urllib.get_full_url(
|
frappe.urllib.get_full_url(
|
||||||
"/api/method/erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_pdf?" +
|
"/api/method/erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_pdf?" +
|
||||||
new URLSearchParams({
|
new URLSearchParams({
|
||||||
doctype: frm.doc.doctype,
|
|
||||||
name: frm.doc.name,
|
name: frm.doc.name,
|
||||||
supplier: data.supplier,
|
supplier: data.supplier,
|
||||||
print_format: data.print_format || "Standard",
|
print_format: data.print_format || "Standard",
|
||||||
language: data.language || frappe.boot.lang,
|
language: data.language || frappe.boot.lang,
|
||||||
letter_head: data.letter_head || frm.doc.letter_head || "",
|
letterhead: data.letter_head || frm.doc.letter_head || "",
|
||||||
}).toString()
|
}).toString()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
@ -388,26 +389,28 @@ def create_rfq_items(sq_doc, supplier, data):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_pdf(doctype, name, supplier, print_format=None, language=None, letter_head=None):
|
def get_pdf(
|
||||||
|
name: str,
|
||||||
|
supplier: str,
|
||||||
|
print_format: Optional[str] = None,
|
||||||
|
language: Optional[str] = None,
|
||||||
|
letterhead: Optional[str] = None,
|
||||||
|
):
|
||||||
|
doc = frappe.get_doc("Request for Quotation", name)
|
||||||
|
if supplier:
|
||||||
|
doc.update_supplier_part_no(supplier)
|
||||||
|
|
||||||
# permissions get checked in `download_pdf`
|
# permissions get checked in `download_pdf`
|
||||||
if doc := get_rfq_doc(doctype, name, supplier):
|
|
||||||
download_pdf(
|
download_pdf(
|
||||||
doctype,
|
doc.doctype,
|
||||||
name,
|
doc.name,
|
||||||
print_format,
|
print_format,
|
||||||
doc=doc,
|
doc=doc,
|
||||||
language=language,
|
language=language,
|
||||||
letter_head=letter_head or None,
|
letterhead=letterhead or None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_rfq_doc(doctype, name, supplier):
|
|
||||||
if supplier:
|
|
||||||
doc = frappe.get_doc(doctype, name)
|
|
||||||
doc.update_supplier_part_no(supplier)
|
|
||||||
return doc
|
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_item_from_material_requests_based_on_supplier(source_name, target_doc=None):
|
def get_item_from_material_requests_based_on_supplier(source_name, target_doc=None):
|
||||||
mr_items_list = frappe.db.sql(
|
mr_items_list = frappe.db.sql(
|
||||||
|
@ -8,6 +8,7 @@ from frappe.utils import nowdate
|
|||||||
|
|
||||||
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import (
|
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import (
|
||||||
create_supplier_quotation,
|
create_supplier_quotation,
|
||||||
|
get_pdf,
|
||||||
make_supplier_quotation_from_rfq,
|
make_supplier_quotation_from_rfq,
|
||||||
)
|
)
|
||||||
from erpnext.crm.doctype.opportunity.opportunity import make_request_for_quotation as make_rfq
|
from erpnext.crm.doctype.opportunity.opportunity import make_request_for_quotation as make_rfq
|
||||||
@ -124,6 +125,11 @@ class TestRequestforQuotation(FrappeTestCase):
|
|||||||
rfq.status = "Draft"
|
rfq.status = "Draft"
|
||||||
rfq.submit()
|
rfq.submit()
|
||||||
|
|
||||||
|
def test_get_pdf(self):
|
||||||
|
rfq = make_request_for_quotation()
|
||||||
|
get_pdf(rfq.name, rfq.get("suppliers")[0].supplier)
|
||||||
|
self.assertEqual(frappe.local.response.type, "pdf")
|
||||||
|
|
||||||
|
|
||||||
def make_request_for_quotation(**args):
|
def make_request_for_quotation(**args):
|
||||||
"""
|
"""
|
||||||
|
@ -110,8 +110,11 @@ frappe.ui.form.on('Material Request', {
|
|||||||
|
|
||||||
if (frm.doc.material_request_type === "Material Transfer") {
|
if (frm.doc.material_request_type === "Material Transfer") {
|
||||||
add_create_pick_list_button();
|
add_create_pick_list_button();
|
||||||
frm.add_custom_button(__("Transfer Material"),
|
frm.add_custom_button(__("Material Transfer"),
|
||||||
() => frm.events.make_stock_entry(frm), __('Create'));
|
() => frm.events.make_stock_entry(frm), __('Create'));
|
||||||
|
|
||||||
|
frm.add_custom_button(__("Material Transfer (In Transit)"),
|
||||||
|
() => frm.events.make_in_transit_stock_entry(frm), __('Create'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frm.doc.material_request_type === "Material Issue") {
|
if (frm.doc.material_request_type === "Material Issue") {
|
||||||
@ -333,6 +336,46 @@ frappe.ui.form.on('Material Request', {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
make_in_transit_stock_entry(frm) {
|
||||||
|
frappe.prompt(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
label: __('In Transit Warehouse'),
|
||||||
|
fieldname: 'in_transit_warehouse',
|
||||||
|
fieldtype: 'Link',
|
||||||
|
options: 'Warehouse',
|
||||||
|
reqd: 1,
|
||||||
|
get_query: () => {
|
||||||
|
return{
|
||||||
|
filters: {
|
||||||
|
'company': frm.doc.company,
|
||||||
|
'is_group': 0,
|
||||||
|
'warehouse_type': 'Transit'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
(values) => {
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.stock.doctype.material_request.material_request.make_in_transit_stock_entry",
|
||||||
|
args: {
|
||||||
|
source_name: frm.doc.name,
|
||||||
|
in_transit_warehouse: values.in_transit_warehouse
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
if (r.message) {
|
||||||
|
let doc = frappe.model.sync(r.message);
|
||||||
|
frappe.set_route('Form', doc[0].doctype, doc[0].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
__('In Transit Transfer'),
|
||||||
|
__("Create Stock Entry")
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
create_pick_list: (frm) => {
|
create_pick_list: (frm) => {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.stock.doctype.material_request.material_request.create_pick_list",
|
method: "erpnext.stock.doctype.material_request.material_request.create_pick_list",
|
||||||
|
@ -716,3 +716,14 @@ def create_pick_list(source_name, target_doc=None):
|
|||||||
doc.set_item_locations()
|
doc.set_item_locations()
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def make_in_transit_stock_entry(source_name, in_transit_warehouse):
|
||||||
|
ste_doc = make_stock_entry(source_name)
|
||||||
|
ste_doc.add_to_transit = 1
|
||||||
|
|
||||||
|
for row in ste_doc.items:
|
||||||
|
row.t_warehouse = in_transit_warehouse
|
||||||
|
|
||||||
|
return ste_doc
|
||||||
|
@ -11,6 +11,7 @@ from frappe.utils import flt, today
|
|||||||
|
|
||||||
from erpnext.stock.doctype.item.test_item import create_item
|
from erpnext.stock.doctype.item.test_item import create_item
|
||||||
from erpnext.stock.doctype.material_request.material_request import (
|
from erpnext.stock.doctype.material_request.material_request import (
|
||||||
|
make_in_transit_stock_entry,
|
||||||
make_purchase_order,
|
make_purchase_order,
|
||||||
make_stock_entry,
|
make_stock_entry,
|
||||||
make_supplier_quotation,
|
make_supplier_quotation,
|
||||||
@ -56,6 +57,22 @@ class TestMaterialRequest(FrappeTestCase):
|
|||||||
self.assertEqual(se.doctype, "Stock Entry")
|
self.assertEqual(se.doctype, "Stock Entry")
|
||||||
self.assertEqual(len(se.get("items")), len(mr.get("items")))
|
self.assertEqual(len(se.get("items")), len(mr.get("items")))
|
||||||
|
|
||||||
|
def test_in_transit_make_stock_entry(self):
|
||||||
|
mr = frappe.copy_doc(test_records[0]).insert()
|
||||||
|
|
||||||
|
self.assertRaises(frappe.ValidationError, make_stock_entry, mr.name)
|
||||||
|
|
||||||
|
mr = frappe.get_doc("Material Request", mr.name)
|
||||||
|
mr.material_request_type = "Material Transfer"
|
||||||
|
mr.submit()
|
||||||
|
|
||||||
|
in_transit_warehouse = get_in_transit_warehouse(mr.company)
|
||||||
|
se = make_in_transit_stock_entry(mr.name, in_transit_warehouse)
|
||||||
|
|
||||||
|
self.assertEqual(se.doctype, "Stock Entry")
|
||||||
|
for row in se.get("items"):
|
||||||
|
self.assertEqual(row.t_warehouse, in_transit_warehouse)
|
||||||
|
|
||||||
def _insert_stock_entry(self, qty1, qty2, warehouse=None):
|
def _insert_stock_entry(self, qty1, qty2, warehouse=None):
|
||||||
se = frappe.get_doc(
|
se = frappe.get_doc(
|
||||||
{
|
{
|
||||||
@ -742,6 +759,36 @@ class TestMaterialRequest(FrappeTestCase):
|
|||||||
self.assertEqual(existing_requested_qty, current_requested_qty)
|
self.assertEqual(existing_requested_qty, current_requested_qty)
|
||||||
|
|
||||||
|
|
||||||
|
def get_in_transit_warehouse(company):
|
||||||
|
if not frappe.db.exists("Warehouse Type", "Transit"):
|
||||||
|
frappe.get_doc(
|
||||||
|
{
|
||||||
|
"doctype": "Warehouse Type",
|
||||||
|
"name": "Transit",
|
||||||
|
}
|
||||||
|
).insert()
|
||||||
|
|
||||||
|
in_transit_warehouse = frappe.db.exists(
|
||||||
|
"Warehouse", {"warehouse_type": "Transit", "company": company}
|
||||||
|
)
|
||||||
|
|
||||||
|
if not in_transit_warehouse:
|
||||||
|
in_transit_warehouse = (
|
||||||
|
frappe.get_doc(
|
||||||
|
{
|
||||||
|
"doctype": "Warehouse",
|
||||||
|
"warehouse_name": "Transit",
|
||||||
|
"warehouse_type": "Transit",
|
||||||
|
"company": company,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.insert()
|
||||||
|
.name
|
||||||
|
)
|
||||||
|
|
||||||
|
return in_transit_warehouse
|
||||||
|
|
||||||
|
|
||||||
def make_material_request(**args):
|
def make_material_request(**args):
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
mr = frappe.new_doc("Material Request")
|
mr = frappe.new_doc("Material Request")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user