Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Reverse Transfer - how to stop returning more than was delivered - Odoo.sh v16

Odebírat

Get notified when there's activity on this post

This question has been flagged
returnsodoo
1 Odpovědět
3701 Zobrazení
Avatar
Roy Antunovich

How do I stop a reverse transfer from being done for more than the delivered quantity on the Sales Order? At the moment my team can change the quantity on the Reverse Transfer to more than was delivered, this then leave the sales order with a negative delivered quantity.

I have a simple Automated action that stops delivering more product than is ordered. This is run on the Stock Move model, matching all records, and executes the python code.

if record.product_uom_qty

  raise UserError("You can't transfer more than the Initial Demand!")


I can't work out how to write this for a Reverse Transfer (Return Picking model) where the quantity gets compared to the delivered quantity on the sales order.

Any help would be appreciated.

0
Avatar
Zrušit
Luis Jacobo

We are in the same page mate, can you share the server action for avoid delivering more product than is ordered?

Thanks.

Avatar
Gracious Joseph
Nejlepší odpověď

To stop a reverse transfer in Odoo 16 from being done for more than the delivered quantity, you can implement an automated action or override the relevant Odoo method to enforce this restriction.

Here’s how you can implement this:

1. Understanding the Requirement

  • Reverse Transfer: This process is initiated from the original delivery picking to return goods.
  • Delivered Quantity: You need to ensure that the return quantity does not exceed the delivered quantity.

2. Automated Action Approach

You can create an Automated Action that validates the return picking quantity before confirmation.

Steps to Create Automated Action

  1. Activate Developer Mode:
    • Go to Settings > Activate Developer Mode.
  2. Navigate to Automated Actions:
    • Go to Settings > Technical > Automated Actions.
  3. Create a New Automated Action:
    • Model: stock.move
    • Trigger: On Creation & Update
    • Condition: Add a domain to target only reverse transfers:
      [('picking_type_id.code', '=', 'incoming'), ('origin_returned_move_id', '!=', False)]
      
    • Python Code:
      for record in records:
          if record.origin_returned_move_id:
              delivered_qty = record.origin_returned_move_id.quantity_done
              if record.quantity_done > delivered_qty:
                  raise UserError(
                      "You cannot return more than the delivered quantity! Delivered: %s, Trying to Return: %s" %
                      (delivered_qty, record.quantity_done)
                  )
      

3. Server-Side Method Override (Recommended)

If your team is familiar with Odoo development, overriding the button_validate method on the stock.picking model ensures this logic is enforced at the server level.

Steps to Implement

  1. Create a Custom Module: If you don’t have one already, create a custom module.
  2. Extend the stock.picking Model: Override the button_validate method to add validation for reverse transfers.
    Code Example:
    from odoo import models, api
    from odoo.exceptions import UserError
    
    class StockPicking(models.Model):
        _inherit = 'stock.picking'
    
        @api.model
        def button_validate(self):
            for move in self.move_ids_without_package:
                if move.origin_returned_move_id:
                    delivered_qty = move.origin_returned_move_id.quantity_done
                    if move.quantity_done > delivered_qty:
                        raise UserError(
                            "You cannot return more than the delivered quantity! Delivered: %s, Trying to Return: %s" %
                            (delivered_qty, move.quantity_done)
                        )
            return super(StockPicking, self).button_validate()
    
  3. Restart the Server and Upgrade the Module:
    • Restart the Odoo server.
    • Upgrade the module.
    ./odoo-bin -u your_custom_module_name
    

4. Testing

  • Create a sales order and confirm delivery.
  • Initiate a reverse transfer.
  • Try to input a return quantity greater than the delivered quantity.
  • The system should block the operation and raise an appropriate error message.

5. Additional Considerations

  • Multi-Line Validation: If reverse transfers have multiple lines, ensure the logic applies to all lines.
  • Negative Quantities: Check if your setup allows negative stock, as this can also affect the validation.
  • Customizable Messaging: You can improve user feedback by including the product name or other relevant details in the error message.

6. Advantages of the Method

  • Automated Action: Quick to implement with minimal technical involvement.
  • Server-Side Method: More robust and ensures the rule is enforced even if users bypass the UI (e.g., through API).

By implementing one of these approaches, you can effectively prevent your team from returning more items than were delivered, maintaining accurate stock and sales order records. Let me know if you need further clarification or help!

0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Not returning list view Vyřešeno
returns odoo odoo12
Avatar
Avatar
Avatar
4
čvc 19
4745
SOC 1 Report
odoo
Avatar
Avatar
1
lis 25
187
邮箱无法正常使用
odoo
Avatar
Avatar
1
lis 25
2224
How do I go about this error? I am trying to uninstall a module
odoo
Avatar
Avatar
1
lis 25
3449
How to import product variants with my own external id when using dynamic creation mode Vyřešeno
odoo
Avatar
Avatar
2
srp 25
4020
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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