6 thoughts on “OpenERP 5.0.16 Technical Tutorial : Jumlah Pembayaran Invoice Berjalan

  1. Pingback: OpenERP 5.0.16 Modul : Laporan Piutang Berjalan « Andhitia Rama's Blog

  2. Sore Mas,
    Saya ada kendala pada saat customize OpenERP7.

    Berikut Error-nya Mas :
    ================================================================================================
    OpenERP Server Error
    Client Traceback (most recent call last):
    File “/home/cbs/Documents/openerp7/openerp/swasti/addons/web/http.py”, line 203, in dispatch
    response[“result”] = method(self, **self.params)
    File “/home/cbs/Documents/openerp7/openerp/swasti/addons/web/controllers/main.py”, line 1117, in call_kw
    return self._call_kw(req, model, method, args, kwargs)
    File “/home/cbs/Documents/openerp7/openerp/swasti/addons/web/controllers/main.py”, line 1103, in _call_kw
    records = req.session.model(model).read(*args, **kwargs)
    File “/home/cbs/Documents/openerp7/openerp/swasti/addons/web/session.py”, line 43, in proxy
    result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
    File “/home/cbs/Documents/openerp7/openerp/swasti/addons/web/session.py”, line 31, in proxy_method
    result = self.session.send(self.service_name, method, *args)
    File “/home/cbs/Documents/openerp7/openerp/swasti/addons/web/session.py”, line 104, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

    Server Traceback (most recent call last):
    File “/home/cbs/Documents/openerp7/openerp/swasti/addons/web/session.py”, line 90, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
    File “/home/cbs/Documents/openerp7/openerp/netsvc.py”, line 293, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
    File “/home/cbs/Documents/openerp7/openerp/service/web_services.py”, line 626, in dispatch
    res = fn(db, uid, *params)
    File “/home/cbs/Documents/openerp7/openerp/osv/osv.py”, line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
    File “/home/cbs/Documents/openerp7/openerp/osv/osv.py”, line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
    File “/home/cbs/Documents/openerp7/openerp/osv/osv.py”, line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File “/home/cbs/Documents/openerp7/openerp/osv/osv.py”, line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
    File “/home/cbs/Documents/openerp7/openerp/osv/orm.py”, line 3604, in read
    result = self._read_flat(cr, user, select, fields, context, load)
    File “/home/cbs/Documents/openerp7/openerp/osv/orm.py”, line 3724, in _read_flat
    res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
    File “/home/cbs/Documents/openerp7/openerp/osv/fields.py”, line 1137, in get
    elif result.get(id):
    AttributeError: ‘str’ object has no attribute ‘get’
    ===========================================================================================

    Berikut Code saya:
    ===========================================================
    class account_invoice(osv.osv):
    _inherit = ‘account.invoice’

    def _hitung(self,cr,uid,ids,field,arg,context=None):
    arr = self.browse(cr,uid,ids,context=context)
    print “–cr–”
    print cr
    print “–uid–”
    print uid
    print “–ids–”
    print ids
    print “–field–”
    print field
    print “— arg —”
    print arg
    print “Isi arr”
    print arr
    print “Isi context”
    print context
    hasil_att = 0.0
    for x in arr :
    print x.partner_bank_id.acc_number
    return str(x.origin)

    _columns = {
    ‘no_pajak’: fields.char(‘Invoice Tax Number’, size=64, required=True),
    “no_rek” : fields.function(_hitung,method=True, type=’char’),
    }
    account_invoice()
    =========================================================================

    • Method hitung nya tidak sesuai dengan algoritma field functionnya OpenERP Pak. Coba lihat lagi contohnya di modul yg sudah ada. Harusnya returnnya adalah dictionary dengan key == id resource dan value == nilai yg diinginkan

      • Saya udah coba seperti itu Mas.
        dengan fungsi seperti ini:
        ===================================================
        def _ambilnofakcus2(self, cr, uid, ids, field_name, arg, context=None):
        res = {}
        arr = self.browse(cr,uid,ids,context=context)
        for x in arr:
        res[x.id] = self.pool.get(‘ir.sequence’).get(cr, uid, ‘sale.order’)
        return res

        _columns = {
        ‘no_pajak_cust’: fields.function(_ambilnofakcus2, method=True, string =”Tax Number Customer”),
        }
        ===========================================================

        Muncul Error berikut Mas.
        ===================================================
        Uncaught Error: [_.sprintf] expecting number but found string
        http://localhost:8069/web/webclient/js?db=demo_swasti:2534
        ====================================================

        Mohon maaf udah merepotkan Mas.🙂
        Saya masih buta di openERP ini.
        Tidak tau konsep database nya, dan tdk tau gimana openERP mengeksekusi fungsinya.

      • Dicoba


        ‘no_pajak_cust’: fields.function(fnct=_ambilnofakcus2, type='char', size=30, store=False, method=True, string =”Tax Number Customer”),

  3. Makasih ya Pak.
    Fungsi yg saya buat dah bisa di eksekusi.

    Tapi mohon di ajarkan apa artinya sintaks bapak itu..😀

    ‘no_pajak_cust’: fields.function(fnct=_ambilnofakcus2, type=’char’, size=30, store=False, method=True, string =”Tax Number Customer”),

    Makasih sebelumnya Pak.😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s