如何在Odoo 9中的Odoo发票序列中添加自定义字段值

如何在Odoo 9中的Odoo发票序列中添加自定义字段值,odoo,odoo-9,Odoo,Odoo 9,我试图将自定义字段添加到发票编号序列中 因此,我添加的字段是一个manyOne字段或选择字段,其值需要追加到发票序列中 该字段位于account.invoice类中 seq_pat=fields.manyOne('account.sequence.new','sequence Pattern') 我尝试的另一种方法是重写ir.sequence类方法,该方法在序列中创建图例 class ir\u序列(osv.osv): _inherit='ir.sequence' 定义上下文(self,cont

我试图将自定义字段添加到发票编号序列中

因此,我添加的字段是一个manyOne字段或选择字段,其值需要追加到发票序列中

该字段位于account.invoice类中

seq_pat=fields.manyOne('account.sequence.new','sequence Pattern')
我尝试的另一种方法是重写ir.sequence类方法,该方法在序列中创建图例

class ir\u序列(osv.osv):
_inherit='ir.sequence'
定义上下文(self,context=None):
如果上下文为“无”:
上下文={}
test1=self.pool.get('account.invoice').browse()
test=test1.seq_pat.name
t=datetime.now(pytz.timezone(context.get('tz')或'UTC'))
序列={
'年':'%Y','月':'%m','日':'%d','Y':'%Y','doy':'%j','woy':'%W',
“工作日”:“%w”,“h24”:“%H”,“h12”:“%I”,“分钟”:“%M”,“秒”:“%S”,
“模式”:“%P”
}
返回{key:t.strftime(sequence)for key,sequence in sequences.iteritems()}
成功进入奥多的传奇部分。

但我一直在想如何通过红外序列识别我的字段

任何有其他想法来实现这一点的人都会非常有帮助