Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Too many values to Unpack?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
voucher
1 Respondre
16988 Vistes
Avatar
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
Avatar
Descartar
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

Avatar
Rajkumar
Best Answer

Hi,

Try this one it may help you

for key, val in sel.iteritems():

1
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
Voucher entry and petty cash management Solved
voucher
Avatar
Avatar
1
de maig 22
5892
Journal Voucher, Item, Entry Solved
voucher
Avatar
Avatar
2
de set. 21
21818
Additional VAT on Payment (v7)
voucher
Avatar
Avatar
1
de març 15
4620
Why, in multi currency, does voucher payment create a move line with debit=0, credit=0 and amount_currency=2*amount_residual_cur
voucher
Avatar
0
de març 15
5293
how to do voucher entries for receipts and payments in openerp ?
voucher
Avatar
0
de març 15
4042
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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