本文整理汇总了Python中webnotes.get_obj函数的典型用法代码示例。如果您正苦于以下问题:Python get_obj函数的具体用法?Python get_obj怎么用?Python get_obj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_obj函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: execute
def execute():
import webnotes
webnotes.reload_doc("buying", "doctype", "purchase_order_item")
webnotes.reload_doc("stock", "doctype", "purchase_receipt_item")
for pi in webnotes.conn.sql("""select name from `tabPurchase Invoice` where docstatus = 1"""):
webnotes.get_obj("Purchase Invoice", pi[0],
with_children=1).update_qty(change_modified=False)
开发者ID:antaryaami,项目名称:erpnext,代码行数:7,代码来源:p06_update_billed_amt_po_pr.py
示例2: reconcile_against_document
def reconcile_against_document(args):
"""
Cancel JV, Update aginst document, split if required and resubmit jv
"""
for d in args:
check_if_jv_modified(d)
against_fld = {
'Journal Voucher' : 'against_jv',
'Sales Invoice' : 'against_invoice',
'Purchase Invoice' : 'against_voucher'
}
d['against_fld'] = against_fld[d['against_voucher_type']]
# cancel JV
jv_obj = webnotes.get_obj('Journal Voucher', d['voucher_no'], with_children=1)
jv_obj.make_gl_entries(cancel=1, adv_adj=1)
# update ref in JV Detail
update_against_doc(d, jv_obj)
# re-submit JV
jv_obj = webnotes.get_obj('Journal Voucher', d['voucher_no'], with_children =1)
jv_obj.make_gl_entries(cancel = 0, adv_adj =1)
开发者ID:robertbecht,项目名称:erpnext,代码行数:25,代码来源:utils.py
示例3: execute
def execute():
import webnotes
webnotes.reload_doc('stock', 'doctype', 'packed_item')
for si in webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1"""):
webnotes.get_obj("Sales Invoice", si[0],
with_children=1).update_qty(change_modified=False)
webnotes.conn.commit()
开发者ID:Anirudh887,项目名称:erpnext,代码行数:7,代码来源:p07_repost_billed_amt_in_sales_cycle.py
示例4: execute
def execute():
webnotes.reload_doc("stock", "doctype", "delivery_note_item")
webnotes.reload_doc("accounts", "doctype", "sales_invoice_item")
webnotes.conn.auto_commit_on_many_writes = True
for company in webnotes.conn.sql("select name from `tabCompany`"):
stock_ledger_entries = webnotes.conn.sql("""select item_code, voucher_type, voucher_no,
voucher_detail_no, posting_date, posting_time, stock_value,
warehouse, actual_qty as qty from `tabStock Ledger Entry`
where ifnull(`is_cancelled`, "No") = "No" and company = %s
order by item_code desc, warehouse desc,
posting_date desc, posting_time desc, name desc""", company[0], as_dict=True)
dn_list = webnotes.conn.sql("""select name from `tabDelivery Note`
where docstatus < 2 and company = %s""", company[0])
for dn in dn_list:
dn = webnotes.get_obj("Delivery Note", dn[0], with_children = 1)
dn.set_buying_amount(stock_ledger_entries)
si_list = webnotes.conn.sql("""select name from `tabSales Invoice`
where docstatus < 2 and company = %s""", company[0])
for si in si_list:
si = webnotes.get_obj("Sales Invoice", si[0], with_children = 1)
si.set_buying_amount(stock_ledger_entries)
webnotes.conn.auto_commit_on_many_writes = False
开发者ID:BANSALJEE,项目名称:erpnext,代码行数:27,代码来源:p03_update_buying_amount.py
示例5: insert_entries
def insert_entries(self, opts, row):
"""Insert Stock Ledger Entries"""
args = webnotes._dict({
"doctype": "Stock Ledger Entry",
"item_code": row.item_code,
"warehouse": row.warehouse,
"posting_date": self.doc.posting_date,
"posting_time": self.doc.posting_time,
"voucher_type": self.doc.doctype,
"voucher_no": self.doc.name,
"company": self.doc.company,
"is_cancelled": "No",
"voucher_detail_no": row.voucher_detail_no
})
args.update(opts)
# create stock ledger entry
sle_wrapper = webnotes.bean([args])
sle_wrapper.ignore_permissions = 1
sle_wrapper.insert()
# update bin
webnotes.get_obj('Warehouse', row.warehouse).update_bin(args)
# append to entries
self.entries.append(args)
开发者ID:PhamThoTam,项目名称:erpnext,代码行数:25,代码来源:stock_reconciliation.py
示例6: reconcile_against_document
def reconcile_against_document(args):
"""
Cancel JV, Update aginst document, split if required and resubmit jv
"""
for d in args:
check_if_jv_modified(d)
against_fld = {
"Journal Voucher": "against_jv",
"Sales Invoice": "against_invoice",
"Purchase Invoice": "against_voucher",
}
d["against_fld"] = against_fld[d["against_voucher_type"]]
# cancel JV
jv_obj = webnotes.get_obj("Journal Voucher", d["voucher_no"], with_children=1)
jv_obj.make_gl_entries(cancel=1, adv_adj=1)
# update ref in JV Detail
update_against_doc(d, jv_obj)
# re-submit JV
jv_obj = webnotes.get_obj("Journal Voucher", d["voucher_no"], with_children=1)
jv_obj.make_gl_entries(cancel=0, adv_adj=1)
开发者ID:nivawebs,项目名称:erpnext,代码行数:25,代码来源:utils.py
示例7: check_budget
def check_budget(gl_map, cancel):
for gle in gl_map:
if gle.get("cost_center"):
# check budget only if account is expense account
acc_details = webnotes.conn.get_value("Account", gle["account"], ["is_pl_account", "debit_or_credit"])
if acc_details[0] == "Yes" and acc_details[1] == "Debit":
webnotes.get_obj("Budget Control").check_budget(gle, cancel)
开发者ID:rohitw1991,项目名称:latestadberp,代码行数:7,代码来源:general_ledger.py
示例8: _update_requested_qty
def _update_requested_qty(controller, mr_obj, mr_items):
"""update requested qty (before ordered_qty is updated)"""
for mr_item_name in mr_items:
mr_item = mr_obj.doclist.getone({"parentfield": "indent_details", "name": mr_item_name})
se_detail = controller.doclist.getone(
{"parentfield": "mtn_details", "material_request": mr_obj.doc.name, "material_request_item": mr_item_name}
)
mr_item.ordered_qty = flt(mr_item.ordered_qty)
mr_item.qty = flt(mr_item.qty)
se_detail.transfer_qty = flt(se_detail.transfer_qty)
if (
se_detail.docstatus == 2
and mr_item.ordered_qty > mr_item.qty
and se_detail.transfer_qty == mr_item.ordered_qty
):
add_indented_qty = mr_item.qty
elif se_detail.docstatus == 1 and mr_item.ordered_qty + se_detail.transfer_qty > mr_item.qty:
add_indented_qty = mr_item.qty - mr_item.ordered_qty
else:
add_indented_qty = se_detail.transfer_qty
webnotes.get_obj("Warehouse", se_detail.t_warehouse).update_bin(
{
"item_code": se_detail.item_code,
"indented_qty": (se_detail.docstatus == 2 and 1 or -1) * add_indented_qty,
"posting_date": controller.doc.posting_date,
}
)
开发者ID:bindscha,项目名称:erpnext-fork,代码行数:30,代码来源:material_request.py
示例9: execute
def execute():
si_no_gle = webnotes.conn.sql("""select si.name from `tabSales Invoice` si
where docstatus=1 and not exists(select name from `tabGL Entry`
where voucher_type='Sales Invoice' and voucher_no=si.name)
and modified >= '2013-08-01'""")
for si in si_no_gle:
webnotes.get_obj("Sales Invoice", si[0]).make_gl_entries()
开发者ID:Jdfkat,项目名称:erpnext,代码行数:8,代码来源:p01_make_gl_entries_for_si.py
示例10: check_budget
def check_budget(gl_map, cancel):
for gle in gl_map:
if gle.get('cost_center'):
#check budget only if account is expense account
acc_details = webnotes.conn.get_value("Account", gle['account'],
['is_pl_account', 'debit_or_credit'])
if acc_details[0]=="Yes" and acc_details[1]=="Debit":
webnotes.get_obj('Budget Control').check_budget(gle, cancel)
开发者ID:hfeeki,项目名称:erpnext,代码行数:8,代码来源:general_ledger.py
示例11: run_on_trash
def run_on_trash(doctype, name, doclist):
# call on_trash if required
if doclist:
obj = webnotes.get_obj(doclist=doclist)
else:
obj = webnotes.get_obj(doctype, name)
if hasattr(obj,'on_trash'):
obj.on_trash()
开发者ID:alvz,项目名称:wnframework,代码行数:9,代码来源:utils.py
示例12: set_as_default
def set_as_default(self):
webnotes.conn.set_value("Global Defaults", None, "current_fiscal_year", self.doc.name)
webnotes.get_obj("Global Defaults").on_update()
# clear cache
webnotes.clear_cache()
msgprint(self.doc.name + _(""" is now the default Fiscal Year. \
Please refresh your browser for the change to take effect."""))
开发者ID:BillTheBest,项目名称:erpnext,代码行数:9,代码来源:fiscal_year.py
示例13: update_user_default
def update_user_default(self):
if self.doc.user_id:
webnotes.conn.set_default("employee", self.doc.name, self.doc.user_id)
webnotes.conn.set_default("employee_name", self.doc.employee_name, self.doc.user_id)
webnotes.conn.set_default("company", self.doc.company, self.doc.user_id)
# add employee role if missing
if not "Employee" in webnotes.conn.sql_list("""select role from tabUserRole
where parent=%s""", self.doc.user_id):
webnotes.get_obj("Profile", self.doc.user_id).add_role("Employee")
开发者ID:robertbecht,项目名称:erpnext,代码行数:10,代码来源:employee.py
示例14: on_update
def on_update(self):
# reset birthday reminders
if cint(self.doc.stop_birthday_reminders) != self.original_stop_birthday_reminders:
webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
if not self.doc.stop_birthday_reminders:
for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where status='Active' and
ifnull(date_of_birth, '')!=''"""):
webnotes.get_obj("Employee", employee).update_dob_event()
webnotes.msgprint(webnotes._("Updated Birthday Reminders"))
开发者ID:mxmo-co,项目名称:erpnext,代码行数:11,代码来源:hr_settings.py
示例15: test_block_list
def test_block_list(self):
import webnotes
webnotes.conn.set_value("Employee", "_T-Employee-0001", "department",
"_Test Department with Block List")
application = webnotes.model_wrapper(test_records[1])
application.doc.from_date = "2013-01-01"
application.doc.to_date = "2013-01-05"
self.assertRaises(LeaveDayBlockedError, application.insert)
webnotes.session.user = "[email protected]"
webnotes.get_obj("Profile", "[email protected]").add_role("HR User")
self.assertTrue(application.insert())
开发者ID:robertbecht,项目名称:erpnext,代码行数:13,代码来源:test_leave_application.py
示例16: complete_setup
def complete_setup():
print "Complete Setup..."
webnotes.get_obj("Setup Control").setup_account({
"first_name": "Test",
"last_name": "User",
"fy_start": "1st Jan",
"industry": "Manufacturing",
"company_name": "Wind Power LLC",
"company_abbr": "WP",
"currency": "INR",
"timezone": "America/New York",
"country": "United States"
})
开发者ID:antaryaami,项目名称:erpnext,代码行数:13,代码来源:make_demo.py
示例17: complete_setup
def complete_setup():
print "Complete Setup..."
webnotes.get_obj("Setup Control").setup_account({
"first_name": "Test",
"last_name": "User",
"fy_start": "1st Jan",
"industry": "Manufacturing",
"company_name": company,
"company_abbr": company_abbr,
"currency": currency,
"timezone": time_zone,
"country": country
})
import_data("Fiscal_Year")
开发者ID:CarlosAnt,项目名称:erpnext,代码行数:15,代码来源:make_demo.py
示例18: insert_existing_sle
def insert_existing_sle(self, valuation_method):
webnotes.conn.set_value("Item", "_Test Item", "valuation_method", valuation_method)
webnotes.conn.set_default("allow_negative_stock", 1)
existing_ledgers = [
{
"doctype": "Stock Ledger Entry", "__islocal": 1,
"voucher_type": "Stock Entry", "voucher_no": "TEST",
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
"posting_date": "2012-12-12", "posting_time": "01:00",
"actual_qty": 20, "incoming_rate": 1000, "company": "_Test Company",
"fiscal_year": "_Test Fiscal Year 2012",
},
{
"doctype": "Stock Ledger Entry", "__islocal": 1,
"voucher_type": "Stock Entry", "voucher_no": "TEST",
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
"posting_date": "2012-12-15", "posting_time": "02:00",
"actual_qty": 10, "incoming_rate": 700, "company": "_Test Company",
"fiscal_year": "_Test Fiscal Year 2012",
},
{
"doctype": "Stock Ledger Entry", "__islocal": 1,
"voucher_type": "Stock Entry", "voucher_no": "TEST",
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
"posting_date": "2012-12-25", "posting_time": "03:00",
"actual_qty": -15, "company": "_Test Company",
"fiscal_year": "_Test Fiscal Year 2012",
},
{
"doctype": "Stock Ledger Entry", "__islocal": 1,
"voucher_type": "Stock Entry", "voucher_no": "TEST",
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
"posting_date": "2012-12-31", "posting_time": "08:00",
"actual_qty": -20, "company": "_Test Company",
"fiscal_year": "_Test Fiscal Year 2012",
},
{
"doctype": "Stock Ledger Entry", "__islocal": 1,
"voucher_type": "Stock Entry", "voucher_no": "TEST",
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
"posting_date": "2013-01-05", "posting_time": "07:00",
"actual_qty": 15, "incoming_rate": 1200, "company": "_Test Company",
"fiscal_year": "_Test Fiscal Year 2013",
},
]
webnotes.get_obj("Stock Ledger").update_stock(existing_ledgers)
开发者ID:frank1638,项目名称:erpnext,代码行数:48,代码来源:test_stock_reconciliation.py
示例19: execute
def execute():
from stock.stock_ledger import update_entries_after
item_warehouse = []
# update valuation_rate in transaction
doctypes = {"Purchase Receipt": "purchase_receipt_details", "Purchase Invoice": "entries"}
for dt in doctypes:
for d in webnotes.conn.sql("""select name from `tab%s`
where modified >= '2013-05-09' and docstatus=1""" % dt):
rec = webnotes.get_obj(dt, d[0])
rec.update_valuation_rate(doctypes[dt])
for item in rec.doclist.get({"parentfield": doctypes[dt]}):
webnotes.conn.sql("""update `tab%s Item` set valuation_rate = %s
where name = %s"""% (dt, '%s', '%s'), tuple([item.valuation_rate, item.name]))
if dt == "Purchase Receipt":
webnotes.conn.sql("""update `tabStock Ledger Entry` set incoming_rate = %s
where voucher_detail_no = %s""", (item.valuation_rate, item.name))
if [item.item_code, item.warehouse] not in item_warehouse:
item_warehouse.append([item.item_code, item.warehouse])
for d in item_warehouse:
try:
update_entries_after({"item_code": d[0], "warehouse": d[1],
"posting_date": "2013-01-01", "posting_time": "00:05:00"})
webnotes.conn.commit()
except:
pass
开发者ID:Anirudh887,项目名称:erpnext,代码行数:29,代码来源:p02_update_valuation_rate.py
示例20: make
def make(doctype=None, name=None, content=None, subject=None,
sender=None, recipients=None, contact=None, lead=None, company=None,
communication_medium="Email", send_email=False, print_html=None,
attachments='[]', send_me_a_copy=False, set_lead=True, date=None):
# add to Communication
sent_via = None
d = webnotes.doc('Communication')
d.subject = subject
d.content = content
d.sender = sender or webnotes.conn.get_value("Profile", webnotes.session.user, "email")
d.recipients = recipients
d.lead = lead
d.contact = contact
d.company = company
if date:
d.creation = date
if doctype:
sent_via = webnotes.get_obj(doctype, name)
d.fields[doctype.replace(" ", "_").lower()] = name
if set_lead:
set_lead_and_contact(d)
d.communication_medium = communication_medium
if send_email:
send_comm_email(d, name, sent_via, print_html, attachments, send_me_a_copy)
d.save(1, ignore_fields=True)
开发者ID:appost,项目名称:wnframework,代码行数:27,代码来源:communication.py
注:本文中的webnotes.get_obj函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论