Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

iterate and write new values in a model

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
pythonmodulemodelscustom
5187 Tampilan
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
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Can't import a model in odoo view Diselesaikan
python module models odoo10.0
Avatar
Avatar
Avatar
Avatar
Avatar
7
Jul 19
43247
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
2216
Field doesn't exist in module when i upgrade the module
views module models custom estate
Avatar
Avatar
1
Mei 24
1889
Custom Module Not Populating in Apps List Diselesaikan
module custom
Avatar
Avatar
4
Okt 20
10080
How to use a model source code in different folder than module root? (i.e. inside directory "models") Diselesaikan
python module models init odooV8
Avatar
Avatar
Avatar
3
Mei 19
11372
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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