Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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

Create/Update: a mandatory field is not set

Suscribirse

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

Se marcó esta pregunta
errormany2oneone2manyOdoo13mandatory-field
1 Responder
3885 Vistas
Avatar
Sheetal

Okay so i solved it. Just switched x_survey_id with an existing survey_id in survey.user_input as relation field in survey.survey. But now I can't calculate the fields. I want to use x_rate field from survey.survey model but the other field (x_amount_payable) i want to calculate with x_rate and the field (x_total_paying_fjd) in which it will be displayed is in survey.user_input model. How can I compute x_total_paying_fjd = x_amount_payable/x_rate?


So I'm very new to odoo and I've been tasked to create a one2many field from front end/interface. I have to create the "Add a line.." function that opens a new form to enter details and save to table.

 I used pre-existing models to create a one2many field since I don't have backend access to create models for now. I used survey.survey as my main model to implement the one2may field (x_survey_line_ids) and  survey.user_input as the sub-model with all other fields I want displayed (x_date, x_amount, x_amount_payable, x_invoice_id - many2one[account.asset.asset], x_purchase_order, x_receipt, x_remarks, x_survey_id - many2one[survey.survey], x_total_paying_fjd, x_wht1, x_wht2). 


This is my code in Edit:View Form of survey.survey.


 
                             
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
                             
                             
                               
                                   
                                   
                                   
                                   
                                   
                                   
                                   
                                   
                                   
                                   
                               
                             
                           


I've used x_survey_id  as the relation field and survey.user_input as object relation for x_survey_line_ids.


I can add a line and enter information in the new form that opens but it gives this error when trying to save. What can I do from front end to solve it?


"The operation cannot be completed: 

- Create/update: a mandatory field is not set. 

- Delete: another model requires the record being deleted. If possible, archive it instead. 

Model: Survey User Input (survey.user_input), Field: Survey (survey_id)"

0
Avatar
Descartar
Avatar
Surbhi Parmar
Mejor respuesta

from odoo import models, fields, api

from odoo.exceptions import UserError


class SurveyUserInput(models.Model):

    _name = 'survey.user_input'

    

    x_date = fields.Date(string='Date', required=True)

    x_amount = fields.Float(string='Amount', required=True)

    x_amount_payable = fields.Float(string='Amount Payable', required=True)

    # Other fields...

    x_survey_id = fields.Many2one('survey.survey', string='Survey', required=True)


    @api.constrains('x_date', 'x_amount', 'x_amount_payable', 'x_invoice_id', 'x_survey_id')

    def _check_mandatory_fields(self):

        for record in self:

            if not all([record.x_date, record.x_amount, record.x_amount_payable, record.x_invoice_id, record.x_survey_id]):

                raise UserError('Please fill in all mandatory fields.')


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

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Odoo 13 : Problems with one2many/many2one filters Resuelto
many2one one2many Filters Odoo13
Avatar
1
feb 24
2249
Automatically open many2one or one2many field without clicking external link icon
code many2one one2many Odoo13 odoo13
Avatar
0
oct 22
2753
Pass values to the list view by the wizard !? (Odoo 13)
wizard many2one one2many listview Odoo13
Avatar
0
abr 21
3973
key = 'default_' + name TypeError: must be str, not int (Odoo 13)
treeview many2one one2many one2many_list Odoo13
Avatar
0
feb 21
4436
How do I put One2many after Many2one defined? - transient module states reset
many2one one2many
Avatar
1
mar 23
3136
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar 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