gpt4 book ai didi

python - Openerp 中的序列格式

转载 作者:行者123 更新时间:2023-11-28 23:01:48 24 4
gpt4 key购买 nike

在 openerp 序列中,我们可以插入带有世纪的当前年份作为后缀或前缀,如下所示:

    /%(year)s 

我需要将财政年度作为序列中的后缀。有什么办法吗?

例如:PO/0001/2012-2013

最佳答案

在创建序列的时候,可以添加这个函数,用序列返回值。

您可以试试这个函数来查找财政年度:

  def finyear(self):
today=date.today()
months=today.month
if months<=3:
return '%d-%d'%(today.year-1,today.year)
return '%d-%d'%(today.year,today.year+1)

关于python - Openerp 中的序列格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10578845/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com