Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Customizing Sequence Code Generation and Delivery Slip Behavior in stock.picking Module

Odoberať

Get notified when there's activity on this post

This question has been flagged
communitystock_pickingv15
3 Replies
4985 Zobrazenia
Avatar
Kabir Khan

"I'm looking for guidance on customizing the behavior of the stock.picking module in my ERP system. Currently, when confirming a quotation, it creates a sale order along with a delivery slip, which generates a sequence code immediately. However, I want to delay the generation of the delivery slip number until the stock.picking state is 'done'. Essentially, The behavior of the sale invoice process where the sequence code isn't generated until the invoice is done. Additionally, I want the stock.picking state to remain as 'draft' until the delivery is done. Can anyone provide insights or steps on how to achieve this customization effectively? Any advice, code snippets, or pointers to relevant documentation would be highly appreciated. Thank you!"

0
Avatar
Zrušiť
Avatar
Jaideep
Best Answer

Why not create a new field "Delivery Challan" with sequence number that is updated when the picking state is done?

Update the required reports with the new field and make the current field invisible in the views.

1
Avatar
Zrušiť
Kabir Khan
Autor

yes you are also right brother.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

You can modify the sequence of stock.picking from the UI itself, for that go toInventory -> Configuration -> Operation Types


Open any operation type, You can see the sequence prefix from it


 Go to the internal link of the Reference sequences to make changes for more


Hope it helps

0
Avatar
Zrušiť
Kabir Khan
Autor

dear brother i just wanted to dont want create delivery challan number untill the ​

if stock_picking.state == 'done':

when i click quotation confirm it will create sale order and also create stock picking transfer with challan number but i wish its creating challan or delivery on state == done when i click to validate the stock picking transfer challan generate
otherwise stock pick transfer is dont want to such he creating delivery challan number

hope you understand :)

i just wanted to not forced to create delivery challan on creating sale order i inherit the method but didnt get it will creating automatically delivery challan number

Avatar
Dương Nguyễn
Best Answer

I check the code , if you do like this , you will need to do 2 think

1. Remove the sql constrain for unique name


2. Add these code

@api.model

def create(self, vals):

​res = super().create(vals)

​for r in res:

​ ​if r.name != '/' and r.state != 'done':

​ ​ ​r.name = '/'

​return res


 

def write(self, vals):

​res = super().write(vals)

​for r in self:

​ ​if r.name == '/' and r.state == 'done':

​ ​ ​picking_type = r.picking_type_id

​ ​ ​if picking_type.sequence_id.number_next_actual > 0:

​ ​ ​ ​picking_type.sequence_id.number_next_actual -= 1

​ ​ ​r.name = picking_type.sequence_id.next_by_id()

return res
overall, i suggest that you shouldn't do this because this is quite strange behavior unless you have something specific thing why you doing like this

0
Avatar
Zrušiť
Kabir Khan
Autor

dear brother i just wanted to dont want create delivery challan number untill the ​
if r.state == 'done':

when i click quotation confirm it will create sale order and also create stock picking transfer with challan number but i wish its creating challan or delivery on state == done when i click to validate the stock picking transfer challan generate
otherwise stock pick transfer is dont want to such he creating delivery challan number

hope you understand :)

i just wanted to not forced to create delivery challan on creating sale order i inherit the method but didnt get it will creating automatically delivery challan number

Dương Nguyễn

Hi Sir, i have modified the answer please check

Kabir Khan
Autor

ok ill check and reply

Kabir Khan
Autor

@Dương Nguyễn beacause the delivery challan was not in sequence the delivery order is not proper date wise with seqence code like

deliverychallan001 this is delivery expected time 20 March
deliverychallan002 this is delivery expected time 02 March

in delivery chllan the sequence not maintain
deliverychallan002
deliverychallan001
is show like this will export this and send data to GOVT TAX india then the entry delivery challan number not sync proper sequence wise.

Kabir Khan
Autor

code is not working

Dương Nguyễn

really, i test i work fine, is this the flow that you want
Confirm Sale Order -> The system will create a delivery picking and the picking name will stay '/' until you validate it right

Kabir Khan
Autor

can you share me full code of file? how many module you inherit i added this in new custom file but it will generate
automatically

class CustomStockPicking(models.Model):
_inherit = 'stock.picking'

@api.model
def create(self, vals):
res = super(CustomStockPicking, self).create(vals)
for r in res:
if r.name != '/' and r.state != 'done':
r.name = '/'
return res

def write(self, vals):
res = super(CustomStockPicking, self).write(vals)
for r in self:
if r.name == '/' and r.state == 'done':
picking_type = r.picking_type_id
r.name = picking_type.sequence_id.next_by_id()
return res

Kabir Khan
Autor

name = fields.Char('Reference', default='/', copy=False, readonly=True)

i update this and also upgrade module but still is show

Reference must be unique per company!

Kabir Khan
Autor

its working but when add more then one...
Reference must be unique per company!

i update the code and remove index but not working should i change too in pgadmin ?

Kabir Khan
Autor

Done thank you

Kabir Khan
Autor

sequence number not prefect its mismatch

Dương Nguyễn

I don't understand, how you want it to match ? The logic behind it is like if you have picking 001, 002 already the next one will always be 003 you can't change that

Kabir Khan
Autor

this is +1 number in when we confirm sale order and then after we validate it another +1 so 1 number is mismatching

Dương Nguyễn

Can you share me a video , i might be able to troubleshot for you ?

Kabir Khan
Autor

when i confirm the quotation in ir.sequence module where we to fetch next number its add automatically so sequence did not maintain its a gape 1 in every delivery challan

Kabir Khan
Autor

when we click confirm sale order it will create sequence in backend we want to fixed this then this functionality will work perfectly

Kabir Khan
Autor

my question only is this we don't want to also create sequence number if delivery challan not generated.

your answer is work but sequence is not maintain its increment 2 times ir.sequence table next number...

hope you understand

Dương Nguyễn

Oh i found the bug, because in the original create method, odoo already increase it so in the ovveride i give i increase it to. So here is the modify code
def write(self, vals):
res = super().write(vals)
for r in self:
if r.name == '/' and r.state == 'done':
picking_type = r.picking_type_id
if picking_type.sequence_id.number_next_actual > 0:
picking_type.sequence_id.number_next_actual -= 1
r.name = picking_type.sequence_id.next_by_id()
return res

Kabir Khan
Autor

are you sure you changes in write method ? what about create method ?

Dương Nguyễn

i test and it work but i am not sure whether this create more bug or not because your use case is strange you know,
Good Luck sir

Kabir Khan
Autor

not working mismatch sequence number

whole code
--------------------

from odoo import api, fields, models

class CustomStockPicking(models.Model):
_inherit = 'stock.picking'

name = fields.Char('Reference', default='/', copy=False, readonly=True)
_sql_constraints = [
('name_uniq', 'unique(company_id)', 'Reference must be unique per company!'),
]

@api.model
def create(self, vals):
res = super(CustomStockPicking, self).create(vals)
for r in res:
if r.name != '/' and r.state != 'done':
r.name = '/'
return res

def write(self, vals):
res = super(CustomStockPicking, self).write(vals)
for r in self:
picking_type = None # Initialize picking_type with a default value
if r.name == '/' and r.state == 'done':
picking_type = r.picking_type_id
if picking_type.sequence_id.number_next_actual > 0:
picking_type.sequence_id.number_next_actual -= 1
r.name = picking_type.sequence_id.next_by_id()
return res

Dương Nguyễn

Ok at least i try, thank you anyway

Kabir Khan
Autor

still gape 1 to 2 you can check both side via confirming order and direct create transfer still issue in sequence number :(

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

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
inherit stock.picking
community stock_picking sale.order v15
Avatar
Avatar
1
mar 24
3762
How to call another models onchange function in my custom model, when we call that , i want to work the fucntion
community v15
Avatar
Avatar
Avatar
2
aug 23
3270
500: Internal Server Error in odoo Community 15 Solved
community v15
Avatar
Avatar
Avatar
2
máj 23
3411
Can i call another models onchange function from my custom model?
community v15
Avatar
Avatar
1
apr 23
3623
odoo ocr
community v15
Avatar
0
jún 22
2461
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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