Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

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

Subscriure's

Get notified when there's activity on this post

This question has been flagged
treeviewodoo10
4 Respostes
4446 Vistes
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
Best Answer

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 Best Answer

 @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
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Prevent create and delete on a One2many tree view Solved
treeview one2many odoo10
Avatar
1
de jul. 20
9391
How to add serial number in Tree view in odoo 10 Solved
treeview serial_number odoo10
Avatar
1
d’oct. 19
5227
[odoo10] : How to load kanban view on click of tree view's record of different model?
treeview kanban odoo10
Avatar
0
d’ag. 18
6486
How can I inherit a treeview and make it editable, without altering the parent treeview?
treeview inheritance odoo10
Avatar
Avatar
1
de jul. 18
8283
How we added link in Tree view in odoo
treeview link odoo10
Avatar
Avatar
1
de juny 18
9200
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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