本文整理汇总了Python中stock.stock_ledger.get_previous_sle函数的典型用法代码示例。如果您正苦于以下问题:Python get_previous_sle函数的具体用法?Python get_previous_sle怎么用?Python get_previous_sle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_previous_sle函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_incoming_rate
def get_incoming_rate(self, args):
incoming_rate = 0
if self.doc.purpose == "Sales Return" and (self.doc.delivery_note_no or self.doc.sales_invoice_no):
sle = webnotes.conn.sql(
"""select name, posting_date, posting_time,
actual_qty, stock_value, warehouse from `tabStock Ledger Entry`
where voucher_type = %s and voucher_no = %s and
item_code = %s and ifnull(is_cancelled, 'No') = 'No' limit 1""",
(
(self.doc.delivery_note_no and "Delivery Note" or "Sales Invoice"),
self.doc.delivery_note_no or self.doc.sales_invoice_no,
args.item_code,
),
as_dict=1,
)
if sle:
args.update(
{
"posting_date": sle[0].posting_date,
"posting_time": sle[0].posting_time,
"sle": sle[0].name,
"warehouse": sle[0].warehouse,
}
)
previous_sle = get_previous_sle(args)
incoming_rate = (flt(sle[0].stock_value) - flt(previous_sle.get("stock_value"))) / flt(
sle[0].actual_qty
)
else:
incoming_rate = get_incoming_rate(args)
return incoming_rate
开发者ID:MiteshC,项目名称:erpnext,代码行数:32,代码来源:stock_entry.py
示例2: insert_stock_ledger_entries
def insert_stock_ledger_entries(self):
""" find difference between current and expected entries
and create stock ledger entries based on the difference"""
from stock.utils import get_valuation_method
from stock.stock_ledger import get_previous_sle
row_template = ["item_code", "warehouse", "qty", "valuation_rate"]
if not self.doc.reconciliation_json:
msgprint(_("""Stock Reconciliation file not uploaded"""), raise_exception=1)
data = json.loads(self.doc.reconciliation_json)
for row_num, row in enumerate(data[data.index(self.head_row)+1:]):
row = webnotes._dict(zip(row_template, row))
previous_sle = get_previous_sle({
"item_code": row.item_code,
"warehouse": row.warehouse,
"posting_date": self.doc.posting_date,
"posting_time": self.doc.posting_time
})
change_in_qty = row.qty != "" and \
(flt(row.qty) - flt(previous_sle.get("qty_after_transaction")))
change_in_rate = row.valuation_rate != "" and \
(flt(row.valuation_rate) != flt(previous_sle.get("valuation_rate")))
if get_valuation_method(row.item_code) == "Moving Average":
self.sle_for_moving_avg(row, previous_sle, change_in_qty, change_in_rate)
else:
self.sle_for_fifo(row, previous_sle, change_in_qty, change_in_rate)
开发者ID:tejastank,项目名称:erpnext,代码行数:32,代码来源:stock_reconciliation.py
示例3: get_warehouse_details
def get_warehouse_details(self, args):
args = json.loads(args)
args.update({"posting_date": self.doc.posting_date, "posting_time": self.doc.posting_time})
args = webnotes._dict(args)
ret = {
"actual_qty": get_previous_sle(args).get("qty_after_transaction") or 0,
"incoming_rate": self.get_incoming_rate(args),
}
return ret
开发者ID:MiteshC,项目名称:erpnext,代码行数:10,代码来源:stock_entry.py
示例4: get_warehouse_details
def get_warehouse_details(self, args):
import json
args, actual_qty, in_rate = json.loads(args), 0, 0
args.update({
"posting_date": self.doc.posting_date,
"posting_time": self.doc.posting_time
})
ret = {
"actual_qty" : get_previous_sle(args).get("qty_after_transaction") or 0,
"incoming_rate" : get_incoming_rate(args)
}
return ret
开发者ID:mtarin,项目名称:erpnext,代码行数:13,代码来源:stock_entry.py
示例5: get_stock_and_rate
def get_stock_and_rate(self):
"""get stock and incoming rate on posting date"""
for d in getlist(self.doclist, 'mtn_details'):
args = webnotes._dict({
"item_code": d.item_code,
"warehouse": d.s_warehouse or d.t_warehouse,
"posting_date": self.doc.posting_date,
"posting_time": self.doc.posting_time,
"qty": d.s_warehouse and -1*d.transfer_qty or d.transfer_qty,
"serial_no": d.serial_no,
"bom_no": d.bom_no,
})
# get actual stock at source warehouse
d.actual_qty = get_previous_sle(args).get("qty_after_transaction") or 0
# get incoming rate
if not flt(d.incoming_rate):
d.incoming_rate = self.get_incoming_rate(args)
d.amount = flt(d.transfer_qty) * flt(d.incoming_rate)
开发者ID:andrewabel,项目名称:erpnext,代码行数:20,代码来源:stock_entry.py
示例6: get_stock_and_rate
def get_stock_and_rate(self):
"""get stock and incoming rate on posting date"""
for d in getlist(self.doclist, 'mtn_details'):
ss=cstr(d.fetch).replace('\n','')
q =webnotes.conn.sql("select quantity from `tabPacking items` where name ='"+ss+"'",as_list=1)
#webnotes.errprint(q)
args = webnotes._dict({
"item_code": d.item_code,
"warehouse": d.s_warehouse or d.t_warehouse,
"posting_date": self.doc.posting_date,
"posting_time": self.doc.posting_time,
"qty": d.s_warehouse and -1*q[0][0] or d.q[0][0],
"serial_no": d.serial_no,
"bom_no": d.bom_no,
})
# get actual stock at source warehouse
d.actual_qty = get_previous_sle(args).get("qty_after_transaction") or 0
# get incoming rate
if not flt(d.incoming_rate):
d.incoming_rate = self.get_incoming_rate(args)
d.amount = flt(d.qty) * flt(d.incoming_rate)
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:23,代码来源:stock_entry.py
注:本文中的stock.stock_ledger.get_previous_sle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论