本文整理汇总了Python中odoo.tests.common.Form.product_uom_qty方法的典型用法代码示例。如果您正苦于以下问题:Python Form.product_uom_qty方法的具体用法?Python Form.product_uom_qty怎么用?Python Form.product_uom_qty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类odoo.tests.common.Form
的用法示例。
在下文中一共展示了Form.product_uom_qty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_move_quantities
# 需要导入模块: from odoo.tests.common import Form [as 别名]
# 或者: from odoo.tests.common.Form import product_uom_qty [as 别名]
def _create_move_quantities(self, qty_to_process, components, warehouse):
""" Helper to creates moves in order to update the quantities of components
on a specific warehouse. This ensure that all compute fields are triggered.
The structure of qty_to_process should be the following :
qty_to_process = {
component: (qty, uom),
...
}
"""
for comp in components:
f = Form(self.env['stock.move'])
f.name = 'Test Receipt Components'
f.location_id = self.env.ref('stock.stock_location_suppliers')
f.location_dest_id = warehouse.lot_stock_id
f.product_id = comp
f.product_uom = qty_to_process[comp][1]
f.product_uom_qty = qty_to_process[comp][0]
move = f.save()
move._action_confirm()
move._action_assign()
move_line = move.move_line_ids[0]
move_line.qty_done = qty_to_process[comp][0]
move._action_done()