frappe/frappe#478 erpnext install works

This commit is contained in:
Rushabh Mehta
2014-04-02 18:09:34 +05:30
parent 943e614810
commit f191f854cd
55 changed files with 165 additions and 167 deletions

View File

@@ -378,8 +378,8 @@ class AccountsController(TransactionBase):
return gl_dict
def clear_unallocated_advances(self, childtype, parentfield):
self.doclist.remove_items({"parentfield": parentfield, "allocated_amount": ["in", [0, None, ""]]})
self.set(parentfield, self.get(parentfield, {"allocated_amount": ["not in", [0, None, ""]]}))
frappe.db.sql("""delete from `tab%s` where parentfield=%s and parent = %s
and ifnull(allocated_amount, 0) = 0""" % (childtype, '%s', '%s'), (parentfield, self.name))

View File

@@ -40,7 +40,7 @@ class BuyingController(StockController):
def set_supplier_from_item_default(self):
if self.meta.get_field("supplier") and not self.supplier:
for d in self.doclist.get({"doctype": self.tname}):
for d in self.get(self.fname):
supplier = frappe.db.get_value("Item", d.item_code, "default_supplier")
if supplier:
self.supplier = supplier
@@ -50,7 +50,7 @@ class BuyingController(StockController):
from erpnext.stock.utils import validate_warehouse_company
warehouses = list(set([d.warehouse for d in
self.doclist.get({"doctype": self.tname}) if d.warehouse]))
self.get(self.fname) if d.warehouse]))
for w in warehouses:
validate_warehouse_company(w, self.company)

View File

@@ -94,13 +94,13 @@ class StatusUpdater(DocListController):
def communication_received(self):
if getattr(self, "communication_set", False):
last_comm = self.doclist.get({"doctype":"Communication"})
last_comm = self.get("communications")
if last_comm:
return last_comm[-1].sent_or_received == "Received"
def communication_sent(self):
if getattr(self, "communication_set", False):
last_comm = self.doclist.get({"doctype":"Communication"})
last_comm = self.get("communications")
if last_comm:
return last_comm[-1].sent_or_received == "Sent"
@@ -113,7 +113,7 @@ class StatusUpdater(DocListController):
for args in self.status_updater:
# get unique transactions to update
for d in self.doclist:
for d in self.get_all_children():
if d.doctype == args['source_dt'] and d.get(args["join_field"]):
args['name'] = d.get(args['join_field'])
@@ -191,7 +191,7 @@ class StatusUpdater(DocListController):
args['modified_cond'] = ', modified = now()'
# update quantities in child table
for d in self.doclist:
for d in self.get_all_children():
if d.doctype == args['source_dt']:
# updates qty in the child table
args['detail_id'] = d.get(args['join_field'])
@@ -212,8 +212,7 @@ class StatusUpdater(DocListController):
where name='%(detail_id)s'""" % args)
# get unique transactions to update
for name in set([d.get(args['percent_join_field']) for d in self.doclist
if d.doctype == args['source_dt']]):
for name in set([d.get(args['percent_join_field']) for d in self.get_all_children(args['source_dt'])]):
if name:
args['name'] = name

View File

@@ -90,7 +90,7 @@ class StockController(AccountsController):
warehouse_account = get_warehouse_account()
if hasattr(self, "fname"):
item_doclist = self.doclist.get({"parentfield": self.fname})
item_doclist = self.get(self.fname)
elif self.doctype == "Stock Reconciliation":
import json
item_doclist = []