mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-06 06:58:27 +00:00
[status updater] managed by controllers and commonified for sales and purchase
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, flt, getdate, cint
|
||||
from webnotes.utils import cstr, flt, cint
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint, _
|
||||
@@ -34,6 +34,19 @@ class DocType(SellingController):
|
||||
self.doclist = doclist
|
||||
self.tname = 'Delivery Note Item'
|
||||
self.fname = 'delivery_note_details'
|
||||
self.status_updater = [{
|
||||
'source_dt': 'Delivery Note Item',
|
||||
'target_dt': 'Sales Order Item',
|
||||
'join_field': 'prevdoc_detail_docname',
|
||||
'target_field': 'delivered_qty',
|
||||
'target_parent_dt': 'Sales Order',
|
||||
'target_parent_field': 'per_delivered',
|
||||
'target_ref_field': 'qty',
|
||||
'source_field': 'qty',
|
||||
'percent_join_field': 'prevdoc_docname',
|
||||
'status_field': 'delivery_status',
|
||||
'keyword': 'Delivered'
|
||||
}]
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
|
||||
@@ -261,8 +274,8 @@ class DocType(SellingController):
|
||||
sl_obj.update_serial_record(self, 'delivery_note_details', is_submit = 1, is_incoming = 0)
|
||||
sl_obj.update_serial_record(self, 'packing_details', is_submit = 1, is_incoming = 0)
|
||||
|
||||
# update delivered qty in sales order
|
||||
get_obj("Sales Common").update_prevdoc_detail(1,self)
|
||||
# update delivered qty in sales order
|
||||
self.update_prevdoc_status()
|
||||
|
||||
# create stock ledger entry
|
||||
self.update_stock_ledger(update_stock = 1)
|
||||
@@ -309,7 +322,8 @@ class DocType(SellingController):
|
||||
sl.update_serial_record(self, 'delivery_note_details', is_submit = 0, is_incoming = 0)
|
||||
sl.update_serial_record(self, 'packing_details', is_submit = 0, is_incoming = 0)
|
||||
|
||||
sales_com_obj.update_prevdoc_detail(0,self)
|
||||
self.update_prevdoc_status()
|
||||
|
||||
self.update_stock_ledger(update_stock = -1)
|
||||
webnotes.conn.set(self.doc, 'status', 'Cancelled')
|
||||
self.cancel_packing_slips()
|
||||
|
||||
@@ -33,6 +33,17 @@ class DocType(BuyingController):
|
||||
self.tname = 'Purchase Receipt Item'
|
||||
self.fname = 'purchase_receipt_details'
|
||||
self.count = 0
|
||||
self.status_updater = [{
|
||||
'source_dt': 'Purchase Receipt Item',
|
||||
'target_dt': 'Purchase Order Item',
|
||||
'join_field': 'prevdoc_detail_docname',
|
||||
'target_field': 'received_qty',
|
||||
'target_parent_dt': 'Purchase Order',
|
||||
'target_parent_field': 'per_received',
|
||||
'target_ref_field': 'qty',
|
||||
'source_field': 'qty',
|
||||
'percent_join_field': 'prevdoc_docname',
|
||||
}]
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Transaction Date')
|
||||
@@ -243,8 +254,7 @@ class DocType(BuyingController):
|
||||
# Set status as Submitted
|
||||
webnotes.conn.set(self.doc,'status', 'Submitted')
|
||||
|
||||
# Update Previous Doc i.e. update pending_qty and Status accordingly
|
||||
purchase_controller.update_prevdoc_detail(self, is_submit = 1)
|
||||
self.update_prevdoc_status()
|
||||
|
||||
# Update Serial Record
|
||||
get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 1, is_incoming = 1)
|
||||
@@ -285,8 +295,7 @@ class DocType(BuyingController):
|
||||
# 4.Update Bin
|
||||
self.update_stock(is_submit = 0)
|
||||
|
||||
# 5.Update Material Requests Pending Qty and accordingly it's Status
|
||||
pc_obj.update_prevdoc_detail(self, is_submit = 0)
|
||||
self.update_prevdoc_status()
|
||||
|
||||
# 6. Update last purchase rate
|
||||
pc_obj.update_last_purchase_rate(self, 0)
|
||||
|
||||
@@ -6,7 +6,7 @@ wn.listview_settings['Purchase Receipt'] = {
|
||||
group_by: "`tabPurchase Receipt`.name",
|
||||
prepare_data: function(data) {
|
||||
if(data.purchase_order_no) {
|
||||
data.purchase_order_no = data.purchase_order_no.split(",");
|
||||
data.purchase_order_no = $.unique(data.purchase_order_no.split(","));
|
||||
var po_list = [];
|
||||
$.each(data.purchase_order_no, function(i, v){
|
||||
if(po_list.indexOf(v)==-1) po_list.push(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 11:42:59",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-22 12:01:08",
|
||||
"modified": "2013-05-31 14:26:41",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -453,18 +453,14 @@
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
"default": "0.00",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "billed_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Billed Quantity",
|
||||
"fieldname": "billed_amt",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Billed Amt",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "billed_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"width": "100px"
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
|
||||
Reference in New Issue
Block a user