本文整理汇总了Python中utility.Utility.bindRequestModel方法的典型用法代码示例。如果您正苦于以下问题:Python Utility.bindRequestModel方法的具体用法?Python Utility.bindRequestModel怎么用?Python Utility.bindRequestModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Utility
的用法示例。
在下文中一共展示了Utility.bindRequestModel方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: saveUpdateBarangDiInventory
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import bindRequestModel [as 别名]
def saveUpdateBarangDiInventory(reqData):
requtil = Utility(reqData=reqData)
if requtil.nvlGet('id', None) is None:
#barang baru di inventory
#init barang di inventory object
bdi = models.BarangDiInventory()
#init barang object
brg = models.Barang()
brg = requtil.bindRequestModel(brg)
brg.save()
#safe harga
hrg = models.Harga();
hrg = requtil.bindRequestModel(hrg)
hrg.awal = date.today();
hrg.barang = brg;
hrg.keterangan = 'initial value'
hrg.save()
#set default inventory to main ware house in case it doesn't exists;
inventory_id = requtil.nvlGet('inventory_id', settings.MAIN_WAREHOUSE)
#check the inventory entry
inv = models.Inventory.objects.filter(id__exact=inventory_id)
#the inventory will be defined by reference later
if inv is not None and len(inv) > 0:
bdi.inventory = inv[0]
bdi.barang = brg
bdi.saldo = 0
bdi.save()
return requtil.modelToDicts([inv, hrg, brg, bdi])
示例2: simpanItemPemasukanPabean
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import bindRequestModel [as 别名]
def simpanItemPemasukanPabean(reqData):
requtil = Utility(reqData=reqData);
id = requtil.nvlGet('id', 0)
idBrg = requtil.nvlGet('barang_id', 0)
print 'observer barang id'
print idBrg
pbl = None
if id == 0:
pbl = initPengeluaranPabean(reqData)
else:
pbls = models.DokumenPabean.objects.filter(id__exact=id)
if len(pbls):
pbl = pbls[0]
#prepare barang
brg = None
brgs = models.Barang.objects.filter(id__exact=idBrg)
if len(brgs):
brg = brgs[0]
else:
raise StandardError('Barang ini tidak ditemukan')
docpb = models.ItemDokumenPabean()
#reset the id
docpb = requtil.bindRequestModel(docpb)
docpb.id = None#reset the id
docpb.barang = brg
docpb.dokumen = pbl
docpb.harga = requtil.nvlGet('barang_harga', 0)
docpb.jumlah = requtil.nvlGet('barang_qty', 0)
docpb.save()
return docpb
示例3: simpanMapping
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import bindRequestModel [as 别名]
def simpanMapping(self):
_apu = appUtil()
self.removeByCar(self.car)
hdr = models.BcdtMap()
util = Utility(reqData=self.jhdr)
hdr = util.bindRequestModel(hdr);
hdr.nomor = ('00000000000000%s' % (_apu.getIncrement(3)))[-6:]
hdr.save()
for jbrg in self.jbrgs:
brg = models.ItemBcdtMap()
utilBrg = Utility(reqData=jbrg)
brg = utilBrg.bindRequestModel(brg)
brg.bcdt = hdr
brg.harga = Decimal(brg.cif) * Decimal(hdr.ndpbm)/Decimal(brg.jumlah)
brg.save()
return hdr
示例4: initPengeluaranPabean
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import bindRequestModel [as 别名]
def initPengeluaranPabean(reqData):
requtil = Utility(reqData=reqData);
_apu = appUtil()
#prepare inventory
pbl = models.DokumenPabean()
pbl = requtil.bindRequestModel(pbl)
pbl.nomor = ('00000000000000%s' % (_apu.getIncrement(7)))[-6:]
pbl.inventory = models.Inventory.objects.get(id__exact=requtil.nvlGet('inventory_id'))
pbl.save()
return pbl
示例5: saveUpdateSupplier
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import bindRequestModel [as 别名]
def saveUpdateSupplier(reqData):
requtil = Utility(reqData=reqData)
sup = models.Supplier()
sup = requtil.bindRequestModel(sup)
if requtil.nvlGet('id', None) is None:
#barang baru di inventory
#init barang di inventory object
#init barang object
sup.save()
else: sup.save()
return requtil.modelToDicts([sup])
示例6: saveUpdatePartner
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import bindRequestModel [as 别名]
def saveUpdatePartner(reqData):
requtil = Utility(reqData=reqData)
cust = models.Partner()
#init barang object
cust = requtil.bindRequestModel(cust)
if requtil.nvlGet('id', None) is None:
#barang baru di inventory
#init barang di inventory object
cust.save()
else: cust.save()
return requtil.modelToDicts([cust])
示例7: saveUpdateInventory
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import bindRequestModel [as 别名]
def saveUpdateInventory(reqData):
requtil = Utility(reqData=reqData)
inventory = models.Inventory()
inventory = requtil.bindRequestModel(inventory)
if requtil.hasKey('jnsInventory'):
refJns = models.Referensi.objects.filter(id__exact=requtil.nvlGet('jnsInventory'))
print refJns[0].nama
inventory.jenis = refJns[0]
if requtil.hasKey('jnsMetode'):
refMet = models.Referensi.objects.filter(id__exact=requtil.nvlGet('jnsMetode'))
inventory.metode = refMet[0]
if requtil.nvlGet('id', None) is None:
inventory.save()
else: inventory.save()
return requtil.modelToDict(inventory)
示例8: updateBarang
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import bindRequestModel [as 别名]
def updateBarang(reqData):
requtil = Utility(reqData=reqData)
if requtil.nvlGet('id', None) is not None:
#update barang
barang = models.Barang();
barang = requtil.bindRequestModel(barang);
barang.save()
hargas = models.Harga.objects.filter(barang__id__exact=barang.id, akhir__isnull=True).exclude(
harga__exact=barang.harga)
print len(hargas)
found = False
for harga in hargas:
found = True
harga.akhir = date.today();
harga.save()
if found:
hrg = models.Harga()
hrg.harga = barang.harga
hrg.awal = date.today()
hrg.barang = barang
hrg.keterangan = 'proses update barang'
hrg.save()
return requtil.modelToDicts([barang])