_# jeffery # focus on Odoo and other open source solutions # IT基础架构资深专家,开源解决方案专家,odoo资深专家__Q:913547235 讨论群397750860

Odoo11 重大改变

Table of Contents






域 widget


Quant 份

procurement 补货



去掉了stock calendar





使用 activity 可以方便的将单据加入到工作流[ 此workflow非工作流引擎, 而是指更广义的工作流程]





安排的活动, 可以在右上角查看,


选择单据, 进入到相应的单据, 例如








HR 员工资料, 引入了组织架构图,



对地址进行了扩展, 实现了 2个特性

1, 城市管理

2, 精确地址输入, 门牌号


域 widget

domain widget用来撰写 doamain条件非常方便, 目前还不能在 search box 使用, 可惜.







Quant 份

极大的性能提升, 之前是为每一个独立唯一的库存建立一条记录, 现在改为只按 location/lot/pack/owner 的唯一性建立一条记录, 这样, 在数量上比之前的做法要少很多, 对性能的提升可想而知. 再有, quant的重新设计, 也改变了库存保留的逻辑, quant 与 stock.move 之间再无直接关系



[REF] stock: new quant implementation

The main idea of this new implementation is that stock.quant is now a

cache of the quantity per location/lot/pack/owner key. We removed every

identity per record, such as `history_ids` or `inventory_value` so that

we can now avoid the linear creation of stock.quant records and are able

to work with only one record per key.


The algorithms to retrieve the quantity per key are made to work with

multiple records, this way we can implement strategies to workaround

postgres locks if concurrent transactions try to work on the same quant



Quants will not be linked to moves anymore, this is in order to be able

to edit stock moves more easily/freely. We removed the links with this

commit and wipe out the `action_assign` on stock move. This will be

implemented in a followup commit, once the relations between stock.move,

stock.pack.operation and stock.quant are clarified.


This commit seems to have unecessary diff, but it was done in order to

run tests on the new implementation.


We adapt the views by removing the fields not present anymore in the

model. This include the complete removal of the inventory valuation

view, as the implementation of stock valuation will be refactored and

moved on stock.move in a following revision.


We wipe out `action_cancel`, `recalculate_move_state`,

`move_quants_by_lot_v10` and `quants_unreserve`.


* `get_removal_strategy` moved from `stock.move` to `stock.quant`


Stock quant model:

* qty renamed to quantity

* history_ids: because the quants are not moved

* inventory_value: implementation moved to stock.move

* packaging_type_id: doesn't seem to be used (in filters?)

* propagated_from_id: because we do not split forced quants

* reservation_id: because the reservation are not linked to

the stock.move.line


We remove the `lot_ids` computed field, as it depended on the link

between stock moves and quants and could be replaced by a related

to the move lines once the new relation between stock.move,

stock.pack.operation and stock.quant is clarified in a further commit.

Furthermore, the field was not displayed to the user.



Odoo8重构库存时, 引入了stock.pack.opertaion 与 stock.picking之间是 Many2one关系, stock.picking 与 stock.move 之间是 One2many, stock.move 和 stock.pack.operation之间是 通过stock.move.operation.link 建立逻辑关系

Odoo11重构将 stock.pack.opertaion 改为 stock.move.line, 将之与stock.picking的关系 改为虚拟关系, 与stock.move 之间则是 Many2one关系


逻辑关系改变, 如下图


[REF] stock: new picking, move and pack.operation implementation

The big change is that we have now a many2many between the move and a

one2many between a move and its pack.operation (note: this model is

renamed as stock.move.line in a further commit).


Due to these changes, `action_done` had to be rewritten intierely, as it

depended and stock.pack.operation.lot and stock.move.operation.link,

that are now removed. This method was laregly inspired by the one in the

mrp module, and a further commit will make MRP uses all the core of



Due to the previous commit that refactored the stock.quant

implementation, the new concept is that the `product_qty` that will

always be in the uom of the quant (`product_qty` is a computed field in

the same style as the one of stock.move).


This commit also implements the logic that a manager is able to edit

done stock.pack.operation.


The stock.move has now a "partially_available" state (it was previously

a flag). The "split_from" field is removed now that we have a many2many

between moves (a sibling move is always a move that was splitted, or

with the backorder_id field).


The done quantity of a stock move is computed across the done quantity

of the move lines. There is an inverse method that allows user to fill

the done quantity directly on a stock move.


The reserve quantity of stock move is computed accross the

`product_qty` of the linked pack operations.


`do_unreserve` will simply unlink the associated pack operation.

Unlinking a pack operation will unreserve.


`force_assign` will mark the move as available, in order to allow the

user to create pack operations (none are created because nothing was



`action_assign` is rewritten and splitted in two parts: if the move has

a parent (mto) or not (mts). In the mto, we'll check the available move

lines and only reserve accordingly. In the mts, we'll reserve directly

on the quants.


`action_cancel` has changd a lot: in case of a delivery, the first step

does not anymore propagate cancellation to following moves and SO. As a

result it does not propagate in the other side in case of MTO or production.

It does not delete them if we delete the related sale order for example. In

order to correct this next activities will be added in the future. Technically

action cancel on move is based on procurment rule, this commit will set

the propagate field to false on the rule if the picking_type is 'pick'

or if we are in one step delivery.


We use this commit to reimplement `action_assign` (wiped by the new

quant implentation). A move is reserved if its move lines exist, so we

introduce a one2many between stock.move and stock.pack.operation (note:

a further commit renamed this model into stock.move.line)


We use this commit to implement `action_done` (wiped by the removal of the

models making the link between stock.move and stock.pack.operations). We

can use the one2many to the pack operations.


blabla manymany au lieu de one2many

blabla mto mts


Remove get_ancestors, as orig_ids will be used instead




when we are creating some packe operation with lot name, the

pack_operation are unlink and a new picking is craeted.


This is caused the function _create_lot_for_picking that unlink pack

operation having no quantity reserved instead of ones having no quantity



To fix this we changed product_qty to qty_done and move the code from

action_done of picking to action_done of move


fixup! [IMP] Merge_moves functionality + many2many procurement and original moves instead of one2many


fixup! [REF] stock: basics of new model and stock.move reservation


edit reserved move line


This is the 1st commit message:


[REM] stock: stock.pack.operation.lot, stock.move.operation.link


These models will become useless once a one2many will be made between

stock.move and stock.pack.operation.


The `action_done` method on stock move has been wiped, as it depended

completely on the removed models.


Joint work with Josse Colpaert <jco@odoo.com>, amoyaux <arm@odoo.com>

and Pierre Masereel <pim@odoo.com>



procurement 补货

保留补货规则, 去掉了补货单, 扩展补货组, 直接在补货组执行补货



[IMP] stock: remove procurement orders to fufill immediately

This removes the procurement.order model. To fufill their needs SO, PO, MO and

stock moves now call the _run method of the relevant procurement.group.


This mecanism is now only used for stockable product, tasks now uses their own

independent mecanism.


The _run method will check all the applicable rules and create directly the

needed model to fufill the need.


The modules stock, purchase, mrp, extends the _run method to implement their

specific strategy relevant for the rule type they define.


If an exception happens the message will be logged as a mail messsage on the

source model, for example, if a sales order cannot be fufilled the salesperson

will now see directly the reason.


OLD commit messages:

[WIP] procurement: removing procurement.order in stock, sale, purchase, sale_stock. WIP

fixup! [WIP] procurement: removing procurement.order in stock, sale, purchase, sale_stock. WIP

[IMP] Basic tests

[FIX] test not necessary anymore

[FIX] remove unnecessary print statement

[FIX] unnecessary test + why passing warehouse worked before?

[IMP] purchase: one move by purchase order line

[FIX] purchase: correct inventory tests and pass move_dest_ids among procurements

[FIX] because of bad cherry-pick merge

[IMP] make mrp pass by adding move_dest_ids there too

[IMP] tests of sale_mrp, no need for cancelpropagation then

[IMP] better to consistently use recordsets also for one2many

[FIX] purchase_requisition

[FIX] Exceptions should trigger errors, which should be caught in the tests

[FIX] sale_mrp: remove usage of procurement.order and use sale order name instead of sol

[FIX] stock_dropshipping: add sale_line_id on purchase_line_id

[FIX] Remove pdb

[IMP] add stock_dropshipping files

[IMP] stock: search carrier through sale line instead of procurement group

[IMP] add procrule test and preision needed when updating sol

[FIX] sale_order_dates + [IMP] procurement exceptions by scheduler

[FIX] No need to return task

[IMP] move file as name changes and add corrections

[FIX] Continue Run Schedulers wizard fix

[FIX] name issues of takss

[FIX] updating sale order line, but there is still a problem with the recompute






从 ir.values 改动到 ir.actions.actions, 因此 ir.values 也被移除, 动作绑定只需要在 act_window 加上

<field name="binding_model_id" ref="account.model_account_account" />

<field name="binding_type">report</field>



去掉了stock calendar

一个重要的功能被去掉了, bad idea

posted on 2017-10-14 14:04  odoouse  阅读(...)  评论(... 编辑 收藏



_# jeffery # focus on Odoo and other open source solutions # IT基础架构资深专家,开源解决方案专家,odoo资深专家_