Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
19267 Lượt xem

Creating a custom module where product gets moved from one location to another. I have two locations - source location and destination location.

How can I call odoo v8 stock move function on button click? So that the product transfers from one location to other.

Ảnh đại diện
Huỷ bỏ

hope these customization tips will hlep: https://sites.google.com/view/thinkincode/erp/odoo

Câu trả lời hay nhất

I am on odoo 11 but I think for 8 it is the same. In my use case I wanted to reduce the amount of a product when the stage of my custom model is set to 'done'. Inventory amount is changed by stock.move and stock.move.line. So what I did is creating a stock.move and linked a stock.move.line to it when the state changes to 'done'.

Examples of stock.move creation can be found in addons/stock/tests/test_move.py

Here is a recipe:

1. If you do not yet have a location, create one

<record id="location_mylocation" model="stock.location">
<field name="name">MyLocation</field>
<field name="location_id" ref="stock.stock_location_locations_virtual"/>
<field name="usage">inventory</field>
<field name="company_id"></field>
</record>

The usage is set to 'inventory' to reduce the amount of the product. Scrap Orders use the same mechanism.

2. Create a stock.move

move = self.env['stock.move'].create({
'name': 'Use on MyLocation',
'location_id': stock_location.id,
'location_dest_id': mylocation.id,
'product_id': product.id,
'product_uom': product.uom_id.id,
'product_uom_qty': qty,
})
move._action_confirm()
move._action_assign()
move.move_line_ids.write({'qty_done': qty}) # This creates a stock.move.line record. You could also do it manually
move._action_done()
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You Can Download This App With Detailed product Move In and Out 

https://apps.odoo.com/apps/modules/12.0/stock_item_move_report


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can do it without any customization. Ventor app allows you to move items from one location to another. Working on Odoo 8 - Odoo 11. More details on the site - \ventor.tech/ventor-mobile-app-for-odoo-inventory/

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 21
3231
0
thg 8 17
2952
1
thg 5 17
4262
0
thg 12 15
3127
0
thg 9 15
2807