chore: Delivery Note Return status

This commit is contained in:
marination 2020-07-31 20:01:06 +05:30
parent 66069df020
commit ba37fe796c
5 changed files with 52 additions and 5 deletions

View File

@ -58,6 +58,7 @@ status_map = {
"Delivery Note": [
["Draft", None],
["To Bill", "eval:self.per_billed < 100 and self.docstatus == 1"],
["Return Issued", "eval:self.per_returned == 100 and self.docstatus == 1"],
["Completed", "eval:self.per_billed == 100 and self.docstatus == 1"],
["Cancelled", "eval:self.docstatus==2"],
["Closed", "eval:self.status=='Closed'"],

View File

@ -132,6 +132,7 @@
"per_installed",
"installation_status",
"column_break_89",
"per_returned",
"excise_page",
"instructions",
"subscription_section",
@ -1249,13 +1250,23 @@
"fieldtype": "Link",
"label": "Inter Company Reference",
"options": "Purchase Receipt"
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "per_returned",
"fieldtype": "Percent",
"in_list_view": 1,
"label": "% Returned",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
}
],
"icon": "fa fa-truck",
"idx": 146,
"is_submittable": 1,
"links": [],
"modified": "2020-07-18 05:13:55.580420",
"modified": "2020-07-31 19:56:19.800171",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",

View File

@ -55,7 +55,7 @@ class DeliveryNote(SellingController):
'no_allowance': 1
}]
if cint(self.is_return):
self.status_updater.append({
self.status_updater.extend([{
'source_dt': 'Delivery Note Item',
'target_dt': 'Sales Order Item',
'join_field': 'so_detail',
@ -69,7 +69,19 @@ class DeliveryNote(SellingController):
where name=`tabDelivery Note Item`.parent and is_return=1)""",
'second_source_extra_cond': """ and exists (select name from `tabSales Invoice`
where name=`tabSales Invoice Item`.parent and is_return=1 and update_stock=1)"""
})
},
{
'source_dt': 'Delivery Note Item',
'target_dt': 'Delivery Note Item',
'join_field': 'dn_detail',
'target_field': 'returned_qty',
'target_parent_dt': 'Delivery Note',
'target_parent_field': 'per_returned',
'target_ref_field': 'stock_qty',
'source_field': '-1 * stock_qty',
'percent_join_field_parent': 'return_against'
}
])
def before_print(self):
def toggle_print_hide(meta, fieldname):

View File

@ -6,6 +6,8 @@ frappe.listview_settings['Delivery Note'] = {
return [__("Return"), "darkgrey", "is_return,=,Yes"];
} else if (doc.status === "Closed") {
return [__("Closed"), "green", "status,=,Closed"];
} else if (flt(doc.per_returned, 2) == 100) {
return [__("Return Issued"), "grey", "per_returned,=,100"];
} else if (flt(doc.per_billed, 2) < 100) {
return [__("To Bill"), "orange", "per_billed,<,100"];
} else if (flt(doc.per_billed, 2) == 100) {

View File

@ -1,4 +1,5 @@
{
"actions": [],
"autoname": "hash",
"creation": "2013-04-22 13:15:44",
"doctype": "DocType",
@ -24,8 +25,11 @@
"col_break2",
"uom",
"conversion_factor",
"stock_qty_sec_break",
"stock_qty",
"stock_qty_col_break",
"section_break_17",
"returned_qty",
"price_list_rate",
"base_price_list_rate",
"discount_and_margin",
@ -211,7 +215,7 @@
{
"fieldname": "stock_qty",
"fieldtype": "Float",
"label": "Qty as per Stock UOM",
"label": "Qty in Stock UOM",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
@ -715,12 +719,29 @@
"no_copy": 1,
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "stock_qty_sec_break",
"fieldtype": "Section Break"
},
{
"fieldname": "stock_qty_col_break",
"fieldtype": "Column Break"
},
{
"depends_on": "returned_qty",
"fieldname": "returned_qty",
"fieldtype": "Float",
"label": "Returned Qty in Stock UOM",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2020-07-20 12:25:06.177894",
"modified": "2020-07-31 19:43:46.152260",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",