Odoo 10 - procurement_id in stock_moves - odoo

While trying to understand Odoo model for delivery slips I have realized that some stock_moves rows do have procurement_id populated and others do not.
Why is this? When is procurement_id populated?

Procurement_id is populated when the stock move is generated by a procurement. Stock moves created by a sale order are created throught a procurement. A stock move created by purchase order will not have a procurement id because purchase orders do not create stock moves.

Related

creation of Manufacturing Order from Sale Order

I know the functional flow of the sale order in which a MO is created for a product that is configured to be manufactured in product master
Below I have descried in brief the Functional flow:
when we create a product and set it as manufacturing we then create a BOM for that respective product, which results in the creation of a Manufacturing Order after confirming a sale order for that product, and the origin field in MO contains the sale order name too.
My question is, Which Method in the backend is responsible for the creation of MO from sale order? actually, the MO is created in the confirmed state and I want it to be created in draft when it is created from Sale Order. so I like to know which method is responsible for that
Manufacture Orders are created as part of the procurement planning system by the Stock Rule object in the method called _run_manufacture
Link to the line where the confirmation takes place.
https://github.com/odoo/odoo/blob/7ec6ae3863da4c7355c4a22ef799815a38188402/addons/mrp/models/stock_rule.py#L55

Changes in quants in Odoo 11 , 12

Up to Odoo 10, I used Quants fields inventory_value, cost in some of my reports to calculate purchase cost, etc.... and also I used quants relation to moves in some cases.
Now as I started working with Odoo 12 I see that there are no relations from stock.quant to stock.move and stock_quant_move_rel table is gone.
As I can see, now I can not even check inventory value in Odoo 12?
So maybe can someone explain these changes that were made, and how is workflow is changed, because I'm a little bit lost now.
In inventory there is inventory valuation menu under reporting you can check inventory value product wise or In product template you can check quantity on hand to check stock quant.

how to move field in purchase order to stock.picking, stock.move, and stock.quant?

I created 4 custom fields in purchase.order, stock.picking, stock.move and stock.quant.
How to do when the purchase order is confirmed, the data from the field I created in purchase order is filled in stock.picking and stock.move?
and when stock.picking in approve the data also filled in?
i using odoo 10
thanks

How to make a payment for each product in an invoice in Odoo

I have an invoice with 2 products (product A and B), I need to do a payment only for the product A, is there any way to do that ?, and after see the product A with the correct moves in the accounting.
I know how to do the change in code but will be better if Odoo has this functionality
Thanks a lot
That can be done if you shipped all products separately and keep
invoice policy based on shipment. Then you can create separate invoice
for each products.
While you click on Create Invoice button in sales order then it will create invoice for eligible shipments with it's all delivered products.
So your purpose will be resolved by just change the configuration other there is no more option in odoo you have to write code to achieve it.

First Expiry First out in OpenERP

I wanted to bring batch number selection to be in sales module and to enforce any sales done according to the expire date associated to product automatically. The idea is a user select product and quantity to sale, and the system expected to do selection from the right batch, if there is no enough stock available it must does splitting
So far what I managed to do:
Product are sorted by expired date and it automatically selects a product with recent expiry date without any user intervention and notify if not enough stock available
Creates delivery slip to warehouse and sales invoice to finance with that batch number from sales order
However, I am facing these problems
If current stock quantity of specific product in batch is not enough it should go to second batch and creates to sales order line somehow similar to splitting mechanism exist in warehouse.
confirmed sales orders doesn't deduct sold product stock quantity from warehouse