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

How to set value when create stock picking via confirming a sale order?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
stock_pickingsale.orderOdoo13.0
2 Replies
4264 Tampilan
Avatar
Manuel González

When I confirm an order (sale.order) then it creates a stock.picking related to this order (when I confirm the sale order). I have a new field "insurance" at stock.picking which is filled when I select a carrier and then sums values of all lines excluding shipping and puts it in this field. I launch this with an @api_onchange method related to the carrier_id of the stock.picking


I want to directly set this value when stock.picking is created (when confirm an order clicking in Confirm button). How can I do this? I didn't find where the stock.picking is being created.


I'm using OCA delivery carrier branch and odoo v13

0
Avatar
Buang
Avatar
Manuel González
Penulis Jawaban Terbai

I finally did it work. I inherit sale.order and here I overwrite action_confirm method. Then I search inside self.picking_ids and here I can sum all lines excluding shipping method.

I'm not sure why picking doesn't exists if I try the solution proposed by Hamrul, but this works fine.

    def action_confirm(self):
        res = super(SaleOrder, self).action_confirm()
        self.ensure_one()
        for rec in self.picking_ids:
            # only if carrier is ups and have insurance
            if rec.carrier_id.delivery_type == "ups" and rec.carrier_id.ups_insurance:
                ups_insurance = rec.carrier_id.ups_insurance
                ups_insurance_value = sum(
                    sl.price_subtotal # value untaxed to sum
                    for ml in rec.move_lines
                    for sl in ml.sale_line_id
                    if "UPS" not in sl.name # if line name doesn't contain "UPS" in capital letters
                )
                rec.ups_insurance = ups_insurance,
                rec.ups_insurance_value = ups_insurance_value

        return res
0
Avatar
Buang
Avatar
Kamrul Hasan
Jawaban Terbai

You need to inherit confirm button action and write to your new field "insurance" on stock.picking model via carrier_id.

def action_confirm(self):
for rec in self:
rec.carrier_id.write({'insurance': self.insurance})
return super([Class_name], self).action_confirm()


0
Avatar
Buang
Manuel González
Penulis


Manuel González
hace 2 segundos Autor

It doesn't work. It never goes inside the for loop. I guess in this point stock.picking is still void or something like that.
If I print self I get stock.picking() but it doesn't print anything inside the for loop.

def action_confirm(self):
import logging
_logger = logging.getLogger(__name__)
res = super(StockPicking, self).action_confirm()
_logger.critical(self) #it prints 'stock.picking()'
for rec in self:
_logger.critical('hello') #print nothing
_logger.critical(rec) #print nothing
[...]

Kamrul Hasan

when you click confirm button as excepted result 'stock.picking(11,)' not 'stock.picking()'', please make sure function inherit right way.

Manuel González
Penulis

The inherited function is done correctly, as far as I can see, it has declared the inheritance of stock.picking.

class StockPicking(models.Model):
_inherit = "stock.picking"

and I get the result I showed you before inside the action_confirm function.

I guess to make work this i should make inheritance with sale.order and, in the action_confirm function, iterate the self.picking_ids to find the pickings and work with them?

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
How to attach programmaticly pdf file/s into stock.picking
stock_picking sale.order
Avatar
0
Jul 16
4131
How can I see where a product or a serial/lot number are reserved? Diselesaikan
stock stock_picking sale.order
Avatar
Avatar
1
Jun 22
6224
How to obtain the serial number of a product from a sales order?
serial_number sale.order Odoo13.0 rma
Avatar
0
Jun 24
1554
inherit stock.picking
community stock_picking sale.order v15
Avatar
Avatar
1
Mar 24
3648
How to validate delivery order forcefully in Odoo 13? Diselesaikan
sale.order picking_out Odoo13.0 odoo13CE
Avatar
Avatar
1
Jun 22
3028
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