feat: creating stock entry against purchase receipt
This commit is contained in:
parent
0d50523723
commit
4c1639305f
@ -152,9 +152,6 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
|
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
|
||||||
conditions = []
|
conditions = []
|
||||||
|
|
||||||
if not filters["item_group"]:
|
|
||||||
filters.pop("item_group", None)
|
|
||||||
|
|
||||||
description_cond = ''
|
description_cond = ''
|
||||||
if frappe.db.count('Item', cache=True) < 50000:
|
if frappe.db.count('Item', cache=True) < 50000:
|
||||||
# scan description only if items are less than 50000
|
# scan description only if items are less than 50000
|
||||||
|
@ -72,9 +72,10 @@ frappe.ui.form.on("Work Order", {
|
|||||||
frm.set_query("production_item", function() {
|
frm.set_query("production_item", function() {
|
||||||
return {
|
return {
|
||||||
query: "erpnext.controllers.queries.item_query",
|
query: "erpnext.controllers.queries.item_query",
|
||||||
filters:{
|
filters:[
|
||||||
'is_stock_item': 1,
|
['is_stock_item', '=',1],
|
||||||
}
|
['default_bom', '!=', '']
|
||||||
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -107,6 +107,8 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
|||||||
|
|
||||||
cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __('Create'));
|
cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __('Create'));
|
||||||
|
|
||||||
|
cur_frm.add_custom_button(__('Make Stock Entry'), cur_frm.cscript['Make Stock Entry'], __('Create'));
|
||||||
|
|
||||||
if(flt(this.frm.doc.per_billed) < 100) {
|
if(flt(this.frm.doc.per_billed) < 100) {
|
||||||
cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __('Create'));
|
cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __('Create'));
|
||||||
}
|
}
|
||||||
@ -249,6 +251,13 @@ frappe.ui.form.on('Purchase Receipt Item', {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cur_frm.cscript['Make Stock Entry'] = function() {
|
||||||
|
frappe.model.open_mapped_doc({
|
||||||
|
method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_stock_entry",
|
||||||
|
frm: cur_frm,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var validate_sample_quantity = function(frm, cdt, cdn) {
|
var validate_sample_quantity = function(frm, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.sample_quantity) {
|
if (d.sample_quantity) {
|
||||||
|
@ -12,6 +12,7 @@ from frappe.utils import getdate
|
|||||||
from erpnext.controllers.buying_controller import BuyingController
|
from erpnext.controllers.buying_controller import BuyingController
|
||||||
from erpnext.accounts.utils import get_account_currency
|
from erpnext.accounts.utils import get_account_currency
|
||||||
from frappe.desk.notifications import clear_doctype_notifications
|
from frappe.desk.notifications import clear_doctype_notifications
|
||||||
|
from frappe.model.mapper import get_mapped_doc
|
||||||
from erpnext.buying.utils import check_on_hold_or_closed_status
|
from erpnext.buying.utils import check_on_hold_or_closed_status
|
||||||
from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_disabled
|
from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_disabled
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
@ -530,3 +531,24 @@ def make_purchase_return(source_name, target_doc=None):
|
|||||||
def update_purchase_receipt_status(docname, status):
|
def update_purchase_receipt_status(docname, status):
|
||||||
pr = frappe.get_doc("Purchase Receipt", docname)
|
pr = frappe.get_doc("Purchase Receipt", docname)
|
||||||
pr.update_status(status)
|
pr.update_status(status)
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def make_stock_entry(source_name,target_doc=None):
|
||||||
|
def set_missing_values(source, target):
|
||||||
|
target.stock_entry_type = "Material Transfer"
|
||||||
|
target.purpose = "Material Transfer"
|
||||||
|
|
||||||
|
doclist = get_mapped_doc("Purchase Receipt", source_name,{
|
||||||
|
"Purchase Receipt": {
|
||||||
|
"doctype": "Stock Entry",
|
||||||
|
},
|
||||||
|
"Purchase Receipt Item": {
|
||||||
|
"doctype": "Stock Entry Detail",
|
||||||
|
"field_map": {
|
||||||
|
"warehouse": "s_warehouse",
|
||||||
|
"parent": "reference_purchase_receipt"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, target_doc, set_missing_values)
|
||||||
|
|
||||||
|
return doclist
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"t_warehouse",
|
"t_warehouse",
|
||||||
"sec_break1",
|
"sec_break1",
|
||||||
"item_code",
|
"item_code",
|
||||||
|
"item_group",
|
||||||
"col_break2",
|
"col_break2",
|
||||||
"item_name",
|
"item_name",
|
||||||
"section_break_8",
|
"section_break_8",
|
||||||
@ -59,7 +60,8 @@
|
|||||||
"against_stock_entry",
|
"against_stock_entry",
|
||||||
"ste_detail",
|
"ste_detail",
|
||||||
"column_break_51",
|
"column_break_51",
|
||||||
"transferred_qty"
|
"transferred_qty",
|
||||||
|
"reference_purchase_receipt"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@ -72,7 +74,6 @@
|
|||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"columns": 2,
|
|
||||||
"fieldname": "s_warehouse",
|
"fieldname": "s_warehouse",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
@ -86,7 +87,6 @@
|
|||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"columns": 2,
|
|
||||||
"fieldname": "t_warehouse",
|
"fieldname": "t_warehouse",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
@ -101,7 +101,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"bold": 1,
|
"bold": 1,
|
||||||
"columns": 3,
|
|
||||||
"fieldname": "item_code",
|
"fieldname": "item_code",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_global_search": 1,
|
"in_global_search": 1,
|
||||||
@ -164,7 +163,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"bold": 1,
|
"bold": 1,
|
||||||
"columns": 3,
|
|
||||||
"fieldname": "qty",
|
"fieldname": "qty",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
@ -460,15 +458,30 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "dimension_col_break",
|
"fieldname": "dimension_col_break",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fetch_from": "item_code.item_group",
|
||||||
|
"fieldname": "item_group",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Item Group"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "reference_purchase_receipt",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Reference Purchase Receipt",
|
||||||
|
"options": "Purchase Receipt",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2019-05-25 22:51:00.802226",
|
"modified": "2019-06-14 11:58:41.958144",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Entry Detail",
|
"name": "Stock Entry Detail",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
|
"sort_field": "modified",
|
||||||
"sort_order": "ASC"
|
"sort_order": "ASC"
|
||||||
}
|
}
|
@ -41,9 +41,6 @@ frappe.query_reports["Stock Balance"] = {
|
|||||||
"get_query": function() {
|
"get_query": function() {
|
||||||
return {
|
return {
|
||||||
query: "erpnext.controllers.queries.item_query",
|
query: "erpnext.controllers.queries.item_query",
|
||||||
filters: {
|
|
||||||
"item_group": frappe.query_report.get_filter_value("item_group")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user