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
    • Conocimientos
    • 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
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • 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

Hi, please help me my problem is treeview can't update value. How to fix? (odoo10)

Suscribirse

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

Se marcó esta pregunta
treeviewodoo10
4 Respuestas
4490 Vistas
Avatar
delgertsetseg

Here is my code 

 @api.multi

def button_plan(self):

quantity = []

res = super(MrpProduction, self).button_plan()

for production in self:

planned_date = fields.Datetime.from_string(self.date_planned_start)

production_values = {'date_planned_start_wo': False,

'date_planned_finished_wo': False,

'quantity': 0}

values = {}

print quantity

for workorder in production.workorder_ids:

date_start = planned_date

date_end = date_start + timedelta(minutes=workorder.duration_expected)

values['date_planned_start'] = fields.Datetime.to_string(date_start)

values['date_planned_finished'] = fields.Datetime.to_string(date_end)

values['quantity'] = fields.Float(quantity)

for operation in self.routing_id.operation_ids:

if operation.compute_equals_order_qty == True:

quantity = self.product_qty

print 'quantity', quantity

if operation.compute_equals_always_one == True:

quantity = 1.0

print 'quantity', quantity

if operation.compute_equals_workcenter == True:

quantity = operation.workcenter_quantity

print 'quantity', quantity

workorder.qty_workorder = quantity

print 'workorder.qty_workorder ::::',workorder.qty_workorder

workorder.write(values)

production_values['date_planned_finished_wo'] = fields.Datetime.to_string(planned_date)

production.write(production_values)

# production.write(values)

return res


The terminal output is 


quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0

2018-01-11 09:37:55,163 15380 WARNING odoo10 odoo.models: mrp.workorder.write() with unknown fields: quantity

quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0

2018-01-11 09:37:55,174 15380 WARNING odoo10 odoo.models: mrp.workorder.write() with unknown fields: quantity

quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0


Right output is: 

workorder.qty_workorder is 1, 35, 56 

0
Avatar
Descartar
Anil Kesariya

Your code is not properly structured, it is difficult to understand.

delgertsetseg
Autor

Sorry, now understanding ?

Avatar
Mayank Gosai
Mejor respuesta

Hello,

Try this:

@api.multi

def button_plan(self):

quantity = 0

res = super(MrpProduction, self).button_plan()

for production in self:

    for workorder in production.workorder_ids:     

         for operation in self.routing_id.operation_ids:

            if operation.compute_equals_order_qty == True:

                quantity = self.product_qty

            if operation.compute_equals_always_one == True:

                    quantity = 1.0

            if operation.compute_equals_workcenter == True:

                    quantity = operation.workcenter_quantity   

            workorder.qty_workorder = quantity

     return res


In your case , you applied 'workorder.qty_workorder = quantity' outside loop.
Make that happen inside loop.

Thanks,

Mayank Gosai

0
Avatar
Descartar
delgertsetseg
Autor

I fix this error,

workorder.write({'qty_workorder': quantity}) Thanks

Avatar
delgertsetseg
Autor Mejor respuesta

 @api.multi

def button_plan(self):

quantity = 0

res = super(MrpProduction, self).button_plan()

for production in self:

    for workorder in production.workorder_ids:     

         for operation in self.routing_id.operation_ids:

            if operation.compute_equals_order_qty == True:

                quantity = self.product_qty

            if operation.compute_equals_always_one == True:

                    quantity = 1.0

            if operation.compute_equals_workcenter == True:

                    quantity = operation.workcenter_quantity   

         workorder.qty_workorder = quantity

     return res

------------------------------------------------------Output ---------------------------------------

quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0

quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0

quantity 1.0

quantity 35.0

quantity 56.0

workorder.qty_workorder :::: 56.0

---------------------------------------Righ Output --------------------------------

workorder.qty_workorder =1

workorder.qty_workorder=35

workorder.qty_workorder=56 

Sorry, now understand?




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
Prevent create and delete on a One2many tree view Resuelto
treeview one2many odoo10
Avatar
1
jul 20
9414
How to add serial number in Tree view in odoo 10 Resuelto
treeview serial_number odoo10
Avatar
1
oct 19
5261
[odoo10] : How to load kanban view on click of tree view's record of different model?
treeview kanban odoo10
Avatar
0
ago 18
6521
How can I inherit a treeview and make it editable, without altering the parent treeview?
treeview inheritance odoo10
Avatar
Avatar
1
jul 18
8338
How we added link in Tree view in odoo
treeview link odoo10
Avatar
Avatar
1
jun 18
9219
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