Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

[9.0] How to solve this Problem of quantity when a PO is created after the confirmation of SO ?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
confirmationquantityposo9.0
4 Antwoorden
6088 Weergaven
Avatar
Totor

Hi, I inherit the function "make_po" in order that after the confirmation of a SO, a PO is created.

It works but the problem is that if I put 1 article X in my SO, I'll have 3 articles X in my PO

I did tests with prints and the function "make_po" is executed 3 times but I don't know why.

This is my class:

class procurement_order(models.Model):

_inherit = 'procurement.order'

def make_po(self):

res = super(procurement_order,self).make_po()

so_name = self.origin[:5]

sale_order=self.env['sale.order'].search([('name', '=', so_name)])

analytic_account_id = sale_order.project_id.id

po_line = self.env['purchase.order.line']

idPOLine = po_line.search([('id', '=', self.purchase_line_id.id)])

idPOLine.write({'name':self.name,'account_analytic_id':analytic_account_id})

procurement_order()

In advance, thanks.

0
Avatar
Annuleer
Yenthe Van Ginneken (Mainframe Monkey)

Still have the problem but the problem comes from the fact that the make_po method is runned 3 times,


so the quantity is set to 3 instead 1


But I don't know why, help me please ^^

Yenthe Van Ginneken (Mainframe Monkey)

You should use @api.multi at the top of the function and use self.ensure_one inside the function. Why don't you write on the res record? You're writing on the po_line.search but why not write directly on res which contains your values?

Totor
Auteur

I tried your solution but it doesn't work : class procurement_order(models.Model): _inherit = 'procurement.order' @api.multi def make_po(self): self.ensure_one() res = super(procurement_order,self).make_po() so_name = self.origin[:5] sale_order=self.env['sale.order'].search([('name', '=', so_name)]) analytic_account_id = sale_order.project_id.id po_line = self.env['purchase.order.line'] idPOLine = po_line.search([('id', '=', self.purchase_line_id.id)]) idPOLine.write({'name':self.name,'account_analytic_id':analytic_account_id}) procurement_order()

Avatar
Totor
Auteur Beste antwoord

The solution is to add first : @api.multi


And at the end : return res

0
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
[9.0] How to generate PO when a SO is confirmed ? Opgelost
po so generate confirmed 9.0
Avatar
1
mrt. 16
5727
[9.0] Why my "make_po" method is runned 3 times ? Opgelost
inherit po make 9.0
Avatar
1
mrt. 16
4366
How can I disable Grid edit in PO form
form v7 po so
Avatar
0
mrt. 15
5028
Automatically Locking SO Issue
sales confirmation so SalesOrder v14
Avatar
Avatar
1
dec. 21
1772
any delivery time plan module documentation?
stock delivery po so movement
Avatar
Avatar
1
dec. 15
5066
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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