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
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Artificiële Intelligentie
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelwinkel
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor 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
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

iterate and write new values in a model

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
pythonmodulemodelscustom
6249 Weergaven
Avatar
Dominic Anyanna

i have the following models,production  data is uploaded to dlc.pdata via excel without workstations with zero production so i created a function to identify missing workstations and write a value of 0 but it does not write only those not present but all .


class ProductionData(models.Model):
_name = 'dlc.pdata'
_rec_name = 'start_date'
_description = 'New Description'

name = fields.Char()
start_date = fields.Date(string="From", required=False, )
end_date = fields.Date(string="To", required=False,)
production_details_ids = fields.One2many(comodel_name="dlc.pdetails", inverse_name="production_data_id", string="Production Details", required=False, )



@api.multi
@api.model_create_multi
def process_data(self, values):
workstation = self.env['dlc.workstation']
dlc = set(workstation.search([]))
pdlc = self.env['dlc.pdetails']
domain = [('production_data_id', '=', self.id)]
pdlct = pdlc.search(domain)
workeddlc = set(a.workstation_id.ids[0] for a in pdlct if a.workstation_id.id)
for x in dlc + workeddlc:
if x not in workeddlc:
nowork2 = x.ids
for line in nowork2:
values = {
'workstation_id': line,
'production_data_id': self.id,
'card_type': 'Office Total',
'cdl': 0,
'gdl': 0,
'msl': 0,
'pdl': 0,
'sdl': 0,
'ddl': 0,
'total': 0,
}

self.env['dlc.pdetails'].create(values)


class ProductionDetails(models.Model):
_name = 'dlc.pdetails'
_rec_name = 'workstation_id'

workstation_id = fields.Many2one(comodel_name="dlc.workstation", string="DLC", required=False, )
production_data_id = fields.Many2one(comodel_name="dlc.pdata", string="Production", required=False, )
card_type = fields.Selection(string="Card Type",
selection=[('Temporary', 'Temporary'), ('Office Total', 'Office Total'),
('Permanent', 'Permanent')], required=False, )
cdl = fields.Integer(string="CDL", required=False, )
gdl = fields.Integer(string="GDL", required=False, )
msl = fields.Integer(string="MSL", required=False, )
pdl = fields.Integer(string="PDL", required=False, )
sdl = fields.Integer(string="SDL", required=False, )
ddl = fields.Integer(string="DDL", required=False, )
total = fields.Integer(string="TOTAL", required=False, )

class WorkStation(models.Model):
_name = 'dlc.workstation'
_description = 'list of work station'

name = fields.Char()
dlc_operator = fields.Many2many("dlc.personnel",string="DLC Personnel")
lga = fields.Many2one('dlc.lga')
state = fields.Many2one('dlc.states')
dlc_supervisor = fields.Many2one('dlc.personnel')
issues_ids = fields.One2many(comodel_name="dlc.issues", inverse_name="dlc_id", string="Issues", required=False, )
status = fields.Selection(string="DLC Status", selection=[('active', 'Active'), ('inactive', 'Inactive'), ], required=False, default= 'active' )
total_dlc = fields.Integer(string="Total DLCs", required=False, compute='_total_dlc')
inactive_dlc = fields.Integer(string="Inactive DLCs", required=False, compute='_inactive_dlc')
dlc_cug = fields.Char(string="DLC CUG Number")


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
Can't import a model in odoo view Opgelost
python module models odoo10.0
Avatar
Avatar
Avatar
Avatar
Avatar
7
jul. 19
44742
Hello, how could I create a button that creates a new record in another model containing data from my current model? from my python module
python module models button records
Avatar
Avatar
Avatar
2
jan. 25
3157
Field doesn't exist in module when i upgrade the module
views module models custom estate
Avatar
Avatar
1
mei 24
2483
Custom Module Not Populating in Apps List Opgelost
module custom
Avatar
Avatar
4
okt. 20
11571
How to use a model source code in different folder than module root? (i.e. inside directory "models") Opgelost
python module models init odooV8
Avatar
Avatar
Avatar
3
mei 19
12464
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
  • Partner worden
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 Svenska ภาษาไทย 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