mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
fixed conflict while merging with webnotes repo
This commit is contained in:
@@ -168,7 +168,7 @@ class DocType:
|
|||||||
against_voucher = sql("select against_voucher, against_voucher_type from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled, 'No')='No' and company=%s and ifnull(against_voucher, '') != '' and ifnull(against_voucher_type, '') != '' group by against_voucher, against_voucher_type", (self.doc.name, self.doc.company))
|
against_voucher = sql("select against_voucher, against_voucher_type from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled, 'No')='No' and company=%s and ifnull(against_voucher, '') != '' and ifnull(against_voucher_type, '') != '' group by against_voucher, against_voucher_type", (self.doc.name, self.doc.company))
|
||||||
for d in against_voucher:
|
for d in against_voucher:
|
||||||
# get voucher balance
|
# get voucher balance
|
||||||
bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled, 'No')='No'", (d[0], d[1]))
|
bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled, 'No') = 'No'", (d[0], d[1]))
|
||||||
bal = bal and flt(bal[0][0]) or 0.0
|
bal = bal and flt(bal[0][0]) or 0.0
|
||||||
if d[1] == 'Payable Voucher':
|
if d[1] == 'Payable Voucher':
|
||||||
bal = -bal
|
bal = -bal
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
from webnotes import msgprint
|
||||||
|
|
||||||
feed_dict = {
|
feed_dict = {
|
||||||
# Project
|
# Project
|
||||||
'Ticket': ['[%(status)s] %(subject)s', '#000080'],
|
'Project': ['[%(status)s] %(subject)s', '#000080'],
|
||||||
|
|
||||||
# Sales
|
# Sales
|
||||||
'Lead': ['%(lead_name)s', '#000080'],
|
'Lead': ['%(lead_name)s', '#000080'],
|
||||||
@@ -32,9 +33,41 @@ feed_dict = {
|
|||||||
'Support Ticket': ['[%(status)s] %(subject)s', '#000080']
|
'Support Ticket': ['[%(status)s] %(subject)s', '#000080']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
feed_dict_color = {
|
||||||
|
# Project
|
||||||
|
'Project': '#000080',
|
||||||
|
|
||||||
|
# Sales
|
||||||
|
'Lead': '#000080',
|
||||||
|
'Quotation': '#4169E1',
|
||||||
|
'Sales Order': '#4169E1',
|
||||||
|
|
||||||
|
# Purchase
|
||||||
|
'Supplier': '#6495ED',
|
||||||
|
'Purchase Order': '#4169E1',
|
||||||
|
|
||||||
|
# Stock
|
||||||
|
'Delivery Note': '#4169E1',
|
||||||
|
|
||||||
|
# Accounts
|
||||||
|
'Journal Voucher': '#4169E1',
|
||||||
|
'Payable Voucher': '#4169E1',
|
||||||
|
'Receivable Voucher': '#4169E1',
|
||||||
|
|
||||||
|
# HR
|
||||||
|
'Expense Voucher': '#4169E1',
|
||||||
|
'Salary Slip': '#4169E1',
|
||||||
|
'Leave Transaction': '#4169E1',
|
||||||
|
|
||||||
|
# Support
|
||||||
|
'Customer Issue': '#000080',
|
||||||
|
'Maintenance Visit': '#4169E1',
|
||||||
|
'Support Ticket': '#000080'
|
||||||
|
}
|
||||||
|
|
||||||
def make_feed(doc, subject, color):
|
def make_feed(doc, subject, color):
|
||||||
"makes a new Feed record"
|
"makes a new Feed record"
|
||||||
|
#msgprint(subject)
|
||||||
from webnotes.model.doc import Document
|
from webnotes.model.doc import Document
|
||||||
webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name))
|
webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name))
|
||||||
f = Document('Feed')
|
f = Document('Feed')
|
||||||
@@ -44,10 +77,23 @@ def make_feed(doc, subject, color):
|
|||||||
f.color = color
|
f.color = color
|
||||||
f.save(1)
|
f.save(1)
|
||||||
|
|
||||||
|
def update_feed1(doc):
|
||||||
|
"adds a new feed"
|
||||||
|
prop_rec = webnotes.conn.sql("select value from `tabProperty Setter` where doc_type = %s and property = 'subject'", (doc.doctype))
|
||||||
|
if prop_rec:
|
||||||
|
subject = prop_rec[0][0]
|
||||||
|
else:
|
||||||
|
rec = webnotes.conn.sql("select subject from tabDocType where name=%s", (doc.doctype))
|
||||||
|
subject = rec[0][0]
|
||||||
|
|
||||||
|
subject, color = [subject, feed_dict_color.get(doc.doctype)]
|
||||||
|
if subject:
|
||||||
|
subject = subject % doc.fields
|
||||||
|
make_feed(doc, subject, color)
|
||||||
|
|
||||||
def update_feed(doc):
|
def update_feed(doc):
|
||||||
"adds a new feed"
|
"adds a new feed"
|
||||||
subject, color = feed_dict.get(doc.doctype, [None, None])
|
subject, color = feed_dict.get(doc.doctype, [None, None])
|
||||||
if subject:
|
if subject:
|
||||||
subject = subject % doc.fields
|
subject = subject % doc.fields
|
||||||
make_feed(doc, subject, color)
|
make_feed(doc, subject, color)
|
||||||
|
|
||||||
|
|||||||
@@ -1218,9 +1218,10 @@ def execute(patch_no):
|
|||||||
sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'Button'")
|
sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'Button'")
|
||||||
reload_doc('setup', 'doctype', 'company')
|
reload_doc('setup', 'doctype', 'company')
|
||||||
elif patch_no == 308:
|
elif patch_no == 308:
|
||||||
from erpnext_structure_cleanup import run_patches
|
sql("update `tabDocField` set reqd = 0 where fieldname = 'select_item' and parent = 'Property Setter'")
|
||||||
run_patches()
|
|
||||||
elif patch_no == 309:
|
elif patch_no == 309:
|
||||||
sql("delete from `tabDocField` where fieldname = 'item_attachments_details' and parent = 'Item'")
|
sql("delete from `tabDocField` where fieldname = 'item_attachments_details' and parent = 'Item'")
|
||||||
elif patch_no == 310:
|
|
||||||
sql("delete from `tabModule Def Item` where parent = 'Stock' and doc_name = 'Landed Cost Wizard'")
|
sql("delete from `tabModule Def Item` where parent = 'Stock' and doc_name = 'Landed Cost Wizard'")
|
||||||
|
elif patch_no == 310:
|
||||||
|
from erpnext_structure_cleanup import run_patches
|
||||||
|
run_patches()
|
||||||
|
|||||||
@@ -5,64 +5,60 @@ from webnotes.model.doc import Document
|
|||||||
from webnotes.model.doclist import getlist
|
from webnotes.model.doclist import getlist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import session, form, is_testing, msgprint, errprint
|
from webnotes import session, form, is_testing, msgprint, errprint
|
||||||
|
from webnotes.utils import flt
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
convert_to_lists = webnotes.conn.convert_to_lists
|
convert_to_lists = webnotes.conn.convert_to_lists
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
self.nsm_parent_field = 'parent_sales_person';
|
self.nsm_parent_field = 'parent_sales_person';
|
||||||
|
|
||||||
def check_state(self):
|
def check_state(self):
|
||||||
return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
|
return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
|
||||||
|
|
||||||
|
|
||||||
# update Node Set Model
|
# update Node Set Model
|
||||||
def update_nsm_model(self):
|
def update_nsm_model(self):
|
||||||
import webnotes
|
import webnotes
|
||||||
import webnotes.utils.nestedset
|
import webnotes.utils.nestedset
|
||||||
webnotes.utils.nestedset.update_nsm(self)
|
webnotes.utils.nestedset.update_nsm(self)
|
||||||
|
|
||||||
# ON UPDATE
|
# ON UPDATE
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
# update nsm
|
# update nsm
|
||||||
self.update_nsm_model()
|
self.update_nsm_model()
|
||||||
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
from webnotes.utils import flt
|
for d in getlist(self.doclist, 'target_details'):
|
||||||
for d in getlist(self.doclist, 'target_details'):
|
if not flt(d.target_qty) and not flt(d.target_amount):
|
||||||
if not flt(d.target_qty) and not flt(d.target_amount):
|
msgprint("Either target qty or target amount is mandatory.")
|
||||||
msgprint("Either target qty or target amount is mandatory.")
|
raise Exception
|
||||||
raise Exception
|
|
||||||
|
|
||||||
#self.sync_with_contact()
|
#self.sync_with_contact()
|
||||||
|
|
||||||
def sync_with_contact(self):
|
def sync_with_contact(self):
|
||||||
cid = sql("select name from tabContact where sales_person_id = %s and is_sales_person=1", self.doc.name)
|
cid = sql("select name from tabContact where sales_person_id = %s and is_sales_person=1", self.doc.name)
|
||||||
if cid:
|
if cid:
|
||||||
d = Document('Contact', cid[0][0])
|
d = Document('Contact', cid[0][0])
|
||||||
else:
|
else:
|
||||||
d = Document('Contact')
|
d = Document('Contact')
|
||||||
|
|
||||||
name_split = self.doc.sales_person_name.split()
|
|
||||||
d.contact_name = self.doc.sales_person_name
|
|
||||||
d.first_name = name_split[0]
|
|
||||||
d.last_name = len(name_split) > 1 and name_split[1] or ''
|
|
||||||
d.email_id = self.doc.email_id
|
|
||||||
d.contact_no = d.mobile_no = self.doc.mobile_no
|
|
||||||
d.designation = self.doc.designation
|
|
||||||
d.department = self.doc.department
|
|
||||||
d.sales_person_id = self.doc.name
|
|
||||||
d.is_sales_person = 1
|
|
||||||
|
|
||||||
d.save(new = (not d.name))
|
|
||||||
|
|
||||||
|
name_split = self.doc.sales_person_name.split()
|
||||||
|
d.contact_name = self.doc.sales_person_name
|
||||||
|
d.first_name = name_split[0]
|
||||||
|
d.last_name = len(name_split) > 1 and name_split[1] or ''
|
||||||
|
d.email_id = self.doc.email_id
|
||||||
|
d.contact_no = d.mobile_no = self.doc.mobile_no
|
||||||
|
d.designation = self.doc.designation
|
||||||
|
d.department = self.doc.department
|
||||||
|
d.sales_person_id = self.doc.name
|
||||||
|
d.is_sales_person = 1
|
||||||
|
|
||||||
|
d.save(new = (not d.name))
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ get_value = webnotes.conn.get_value
|
|||||||
in_transaction = webnotes.conn.in_transaction
|
in_transaction = webnotes.conn.in_transaction
|
||||||
convert_to_lists = webnotes.conn.convert_to_lists
|
convert_to_lists = webnotes.conn.convert_to_lists
|
||||||
|
|
||||||
|
from server_tools.gateway_utils import update_client_control, get_total_users
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@@ -36,10 +38,10 @@ class DocType:
|
|||||||
#-----------------------
|
#-----------------------
|
||||||
def set_account_details(self, args):
|
def set_account_details(self, args):
|
||||||
args = eval(args)
|
args = eval(args)
|
||||||
|
#webnotes.logger.error("args in set_account_details of setup_control: " + str(args))
|
||||||
self.set_cp_defaults(args['company_name'], args['industry'], args['time_zone'], args['country'], args['account_name'])
|
self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name'])
|
||||||
self.create_profile(args['user'], args['first_name'], args['last_name'])
|
self.create_profile(args['user'], args['first_name'], args['last_name'])
|
||||||
self.update_client_control()
|
update_client_control(args['total_users'])
|
||||||
|
|
||||||
|
|
||||||
# Account Setup
|
# Account Setup
|
||||||
@@ -164,14 +166,6 @@ class DocType:
|
|||||||
d.role = r
|
d.role = r
|
||||||
d.save(1)
|
d.save(1)
|
||||||
|
|
||||||
# Update WN ERP Client Control
|
|
||||||
# -----------------------------
|
|
||||||
def update_client_control(self):
|
|
||||||
cl = Document('WN ERP Client Control','WN ERP Client Control')
|
|
||||||
cl.account_start_date = nowdate()
|
|
||||||
cl.total_users = 1
|
|
||||||
cl.is_trial_account = 1
|
|
||||||
cl.save()
|
|
||||||
|
|
||||||
# Sync DB
|
# Sync DB
|
||||||
# -------
|
# -------
|
||||||
@@ -179,3 +173,30 @@ class DocType:
|
|||||||
import webnotes.model.db_schema
|
import webnotes.model.db_schema
|
||||||
sql("delete from `tabDocType Update Register`")
|
sql("delete from `tabDocType Update Register`")
|
||||||
webnotes.model.db_schema.sync_all()
|
webnotes.model.db_schema.sync_all()
|
||||||
|
|
||||||
|
|
||||||
|
def is_setup_okay(self, args):
|
||||||
|
"""
|
||||||
|
Validates if setup has been performed after database allocation
|
||||||
|
"""
|
||||||
|
|
||||||
|
args = eval(args)
|
||||||
|
#webnotes.logger.error("args in set_account_details of setup_control: " + str(args))
|
||||||
|
|
||||||
|
cp_defaults = webnotes.conn.get_value('Control Panel', None, 'account_id')
|
||||||
|
|
||||||
|
user_profile = webnotes.conn.get_value('Profile', args['user'], 'name')
|
||||||
|
|
||||||
|
from webnotes.utils import cint
|
||||||
|
|
||||||
|
total_users = get_total_users()
|
||||||
|
|
||||||
|
#webnotes.logger.error("setup_control.is_setup_okay: " + cp_defaults + " " + user_profile + " " + str(total_users))
|
||||||
|
|
||||||
|
#webnotes.logger.error("setup_control.is_setup_okay: Passed Values:" + args['account_name'] + " " + args['user'] + " " + str(args['total_users']))
|
||||||
|
|
||||||
|
|
||||||
|
if (cp_defaults==args['account_name']) and user_profile and \
|
||||||
|
(total_users==cint(args['total_users'])):
|
||||||
|
return 'True'
|
||||||
|
|
||||||
@@ -127,15 +127,18 @@ class DocType:
|
|||||||
# update mar
|
# update mar
|
||||||
# -----------
|
# -----------
|
||||||
def update_mar(self, d, qty_diff):
|
def update_mar(self, d, qty_diff):
|
||||||
|
"""
|
||||||
|
update item valuation in previous date and also on post date if no qty diff
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.update_item_valuation_pre_date(d)
|
||||||
|
|
||||||
if not flt(d[self.label['qty']]) and not flt(d[self.label['actual_qty']]):
|
if not flt(d[self.label['qty']]) and not flt(d[self.label['actual_qty']]):
|
||||||
# seems like a special condition when there is no actual quanitity but there is a rate, may be only for setting a rate!
|
# seems like a special condition when there is no actual quanitity but there is a rate, may be only for setting a rate!
|
||||||
self.make_sl_entry(1,d,1)
|
self.make_sl_entry(1,d,1)
|
||||||
self.make_sl_entry(1,d,-1)
|
self.make_sl_entry(1,d,-1)
|
||||||
else:
|
elif not qty_diff:
|
||||||
self.update_item_valuation_pre_date(d)
|
self.update_item_valuation_post_date(d)
|
||||||
|
|
||||||
if not qty_diff:
|
|
||||||
self.update_item_valuation_post_date(d)
|
|
||||||
|
|
||||||
# update valuation rate as csv file in all sle before reconciliation date
|
# update valuation rate as csv file in all sle before reconciliation date
|
||||||
# ------------------------------------------------------------------------
|
# ------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class SupportMailbox(POP3Mailbox):
|
|||||||
# update feed
|
# update feed
|
||||||
update_feed(d)
|
update_feed(d)
|
||||||
|
|
||||||
|
|
||||||
def get_support_mails():
|
def get_support_mails():
|
||||||
"""
|
"""
|
||||||
Gets new emails from support inbox and updates / creates Support Ticket records
|
Gets new emails from support inbox and updates / creates Support Ticket records
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ $.extend(cur_frm.cscript, {
|
|||||||
refresh: function(doc) {
|
refresh: function(doc) {
|
||||||
cs.make_listing(doc);
|
cs.make_listing(doc);
|
||||||
if(!doc.__islocal) {
|
if(!doc.__islocal) {
|
||||||
|
|
||||||
|
if(doc.allocated_to)
|
||||||
|
set_field_permlevel('status',2);
|
||||||
|
if(user==doc.allocated_to && doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cs['Close Ticket']);
|
||||||
|
if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cs['Re-Open Ticket']);
|
||||||
|
|
||||||
// can't change the main message & subject once set
|
// can't change the main message & subject once set
|
||||||
set_field_permlevel('subject',2);
|
set_field_permlevel('subject',2);
|
||||||
set_field_permlevel('description',2);
|
set_field_permlevel('description',2);
|
||||||
@@ -87,10 +93,37 @@ $.extend(cur_frm.cscript, {
|
|||||||
}
|
}
|
||||||
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
|
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
|
||||||
if(doc.customer) unhide_field(['customer_name','address_display','contact_display','contact_mobile','contact_email']);
|
if(doc.customer) unhide_field(['customer_name','address_display','contact_display','contact_mobile','contact_email']);
|
||||||
|
},
|
||||||
|
|
||||||
|
'Close Ticket': function() {
|
||||||
|
var doc = cur_frm.doc
|
||||||
|
|
||||||
|
var answer = confirm("Close Ticket "+doc.name+"?\n\nAllocated To: "+doc.allocated_to+"\n\nSubject: "+doc.subject+"");
|
||||||
|
if(answer) {
|
||||||
|
if(doc.name)
|
||||||
|
$c_obj([doc],'close_ticket','',function(r,rt) {
|
||||||
|
cur_frm.refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'Re-Open Ticket': function() {
|
||||||
|
var doc = cur_frm.doc
|
||||||
|
|
||||||
|
var answer = confirm("Re-Open Ticket "+doc.name+"?\n\nAllocated To: "+doc.allocated_to+"\n\nSubject: "+doc.subject+"");
|
||||||
|
if(answer) {
|
||||||
|
if(doc.name)
|
||||||
|
$c_obj([doc],'reopen_ticket','',function(r,rt) {
|
||||||
|
cur_frm.refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EmailMessage = function(parent, args, list, idx) {
|
EmailMessage = function(parent, args, list, idx) {
|
||||||
var me = this;
|
var me = this;
|
||||||
$.extend(this, args);
|
$.extend(this, args);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase
|
||||||
|
from home import update_feed
|
||||||
|
|
||||||
class DocType(TransactionBase):
|
class DocType(TransactionBase):
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
@@ -46,3 +47,11 @@ class DocType(TransactionBase):
|
|||||||
d.mail = response
|
d.mail = response
|
||||||
d.content_type = content_type
|
d.content_type = content_type
|
||||||
d.save(1)
|
d.save(1)
|
||||||
|
|
||||||
|
def close_ticket(self):
|
||||||
|
webnotes.conn.set(self.doc,'status','Closed')
|
||||||
|
update_feed(self.doc)
|
||||||
|
|
||||||
|
def reopen_ticket(self):
|
||||||
|
webnotes.conn.set(self.doc,'status','Open')
|
||||||
|
update_feed(self.doc)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -48,16 +48,16 @@ class DocType:
|
|||||||
act_qty = act_qty and flt(act_qty[0][0]) or 0
|
act_qty = act_qty and flt(act_qty[0][0]) or 0
|
||||||
|
|
||||||
# get indented_qty
|
# get indented_qty
|
||||||
ind_qty = sql("select sum(if( ifnull(t2.qty, 0) > ifnull(t2.ordered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.ordered_qty, 0), 0) ) from `tabIndent` t1, `tabIndent Detail`t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s'" % (wh, item))
|
ind_qty = sql("select sum(if( ifnull(t2.qty, 0) > ifnull(t2.ordered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.ordered_qty, 0), 0) ) from `tabIndent` t1, `tabIndent Detail`t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
|
||||||
ind_qty = ind_qty and flt(ind_qty[0][0]) or 0
|
ind_qty = ind_qty and flt(ind_qty[0][0]) or 0
|
||||||
|
|
||||||
# get ordered_qty
|
# get ordered_qty
|
||||||
ord_qty = sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.received_qty, 0), (ifnull(t2.qty, 0) - ifnull(t2.received_qty, 0)) * ifnull(t2.conversion_factor, 0) , 0) ) from `tabPurchase Order` t1, `tabPO Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s'" % (wh, item))
|
ord_qty = sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.received_qty, 0), (ifnull(t2.qty, 0) - ifnull(t2.received_qty, 0)) * ifnull(t2.conversion_factor, 0) , 0) ) from `tabPurchase Order` t1, `tabPO Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
|
||||||
ord_qty = ord_qty and flt(ord_qty[0][0]) or 0
|
ord_qty = ord_qty and flt(ord_qty[0][0]) or 0
|
||||||
|
|
||||||
|
|
||||||
# get reserved_qty
|
# get reserved_qty
|
||||||
res_qty =sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.delivered_qty, 0) , 0) ) from `tabSales Order` t1, `tabSales Order Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.reserved_warehouse = '%s' and t2.item_code = '%s' " % (wh, item))
|
res_qty =sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.delivered_qty, 0) , 0) ) from `tabSales Order` t1, `tabSales Order Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.reserved_warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
|
||||||
res_qty = res_qty and flt(res_qty[0][0]) or 0
|
res_qty = res_qty and flt(res_qty[0][0]) or 0
|
||||||
|
|
||||||
# get planned_qty
|
# get planned_qty
|
||||||
|
|||||||
Reference in New Issue
Block a user