Odoo Help

0

0
2 Answers
0
Vitaly Eremeev
20‏/8‏/2018 9:54 ص

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/

0
Andreas Stange
5‏/7‏/2018 3:02 م

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()
Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now