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

[V14] commit and write lock to controller

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
stock_pickingcursorshippingthreadingcontrollers
3066 Tampilan
Avatar
Angel

Hi everyone,


I'm having trouble saving some data to a stock picking model. When I press the validate button and later I press the button "Create Backorder".  Enter a "send_shipping" method in "delivery.carrier" due to the creation of a carrier created by me.


Within this method,  called a custom controller via requests,  in this way, to be able to save the picking data before it is finished. In this way, if there was an error, the information that I saved could be used again without the need to call the api again.  Because I'm having problems that the method called twice and created two expeditions to the carrier.


The problem is when I try to execute the write method on the stock picking in  the  Controller.  I don't know how but it gets lock.  And the program does not continue.


This is the part of the controller call in the delivery carrier in the method "send_shipping":

base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
save_picking_data_url = base_url + '/hello_world/delivery_carrier/save_data_send_shipping'

response = requests.post(
    save_picking_data_url,
    data=json.dumps({
        'params': {
            'stock_picking_id': picking.id,
            'tracking_number': tracking_number,
            'label_data': label_data
        }
    }),
    headers={'Content-Type': 'application/json'},
    cookies={'session_id': http.request.session.sid }
)


And these is the controller method to save the data:

# -*- coding: utf-8 -*-
from odoo import http
from odoo.http import route, request

class Controllers(http.Controller):
    @route('/hello_world/delivery_carrier/save_data_send_shipping', auth='user', type='json', methods=['POST'])
    def save_data_send_shipping(self):
        user = request.env['res.users'].browse([request.uid])
        stock_picking_id = request.params.get('stock_picking_id')
        tracking_number = request.params.get('tracking_number')
        label_data = request.params.get('label_data')

        # Check that the user is in the group
        if not user.has_group('stock.group_stock_user'):
            return {'error_message': 'Error. You don\'t have permissions in the stock'}
        elif not stock_picking_id or not tracking_number or not label_data:
            return {'error_message': 'Error. Missing parameters (stock_picking_id, tracking_number, label_data)'}
        
        stock_picking = request.env['stock.picking'].browse([stock_picking_id])
        stock_picking.write({
            'tracking_number_response': tracking_number,
            'label_data_response': label_data
        })

return {'error_message': False}


Someone can know why it happens or do you need more information about the problem?


Greetings and thank you very much!

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
How to invoke model and cursor inside controller? Openerp Version 7 Diselesaikan
models cursor controllers version7
Avatar
Avatar
Avatar
4
Jul 19
8292
Controller giving 404 Error
controllers
Avatar
Avatar
Avatar
2
Agu 25
3595
Odoo Default Shipping - Change to rate for Volume
shipping
Avatar
Avatar
1
Agu 25
1320
Does anyone know if it's possible to make adding a shipping method/price mandatory?
shipping
Avatar
Avatar
1
Jul 25
2087
Shipping GET RATE
shipping
Avatar
Avatar
1
Jul 25
2272
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