İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Index output of browse method

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
browse13
1 Cevapla
3404 Görünümler
Avatar
Melvin

Hi everyone, I've been trying to point to specific index in the output of my browse method.


this is my code:

def unir_facturas_boton(self, vals):
active_invoices = self.env['account.move']._context.get('active_ids', [])
active_records = self.env['account.move'].browse(active_invoices)
# source = active_records[--1]
# source_2 = active_records[0]

for items in active_records:
print(items)
# if items[-1].partner_id != items[0].partner_id:
# raise ValidationError('No es posible unir facturas con clientes diferentes')
# else:
# invoice = self.env['account.move'].create(
# {
# 'company_id': items[-1].company_id,
# 'type': items[-1].type,
# 'invoice_date': items[-1].invoice_date,
# 'partner_id': items[-1].partner_id.id,
# 'currency_id': items[-1].currency_id.id,
# 'journal_id': 11
# })
# for lines in items[-1].invoice_line_ids:
# invoice.write({
# "invoice_line_ids": items[0].invoice_line_ids.append(lines)


# })

the commented part is giving me erros since I cant catch the index.



this the output of the browse method:

account.move(2,)
account.move(1,)


how can I point to an specific one of these two?



0
Avatar
Vazgeç
Avatar
Murray Carson
En İyi Yanıt

It looks like you are trying to merge invoices and don't want to merge them if they each have a different partner_id.  My question would be: are you selecting invoices that have the same partner_id?

As for the error, I think you're using your for loop syntax incorrectly.  It might help to instead write it as:

for item in active_records:

Each item will be iterated through, and depending on the type of object they may have elements 0 and -1, but it's unlikely.  You would want to check active_records[0] against active_records[-1] for a match on the partner_id.  At least that's how it makes sense in my head.

Here's a link on how that particular function works in case you'd like a refresher:
https://www.geeksforgeeks.org/iterate-over-a-list-in-python/

Hope that helps.

1
Avatar
Vazgeç
Melvin
Üretici

Yes, I just solved it doing the same thing, instead of iterating over the values of active_record I just created to variables that store each index, In my case I'll always just use 2 active_ids so it would be only active_record[0] and active_record[1], but now I'm having issues trying to append the invoice_line_ids from record[0] with record[1] and making a new invoice based on this

Murray Carson

Not sure if this will solve your new issue, but I would think you'd want to create the new invoice object first and append the invoice_line_ids to that new object. Alternatively you could just use one of the existing ones and append the ones from the other prior to archiving it.

Enjoying the discussion? Don't just read, join in!

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
How to automate initial configuration? Çözüldü
13
Avatar
Avatar
Avatar
Avatar
4
Şub 24
7980
Where can I find a report on cash in / out? Çözüldü
13
Avatar
Avatar
Avatar
Avatar
3
Mar 24
3669
One email with multiple recipient
13
Avatar
0
Kas 22
3008
decimal separator ore thousands separator
13
Avatar
Avatar
Avatar
2
Şub 22
6832
Moving Odoo 13 database from Odoo.sh to dedicated server
13
Avatar
0
Kas 21
3596
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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