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
    • Guest House
    • Distributeur de boissons
    • Hotel
    Real Estate
    • Real Estate Agency
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consulting
    • Accounting Firm
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Metal
    • Furnitures
    • Food
    • 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
    • Solar Energy Systems
    • Cordonnier
    • Services de nettoyage
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

Field does not exist error [Odoo 9.0]

S'inscrire

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

Cette question a été signalée
viewsinheritancefieldleaves
3 Réponses
7103 Vues
Avatar
Milos

I am trying to add a boolean field to hr_holiday that should enable me to not count weekends on leaves when checked.

I get the following error:

ParseError: "Invalid view definition

Error details:

Field `weekend_exclude` does not exist

Error context:

View `excluding.days.leaves`

[view_id: 700, xml_id: n/a, model: hr.holidays, parent_id: n/a] ...

weekend_leaves_view.xml

<?xml version="1.0" encoding="UTF-8"?> 
<openerp>
 <data>
 <record model="ir.ui.view" id="excluding_days_leaves">
 <field name="name">excluding.days.leaves</field>
 <field name="model">hr.holidays</field>
 <field name="arch" type="xml">
 <form string="Session Form">
 <sheet>
 <group>
 <group string="Weekend Leave">
 <field name='weekend_exclude'/>
 </group>
 </group>
 </sheet>
 </form>
 </field>
 </record>
 <record model="ir.actions.act_window" id="excluding_days_leaves_action">
 <field name="name">Excluding days</field>
 <field name="res_model">hr.holidays</field>
 <field name="view_type">form</field>
 <field name="view_mode">form</field>
 </record>
 <record model="ir.actions.act_window.view" id="excluding_days_leaves_action_form">
 <field name="view_mode">form</field>
 <field name="view_id" ref="excluding_days_leaves"/>
 <field name="act_window_id" ref="excluding_days_leaves_action"/>
 </record>
 <menuitem id="excluding_days_leaves_menuitem" name="Excluding days" parent="hr_holidays.menu_hr_holidays_root" action="excluding_days_leaves_action"/>
 </data>
</openerp>

model.py

from openerp.osv import fields, orm
import datetime
class nites_weekend_leaves(orm.Model):
 _inherit = 'hr.holidays'
 weekend_exclude=fields.boolean('Weekend')
 def _get_number_of_days(self, date_from, date_to): """Returns a float equals to the timedelta between two dates given as string."""
 DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S" from_dt = datetime.datetime.strptime(date_from, DATETIME_FORMAT)
 to_dt = datetime.datetime.strptime(date_to, DATETIME_FORMAT)
timedelta = to_dt - from_dt
 weekend_days=0
 if self.weekend_exclude:
while from_dt < to_dt:
  if from_dt.weekday()==5 or from_dt.weekday()==6: #count how many saturdays and sundays
  weekend_days += 1
  from_dt=from_dt+datetime.timedelta(days=1)
 diff_day = timedelta.days - weekend_days + float(timedelta.seconds) / 86400
return diff_day
0
Avatar
Ignorer
Yenthe Van Ginneken (Mainframe Monkey)

Have you updated your Python code with a -u yourModuleName

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Meilleure réponse

Milos,

Make sure you have imported the py file in __init__.py

2
Avatar
Ignorer
Avatar
Soltani Charif
Meilleure réponse

eekend_exclude=fields.boolean('Weekend')


the new api start with a capital lettre

eekend_exclude=fields.Boolean('Weekend')

0
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é
View inheritance hiding a field
views inheritance
Avatar
Avatar
1
nov. 24
2575
Change the Position of field in Xpath Résolu
views inheritance
Avatar
Avatar
Avatar
Avatar
Avatar
5
juil. 24
95761
How to extend a base template for a specific page only, without affecting other pages that use the same base template?
views inheritance
Avatar
Avatar
1
déc. 23
3985
removing elements from an inherited view
views inheritance
Avatar
Avatar
1
mai 22
5014
I am building a custom module that has a dependent module that has extended the base view of res_partner. In my custom module I also have an inherited view of the base res_partner view. In it how do I hide the inherited view of my dependent module?
views inheritance
Avatar
0
janv. 20
3489
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