Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

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

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

Too many values to Unpack?

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
voucher
1 Responder
16979 Visualizações
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
Cancelar
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
Melhor resposta

Hi,

Try this one it may help you

for key, val in sel.iteritems():

1
Avatar
Cancelar
Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
Voucher entry and petty cash management Resolvido
voucher
Avatar
Avatar
1
mai. 22
5890
Journal Voucher, Item, Entry Resolvido
voucher
Avatar
Avatar
2
set. 21
21816
Additional VAT on Payment (v7)
voucher
Avatar
Avatar
1
mar. 15
4618
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
mar. 15
5284
how to do voucher entries for receipts and payments in openerp ?
voucher
Avatar
0
mar. 15
4041
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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