refactored defaults, bin material request wip

This commit is contained in:
Rushabh Mehta
2013-02-19 15:27:31 +05:30
parent c53231a841
commit 5117d9c266
31 changed files with 55 additions and 377 deletions

View File

@@ -25,6 +25,8 @@ from webnotes.model.code import get_obj
from webnotes import msgprint
sql = webnotes.conn.sql
import webnotes.defaults
class DocType:
def __init__(self, doc, doclist=[]):
@@ -97,7 +99,7 @@ class DocType:
def reorder_item(self,doc_type,doc_name):
""" Reorder item if stock reaches reorder level"""
if not hasattr(webnotes, "auto_indent"):
if not hasattr(webnotes, "auto_indent"):
webnotes.auto_indent = webnotes.conn.get_value('Global Defaults', None, 'auto_indent')
if webnotes.auto_indent:
@@ -117,10 +119,11 @@ class DocType:
def create_material_request(self, doc_type, doc_name):
""" Create indent on reaching reorder level """
defaults = webnotes.conn.get_defaults()
defaults = webnotes.defaults.get_defaults()
mr = webnotes.bean([{
"doctype": "Material Request",
"company": defaults.company,
"fiscal_year": defaults.fiscal_year,
}])
@@ -128,8 +131,6 @@ class DocType:
indent = Document('Material Request')
indent.transaction_date = nowdate()
indent.naming_series = 'IDT'
indent.company = get_defaults()['company']
indent.fiscal_year = get_defaults()['fiscal_year']
indent.remark = """This is an auto generated Material Request.
It was raised because the (actual + ordered + indented - reserved) quantity
reaches re-order level when %s %s was created""" % (doc_type,doc_name)

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, flt, get_defaults
from webnotes.utils import cstr, flt
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
@@ -14,7 +14,6 @@ class DocType(BuyingController):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.defaults = get_defaults()
self.tname = 'Material Request Item'
self.fname = 'indent_details'

View File

@@ -17,7 +17,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, flt, get_defaults
from webnotes.utils import cstr, flt
from webnotes.model.doc import addchild
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
@@ -30,7 +30,6 @@ class DocType(BuyingController):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.defaults = get_defaults()
self.tname = 'Purchase Receipt Item'
self.fname = 'purchase_receipt_details'
self.count = 0

View File

@@ -18,6 +18,7 @@ import webnotes
from webnotes import msgprint, _
import json
from webnotes.utils import flt, cstr
from webnotes.defaults import get_global_default
def validate_end_of_life(item_code, end_of_life=None, verbose=1):
if not end_of_life:
@@ -99,8 +100,7 @@ def get_valuation_method(item_code):
"""get valuation method from item or default"""
val_method = webnotes.conn.get_value('Item', item_code, 'valuation_method')
if not val_method:
from webnotes.utils import get_defaults
val_method = get_defaults().get('valuation_method', 'FIFO')
val_method = get_global_default('valuation_method') or "FIFO"
return val_method
def get_fifo_rate(previous_stock_queue, qty):