会计凭证重新编号

从 Odoo14开始的新功能

   

在此之前,会计凭证的编号是取自 ir.sequence ;后面为了引入 编号重排功能,因此不再从 ir.sequence 获取编号

   

凭证编号以'/' 隔开分为3个部分, 第一个部分是 prefix; 第二部分是 年份; 第三部分是 凭证的顺序号

   

新建凭证时自动编号

  • Prefix 从journal 上获取
  • 年份就是 年份
  • 顺序号就是 在指定journal、年份,该凭证的顺序号,从 0001 开始

   

重新编号

  • 基于 第一个 新编号,重新编号
  • 可以 使用现有的顺序;也可以按记账日期排序

   

代码提交说明

   

[IMP] account: rework name sequences

Task 2146469

   

Rework the name computation:

* It doesn't use ir.sequence anymore

* It is an editable computed field

* Add a renaming tool

   

This allows the user to tweak the sequences more easily than having to

get through the ir.sequence settings.

   

The sequence depends on a parameter of the journal: continuous, montly

and yearly restart of the sequence. Everytime a new period is started,

try to make a pattern form another period.

   

The incrementing is done by taking the previous name, ordered

lexicographically, splitting it by taking the digits at the end, adding

1 and re contstruct with the prefix.

   

** This means there could be cases where the prefix has a big importance

on the next number. For instance, if you have

INVOICE/2019/0001

INVOICE/2019/0002

and then rename the last one to INV/2019/0002, don't expect the next

number to be INV/2019/0003. It will be INVOICE/2019/0002 (again) because

the highest number was INVOICE/2019/0001.

You will then end up with

INVOICE/2019/0001

INV/2019/0002

INVOICE/2019/0002

   

closes #41485

   

Related: odoo/enterprise#7189

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>

   

   

jeffery 2024年7月18日
标签
存档
Odoo web hook