跳至内容
Odoo 菜单
  • 登录
  • 免费试用
  • 应用程序
    财务
    • 会计
    • 发票
    • 费用
    • 电子表格 (BI)
    • 文档
    • 电子签名
    销售
    • 客户关系管理
    • 销售
    • POS 销售点管理-零售
    • POS 销售点管理 - 餐厅
    • 订阅
    • 租赁
    网站
    • 网站设计
    • 电子商务
    • 博客
    • 论坛
    • 在线客服
    • 在线学习
    供应链
    • 库存
    • 制造
    • 产品生命周期
    • 采购
    • 维护保养
    • 品控
    人力资源
    • 员工
    • 招聘
    • 休假
    • 评价
    • 内部推荐
    • 车队
    营销
    • 社媒营销
    • 电邮营销
    • 短信营销
    • 近期活动
    • 营销自动化
    • 网上调查
    服务
    • 项目管理
    • 工时单
    • 现场服务
    • 服务台
    • 排期
    • 预约
    生产力
    • 讨论
    • 批核
    • IoT物联网
    • VoIP
    • 知识库
    • WhatsApp
    第三方应用软件 Odoo 定制 Odoo云端平台
  • 行业
    零售
    • 书店
    • 服装店
    • 家具店
    • 食品杂货店
    • 五金店
    • 玩具店
    餐饮与酒店服务
    • 酒吧及酒馆
    • 餐厅
    • 快餐
    • 民宿
    • 饮品分销商
    • 酒店
    房地产
    • 房地产代理
    • 建筑师事务所
    • 建造业
    • 地产管理
    • 园艺
    • 业主协会
    咨询
    • 会计师事务所
    • Odoo合作伙伴
    • 市场推广公司
    • 律师事务所
    • 人才招聘
    • 审核 & 认证
    制造
    • 纺织
    • 金属
    • 家具
    • 食品
    • 啤酒厂
    • 企业礼品
    保健与健身
    • 体育俱乐部
    • 眼镜店
    • 健身中心
    • 健康从业者
    • 药房
    • 发型屋
    商贸服务
    • 维修人员
    • IT 硬件及支持
    • 太阳能系统
    • 鞋匠
    • 清洁服务
    • 暖通空调服务
    其他
    • 非营利组织
    • 环境机构
    • 广告牌租赁
    • 摄影服务
    • 自行车租赁
    • 软件经销商
    浏览所有行业
  • 社区
    学习
    • 教学视频
    • 文档
    • 认证
    • 培训
    • 博客
    • 播客
    赋能教育
    • 教育计划
    • Scale Up! 商业游戏
    • 参观Odoo
    获取软件
    • 下载
    • 版本对比
    • 发布
    合作
    • Github
    • 论坛
    • 近期活动
    • 翻译
    • 成为合作伙伴
    • 合作伙伴服务
    • 注册您的会计事务所
    获取服务
    • 寻找合作伙伴
    • 查找会计服务
    • 预约顾问咨询
    • 安装及推行服务
    • 客户参考
    • 支持
    • 升级
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    获取演示
  • 定价
  • 技术支持

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

  • 客户关系管理
  • e-Commerce
  • 会计
  • 库存
  • PoS
  • 项目
  • MRP
All apps
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
帮助

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

订阅

此帖文有活动时,接收通知

此问题已终结
communitystock_pickingv15
3 回复
5008 查看
形象
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
形象
丢弃
形象
Jaideep
最佳答案

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
形象
丢弃
Kabir Khan
编写者

yes you are also right brother.

形象
Cybrosys Techno Solutions Pvt.Ltd
最佳答案

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
形象
丢弃
Kabir Khan
编写者

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

形象
Dương Nguyễn
最佳答案

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
形象
丢弃
Kabir Khan
编写者

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
编写者

ok ill check and reply

Kabir Khan
编写者

@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
编写者

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
编写者

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
编写者

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
编写者

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
编写者

Done thank you

Kabir Khan
编写者

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
编写者

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
编写者

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
编写者

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
编写者

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
编写者

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
编写者

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
编写者

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

喜欢讨论吗?不要只阅读,加入进来!

立即创建账户,享受专属功能,与我们的精彩社区互动!

注册
相关帖文 回复 查看 活动
inherit stock.picking
community stock_picking sale.order v15
形象
形象
1
3月 24
3799
How to call another models onchange function in my custom model, when we call that , i want to work the fucntion
community v15
形象
形象
形象
2
8月 23
3288
500: Internal Server Error in odoo Community 15 已解决
community v15
形象
形象
形象
2
5月 23
3432
Can i call another models onchange function from my custom model?
community v15
形象
形象
1
4月 23
3639
odoo ocr
community v15
形象
0
6月 22
2466
社区
  • 教学视频
  • 文档
  • 论坛
开源
  • 下载
  • Github
  • Runbot
  • 翻译
服务
  • Odoo.sh 托管
  • 支持
  • 升级
  • 自定义开发服务
  • 教育
  • 查找会计服务
  • 寻找合作伙伴
  • 成为合作伙伴
关于我们
  • 我们的公司
  • 品牌资产
  • 联系我们
  • 招聘
  • 近期活动
  • 播客
  • 博客
  • 客户
  • 法律 • 隐私
  • 安全
الْعَرَبيّة 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致力于为企业管理提供高效智能的开源解决方案,是全球业内高速成长的软件服务商之一,逾七百五十万用户选择Odoo进行数字化升级。通过一系列全业务链覆盖、高度集成、简单易用的商业应用,助力企业实现信息化改革、降本增效并释放公司增长潜力。

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