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
    • Diskusi
    • 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

many2one value

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
inheritancemany2one
2 Replies
4779 Tampilan
Avatar
Marychan

I'm still confuse, is many2one field always return a boolean value False


Like when u inherit a field from another model

field_id = fields.Many2one('model.name','Field String')

if I print field_id.field_name, it always return false even though the field_name type is integer.

0
Avatar
Buang
Avinash Nk

The field "field_name" have value?

Also, please ensure you restart your Odoo service and upgrade the module.

Marychan
Penulis

Yes sir, there's a value 100 then I want to fetch it but it returns a false value.

I tried to restart it many times,still the same

Avinash Nk

You can provide me the entire code?

Marychan
Penulis

Yes sir

from odoo import models,fields,api

from docutils.nodes import field

from datetime import datetime,date,time

from odoo.addons.base import res

class AccountInvoice(models.Model):

_inherit = 'account.invoice'

owner_id = fields.Many2one(

'res.partner', 'Owner')

partner_id = fields.Many2one(

'res.partner', 'Partner')

company_id = fields.Many2one(

'res.company', 'Company',

default=lambda self: self.env['res.company']._company_default_get('stock.picking'))

backorder_id = fields.Many2one('stock.picking','Back Order of')

date_invoice = fields.Date("Invoice: ")

@api.multi

def _write(self, vals):

res = super(AccountInvoice,self)._write(vals)

print("Owner ID: " + str(self.owner_id.min_date)) #false

print("Partner ID: " + str(self.partner_id.name))

print("Company ID: " + str(self.company_id.name))

print("Backorder ID: " + str(self.backorder_id.min_date)) #false

print('=============================')

print("Invoice: " + self.date_invoice)

return res

i tried every id that is m2o, to know which id have access of min_date

Avinash Nk

What is this? --> from odoo.addons.base import res?

why you need the following import?

from docutils.nodes import field

you are not using the following import. so avoid the imports that you are not using

from datetime import datetime, date, time

Avinash Nk

min_date field is a customized field in stock.picking?

Marychan
Penulis

Some of my imports were automatically imported, my bad, I will remove it.

No, The min_field is declared inside the stock.picking class ,

I'm sorry, I'm still exploring the flow of odoo and I find it confusing on some part of it especially the relation model

Avinash Nk

I can't get your exact problem.

Anyway, try the write method instead of _write.

let me know the results.

Marychan
Penulis

It still the same sir, the _write method is inherited from account.invoice ,

The goal of the code is to inherit also the min_date field value from stock.picking inside the inherited class account.invoice and initialize it on the date_invoice field.

How could I do it? They told me to get the id from the stock,picking but when i used the backorder_id.min_date, it returns false

Avinash Nk

Try related field concept

Marychan
Penulis

Ok sir Avinash. Thank u for helping me :)

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
Many2one returns False
inheritance many2one
Avatar
Avatar
2
Okt 19
4198
Get custom field's value from BoM to production order
development inheritance many2one
Avatar
0
Jun 22
2982
value not pass from many2one field to form
many2one
Avatar
Avatar
Avatar
Avatar
3
Sep 25
2344
Can't inherit base.view_partner_form of res.partner
inheritance
Avatar
Avatar
Avatar
Avatar
Avatar
4
Feb 25
4224
Display values of dropdown in a many2one field Diselesaikan
many2one
Avatar
Avatar
2
Feb 25
6945
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