Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Too many values to Unpack?

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
voucher
1 Répondre
16978 Vues
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
Ignorer
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
Auteur

.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
Auteur

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
Meilleure réponse

Hi,

Try this one it may help you

for key, val in sel.iteritems():

1
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Voucher entry and petty cash management Résolu
voucher
Avatar
Avatar
1
mai 22
5890
Journal Voucher, Item, Entry Résolu
voucher
Avatar
Avatar
2
sept. 21
21816
Additional VAT on Payment (v7)
voucher
Avatar
Avatar
1
mars 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
mars 15
5284
how to do voucher entries for receipts and payments in openerp ?
voucher
Avatar
0
mars 15
4041
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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