• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.get_data_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中netforce.utils.get_data_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_data_path函数的具体用法?Python get_data_path怎么用?Python get_data_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_data_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: update_cost_price

 def update_cost_price(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     cost_price_cur=line["cost_price_cur"] or 0
     qty=line["qty"] or 0
     currency_id=data["currency_id"]
     if not currency_id:
         raise Exception("Missing currency")
     currency=get_model("currency").browse(currency_id)
     currency_rate=data["currency_rate"]
     date=data["date"]
     settings=get_model("settings").browse(1)
     if not currency_rate:
         if currency_id == settings.currency_id.id:
             currency_rate = 1
         else:
             rate_from = currency.get_rate(date=date)
             if not rate_from:
                 raise Exception("Missing currency rate for %s" % currency.code)
             rate_to = settings.currency_id.get_rate(date=date)
             if not rate_to:
                 raise Exception("Missing currency rate for %s" % settings.currency_id.code)
             currency_rate = rate_from / rate_to
     cost_price=get_model("currency").convert(cost_price_cur,currency_id,settings.currency_id.id,rate=currency_rate)
     cost_amount=cost_price*qty
     line["cost_price"]=cost_price
     line["cost_amount"]=cost_amount
     return data
开发者ID:bank-netforce,项目名称:netforce,代码行数:29,代码来源:stock_picking.py


示例2: onchange_product

 def onchange_product(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     prod_id = line.get("product_id")
     if not prod_id:
         return {}
     prod = get_model("product").browse(prod_id)
     line["description"] = prod.description
     line["qty"] = 1
     if prod.uom_id is not None:
         line["uom_id"] = prod.uom_id.id
     pricelist_id = data["price_list_id"]
     price = None
     if pricelist_id:
         price = get_model("price.list").get_price(pricelist_id, prod.id, 1)
         price_list = get_model("price.list").browse(pricelist_id)
         price_currency_id = price_list.currency_id.id
     if price is None:
         price = prod.purchase_price
         settings = get_model("settings").browse(1)
         price_currency_id = settings.currency_id.id
     if price is not None:
         currency_id = data["currency_id"]
         price_cur = get_model("currency").convert(price, price_currency_id, currency_id)
         line["unit_price"] = price_cur
     if prod.purchase_tax_id is not None:
         line["tax_id"] = prod.purchase_tax_id.id
     if prod.location_id:
         line["location_id"] = prod.location_id.id
     data = self.update_amounts(context)
     return data
开发者ID:jzoldyck,项目名称:netforce,代码行数:32,代码来源:purchase_return.py


示例3: onchange_product

 def onchange_product(self, context):
     data = context["data"]
     type = data["type"]
     path = context["path"]
     contact_id = data["contact_id"]
     contact = get_model("contact").browse(contact_id)
     line = get_data_path(data, path, parent=True)
     prod_id = line.get("product_id")
     if not prod_id:
         return {}
     prod = get_model("product").browse(prod_id)
     line["description"] = prod.description
     line["qty"] = 1
     if prod.uom_id is not None:
         line["uom_id"] = prod.uom_id.id
     if type == "out":
         if prod.sale_price is not None:
             line["unit_price"] = prod.sale_price
         if prod.sale_account_id is not None:
             line["account_id"] = prod.sale_account_id.id
         if prod.sale_tax_id is not None:
             line["tax_id"] = contact.tax_receivable_id.id or prod.sale_tax_id.id
     elif type == "in":
         if prod.purchase_price is not None:
             line["unit_price"] = prod.purchase_price
         if prod.purchase_account_id is not None:
             line["account_id"] = prod.purchase_account_id.id
         if prod.purchase_tax_id is not None:
             line["tax_id"] = contact.tax_payable_id.id or prod.purchase_tax_id.id
     data = self.update_amounts(context)
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:31,代码来源:account_invoice.py


示例4: onchange_qty

 def onchange_qty(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     prod_id = line.get("product_id")
     if not prod_id:
         return {}
     prod = get_model("product").browse(prod_id)
     pricelist_id = data["price_list_id"]
     qty = line["qty"]
     if line.get("unit_price") is None:
         price = None
         if pricelist_id:
             price = get_model("price.list").get_price(pricelist_id, prod.id, qty)
             price_list = get_model("price.list").browse(pricelist_id)
             price_currency_id = price_list.currency_id.id
         if price is None:
             price = prod.sale_price
             settings = get_model("settings").browse(1)
             price_currency_id = settings.currency_id.id
         if price is not None:
             currency_id = data["currency_id"]
             price_cur = get_model("currency").convert(price, price_currency_id, currency_id)
             line["unit_price"] = price_cur
     data = self.update_amounts(context)
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:26,代码来源:sale_quot.py


示例5: onchange_book

 def onchange_book(self, context={}):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data,path,parent=True)
     book_id = line["book_id"]
     book = get_model("bookstore.book").browse(book_id)
     line["unit_price"]=book.cost
     return data
开发者ID:sidzan,项目名称:netforce-bookstore,代码行数:8,代码来源:bookstore_burrow.py


示例6: get_line_desc

 def get_line_desc(self, context):
     data = context["data"]
     path = context["path"]
     if not data.get("default_line_desc"):
         return
     if not get_data_path(data, path):
         set_data_path(data, path, data.get("narration"))
     return data
开发者ID:oncedayly,项目名称:netforce,代码行数:8,代码来源:account_move.py


示例7: onchange_product

 def onchange_product(self, context={}):
     data = context.get('data')
     path = context.get('path')
     line = get_data_path(data, path, parent=True)
     product = get_model('product').browse(line['product_id'])
     line['description'] = product.description if product.description else "-"
     line['uom_id'] = product.uom_id.id
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:8,代码来源:purchase_request.py


示例8: onchange_product

 def onchange_product(self,context={}):
     data=context['data']
     path=context['path']
     line=get_data_path(data,path,parent=True)
     product_id=line['product_id']
     if product_id:
         product=get_model('product').browse(product_id)
         line['uom_id']=product.uom_id.id
     return data
开发者ID:nfco,项目名称:netforce,代码行数:9,代码来源:bom.py


示例9: onchange_to_product

 def onchange_to_product(self, context={}):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     prod_id = line.get("product_id")
     prod = get_model("product").browse(prod_id)
     line["uom_id"] = prod.uom_id.id
     line["qty"] = 1
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:9,代码来源:stock_transform.py


示例10: onchange_product

 def onchange_product(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     product_id = line["product_id"]
     prod = get_model("product").browse(product_id)
     line["description"] = prod.description
     line["unit_price"] = prod.cost_price
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:9,代码来源:time_sheet.py


示例11: onchange_lot

 def onchange_lot(self, context):
     data = context["data"]
     loc_id = data["location_from_id"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     prod_id = line["product_id"]
     lot_id = line["lot_id"]
     res = get_model("stock.location").compute_balance([loc_id], prod_id, lot_id=lot_id)
     line["qty"] = res["bal_qty"]
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:10,代码来源:barcode_transfer.py


示例12: onchange_est_margin

 def onchange_est_margin(self,context={}):
     data=context["data"]
     path=context["path"]
     line=get_data_path(data,path,parent=True)
     margin=line["est_margin_percent_input"]
     amt=line["est_cost_amount"]/(1-margin/Decimal(100))
     price=round(amt/line["qty"])
     line["unit_price"]=price
     self.update_amounts(context)
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:10,代码来源:sale_quot.py


示例13: onchange_product

 def onchange_product(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     prod_id = line.get("product_id")
     if not prod_id:
         return {}
     prod = get_model("product").browse(prod_id)
     line["uom_id"] = prod.uom_id.id
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:10,代码来源:barcode_transfer.py


示例14: onchange_account

 def onchange_account(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     acc_id = line.get("account_id")
     if not acc_id:
         return {}
     acc = get_model("account.account").browse(acc_id)
     line["tax_id"] = acc.tax_id.id
     data = self.update_amounts(context)
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:11,代码来源:account_invoice.py


示例15: onchange_qc_test

 def onchange_qc_test(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     test_id = line.get("test_id")
     if not test_id:
         return
     test = get_model("qc.test").browse(test_id)
     line["min_value"] = test.min_value
     line["max_value"] = test.max_value
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:11,代码来源:production_order.py


示例16: onchange_product

 def onchange_product(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     prod_id = line.get("product_id")
     if not prod_id:
         return {}
     prod = get_model("product").browse(prod_id)
     line["qty"] = 1
     if prod.uom_id is not None:
         line["uom_id"] = prod.uom_id.id
     if data["type"] == "in":
         if prod.purchase_price is not None:
             line["cost_price_cur"] = prod.purchase_price
     return data
开发者ID:jzoldyck,项目名称:netforce,代码行数:15,代码来源:stock_picking.py


示例17: onchange_uom

 def onchange_uom(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     prod_id = line.get("product_id")
     if not prod_id:
         return {}
     prod = get_model("product").browse(prod_id)
     uom_id = line.get("uom_id")
     if not uom_id:
         return {}
     uom = get_model("uom").browse(uom_id)
     if prod.sale_price is not None:
         line["unit_price"] = prod.sale_price * uom.ratio / prod.uom_id.ratio
     data = self.update_amounts(context)
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:16,代码来源:sale_quot.py


示例18: onchange_qc_value

 def onchange_qc_value(self, context):
     data = context["data"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     try:
         value = float(line.get("value"))
     except:
         return
     min_value = line.get("min_value")
     max_value = line.get("max_value")
     if min_value and value < min_value:
         line["result"] = "no"
     elif max_value and value > max_value:
         line["result"] = "no"
     else:
         line["result"] = "yes"
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:17,代码来源:production_order.py


示例19: onchange_item

 def onchange_item(self, context={}):
     data = context["data"]
     emp_id = data.get("employee_id")
     if not emp_id:
         return
     date = data.get("date")
     emp = get_model("hr.employee").browse(emp_id)
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     item_id = line["payitem_id"]
     if not item_id:
         return
     item = get_model("hr.payitem").browse(item_id)
     qty, rate = item.compute(context={"employee_id": emp_id, "date": date})
     line["qty"] = qty
     line["rate"] = rate
     line["amount"] = qty * rate
     self.update_amounts(context=context)
     return data
开发者ID:Sorawit123,项目名称:netforce,代码行数:19,代码来源:hr_payslip.py


示例20: onchange_product

 def onchange_product(self, context):
     data = context["data"]
     loc_id = data["location_id"]
     path = context["path"]
     line = get_data_path(data, path, parent=True)
     prod_id = line.get("product_id")
     if not prod_id:
         return {}
     prod = get_model("product").browse(prod_id)
     lot_id = line.get("lot_id")
     qty = get_model("stock.balance").get_qty_phys(loc_id, prod_id, lot_id)
     unit_price = get_model("stock.balance").get_unit_price(loc_id, prod_id)
     line["bin_location"] = prod.bin_location
     line["prev_qty"] = qty
     line["prev_cost_price"] = unit_price
     line["new_qty"] = qty
     line["unit_price"] = unit_price
     line["uom_id"] = prod.uom_id.id
     return data
开发者ID:bankwirat,项目名称:netforce,代码行数:19,代码来源:stock_count.py



注:本文中的netforce.utils.get_data_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python netifaces.gateways函数代码示例发布时间:2022-05-27
下一篇:
Python model.get_model函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap