Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Food & Hospitality
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Guest House
    • Distribuidor de bebidas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consulting
    • Accounting Firm
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Trades
    • Handyman
    • Hardware y asistencia informática
    • Solar Energy Systems
    • Zapatero
    • Servicios de limpieza
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Field does not exist error [Odoo 9.0]

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
viewsinheritancefieldleaves
3 Respuestas
7095 Vistas
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
Descartar
Yenthe Van Ginneken (Mainframe Monkey)

Have you updated your Python code with a -u yourModuleName

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Mejor respuesta

Milos,

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

2
Avatar
Descartar
Avatar
Soltani Charif
Mejor respuesta

eekend_exclude=fields.boolean('Weekend')


the new api start with a capital lettre

eekend_exclude=fields.Boolean('Weekend')

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
View inheritance hiding a field
views inheritance
Avatar
Avatar
1
nov 24
2566
Change the Position of field in Xpath Resuelto
views inheritance
Avatar
Avatar
Avatar
Avatar
Avatar
5
jul 24
95730
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
dic 23
3977
removing elements from an inherited view
views inheritance
Avatar
Avatar
1
may 22
5006
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
ene 20
3486
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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