Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Too many values to Unpack?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
voucher
1 Răspunde
16997 Vizualizări
Imagine profil
vadivel

Hi friends,

When i inherit the code of account_voucher class it shows the error in following lines:

 res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)

In terminal it shows error like:

for key, val in sel:
ValueError: too many values to unpack

 

0
Imagine profil
Abandonează
Dhinesh

Post your full code and error log. This error is commonly raised when you have the wrong xml reference to the inherited form in your xml file.

vadivel
Autor

.py file class voucher_approval(osv.osv): _inherit = 'account.voucher' _columns = { 'type':fields.selection([ ('sale','Sale'), ('purchase','Purchase'), ('payment','Payment'), ('receipt','Receipt'), ], 'Default Type', readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'name':fields.char('Memo', size=256, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'date':fields.date('Date', readonly=True, select=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}, help="Effective date for accounting entries"), 'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'line_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'line_cr_ids':fields.one2many('account.voucher.line','voucher_id','Credits', domain=[('type','=','cr')], context={'default_type':'cr'}, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'line_dr_ids':fields.one2many('account.voucher.line','voucher_id','Debits', domain=[('type','=','dr')], context={'default_type':'dr'}, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'narration':fields.text('Notes', readonly=True,states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'company_id': fields.many2one('res.company', 'Company', required=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'state':fields.selection( [('to_be_checked'), ('waiting_for_approval'), ('draft','Draft'), ('cancel','Cancelled'), ('proforma','Pro-forma'), ('posted','Posted') ], 'Status', readonly=True, size=32, track_visibility='onchange', help=' * The \'Draft\' status is used when a user is encoding a new and unconfirmed Voucher. \ \n* The \'Pro-forma\' when voucher is in Pro-forma status,voucher does not have an voucher number. \ \n* The \'Posted\' status is used when user create voucher,a voucher number is generated and voucher entries are created in account \ \n* The \'Cancelled\' status is used when user cancel voucher.'), 'amount': fields.float('Total', digits_compute=dp.get_precision('Account'), required=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'tax_amount':fields.float('Tax Amount', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}, help="Transaction reference number."), 'move_ids': fields.related('move_id','line_id', type='one2many', relation='account.move.line', string='Journal Items', readonly=True), 'partner_id':fields.many2one('res.partner', 'Partner', change_default=1, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'pay_now':fields.selection([ ('pay_now','Pay Directly'), ('pay_later','Pay Later or Group Funds'), ],'Payment', select=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'tax_id': fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}, domain=[('price_include','=', False)], help="Only for tax excluded from price"), 'pre_line':fields.boolean('Previous Payments ?', required=False), 'date_due': fields.date('Due Date', readonly=True, select=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'payment_option':fields.selection([ ('without_writeoff', 'Keep Open'), ('with_writeoff', 'Reconcile Payment Balance'), ], 'Payment Difference', required=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}, help="This field helps you to choose what you want to do with the eventual difference between the paid amount and the sum of allocated amounts. You can either choose to keep open this difference on the partner's account, or reconcile it with the payment(s)"), 'writeoff_acc_id': fields.many2one('account.account', 'Counterpart Account', readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'comment': fields.char('Counterpart Comment', size=64, required=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'analytic_id': fields.many2one('account.analytic.account','Write-Off Analytic Account', readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'payment_rate_currency_id': fields.many2one('res.currency', 'Payment Rate Currency', required=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}), 'payment_rate': fields.float('Exchange Rate', digits=(12,6), required=True, readonly=True, states={'draft':[('readonly',False)],'to_be_checked': [('readonly', False)]}, help='The specific rate that will be used, in this voucher, between the selected currency (in \'Payment Rate Currency\' field) and the voucher currency.'), 'approval_line': fields.one2many('account.voucher.approval.lines', 'voucher_id', 'Approval Lines'), } def button_send_for_approval(self, cr, uid, ids, context={}): print "uidddddddddddddddddd",uid approval_obj = self.pool.get('voucher.approval.hierarchy') approval_lines_obj = self.pool.get('res.users.voucher.approval.lines') voucher_approval_lines_obj = self.pool.get('account.voucher.approval.lines') models_data = self.pool.get('ir.model.data') res={} for this_id in self.browse(cr, uid, ids, context): approval_ids = approval_obj.search(cr, uid, [('start_amount','=',this_id.amount)],limit=1) if approval_ids: for approval in approval_obj.browse(cr, uid, approval_ids, context=context): user_ids = approval_lines_obj.search(cr, uid, [('hierarchy_id','=',approval.id)]) if user_ids: for user in approval_lines_obj.browse(cr, uid, user_ids, context=context): user_name = user.user_id.id voucher_approval_lines_obj.create(cr, uid, {'approver': user_name, 'voucher_id':this_id.id }) this_id.write({'no_of_approvals': approval.name, 'state': 'waiting_for_approval', }) dummy, form_view = models_data.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') return { 'name': _('Account Voucher'), 'view_type': 'form', 'view_mode': 'form', 'res_model': 'account.voucher', 'domain': [], 'res_id': int(this_id.id), 'view_id': False, 'views': [(form_view or False, 'form')], 'type': 'ir.actions.act_window', } else: raise osv.except_osv(_('Cannot Proceed'), _('Please define an approval hierarchy.')) else: this_id.write({'no_of_approvals': 0, 'state': 'draft', }) return res def button_approve1(self, cr, uid, ids, context=None): print "uidddddddddddddddddd",uid approval_obj = self.pool.get('voucher.approval') voucher_approval_lines_obj = self.pool.get('account.voucher.approval.lines') now = datetime.now() for this_id in self.browse(cr, uid, ids, context): count = this_id.no_of_approvals if this_id.amount != 0.0: not_approved_user_ids = voucher_approval_lines_obj.search(cr, uid, [('status','=',False), ('invoice_id','=',this_id.id)],limit=1) if not_approved_user_ids: for lines in voucher_approval_lines_obj.browse(cr, uid, not_approved_user_ids, context): approver_id = lines.approver.id if uid == approver_id: user_ids = approval_obj.search(cr, uid, [('user_id','=',uid)],limit=1) if user_ids: for user in approval_obj.browse(cr, uid, user_ids, context): if user.start_amount = this_id.amount: if count == 0: this_id.write({'state': 'draft', }) else: approval_count = count-1 if approval_count == 0: this_id.write({'no_of_approvals': approval_count, 'state': 'draft', }) else: this_id.write({'no_of_approvals': approval_count, 'state': 'waiting_for_approval', }) lines.write({'approved_date': now, 'status': True, 'voucher_id': this_id.id }) else: raise osv.except_osv(_('Cannot Proceed'), _('Higher authority must approve the Invoice.')) else: raise osv.except_osv(_('Cannot Proceed'), _('Please define an approval range for the user')) else: raise osv.except_osv(_('Cannot Proceed'), _('Some other user in the hierarchy needs to approve the quotation.')) else: this_id.write({'state': 'waiting_for_approval', }) return True voucher_approval() class account_voucher_approval_lines(osv.osv): _name = "account.voucher.approval.lines" _description = 'Account Voucher Approval Lines' _columns = { 'approver' : fields.many2one('res.users', 'Approver'), 'voucher_id':fields.many2one('account.voucher', 'Account Invoice'), 'approved_date': fields.datetime('Approval Date'), 'status': fields.boolean('Approved'), } _defaults = { 'status':False, } account_voucher_approval_lines() class voucher_approval(osv.osv): _name = 'voucher.approval' _description = 'Account Voucher Approval' _columns = { 'user_id' : fields.many2one('res.users', 'User'), 'start_amount' : fields.float('Start Amount'), 'end_amount' : fields.float('End Amount'), } _defaults = { 'start_amount':1.0, 'end_amount':1.0, } voucher_approval() class voucher_approval_hierarchy(osv.osv): _name = 'voucher.approval.hierarchy' _description = 'Account Voucher Approval Hierarchy' _columns = { 'name': fields.integer('No of Approvals'), 'start_amount' : fields.float('Start Amount'), 'end_amount' : fields.float('End Amount'), 'users_approval_lines_ids': fields.one2many('res.users.voucher.approval.lines','hierarchy_id', 'User Approval Lines'), } _defaults = { 'start_amount':1.0, 'end_amount':1.0, } voucher_approval_hierarchy() class res_users_voucher_approval_lines(osv.osv): _name = "res.users.voucher.approval.lines" _description = 'Account voucher User Approval Lines' _columns = { 'user_id' : fields.many2one('res.users', 'User'), 'hierarchy_id':fields.many2one('voucher.approval.hierarchy', 'Voucher Approval Hierarchy'), } res_users_voucher_approval_lines() xml file voucher.approval.treevoucher.approval1treevoucher.approval.formvoucher.approvalform Voucher Approvalir.actions.act_windowvoucher.approvalformtree,formtreeformaccount.voucher.approval.lines.treeaccount.voucher.approval.lines1treeaccount.voucher.approval.extended.form.viewaccount.voucherform <xpath expr="/form/header/button[@name='proforma_voucher']" position="before"> <xpath expr="/form/header/field[@name='state']" position="replace"> account.payment.approval.extended.form.viewaccount.voucherform <xpath expr="/form/header/button[@name='proforma_voucher']" position="before"> <xpath expr="/form/header/field[@name='state']" position="replace">

vadivel
Autor

sorry alignment is like nasty i have inherited the account_voucher class and i have added two more states before draft state,added two more buttons for value based approval

Imagine profil
Rajkumar
Cel mai bun răspuns

Hi,

Try this one it may help you

for key, val in sel.iteritems():

1
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Voucher entry and petty cash management Rezolvat
voucher
Imagine profil
Imagine profil
1
mai 22
5895
Journal Voucher, Item, Entry Rezolvat
voucher
Imagine profil
Imagine profil
2
sept. 21
21822
Additional VAT on Payment (v7)
voucher
Imagine profil
Imagine profil
1
mar. 15
4623
Why, in multi currency, does voucher payment create a move line with debit=0, credit=0 and amount_currency=2*amount_residual_cur
voucher
Imagine profil
0
mar. 15
5301
how to do voucher entries for receipts and payments in openerp ?
voucher
Imagine profil
0
mar. 15
4043
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now