This question has been flagged
1 Reply
1965 Views

Greetings,

i created my own module , which will add one2many field to product.product ,this one2many will have 'size' column .

now i created other one2many field in stock.move which has the same column 'size' , i want to subtract the stock.move.size with product.product.size (stock.move.size - product.product.size)

so from the stock.move form how can i update the value of 'size' which is on the product.product

Any help will be appreciated .

Avatar
Discard
Best Answer

You have a couple of options.  One is to create a button that call a method to update the product.product's size field based on the current stock.move's data, or you can do it on the stock.move's write.

One quetion that pops into my head is, you'll be creating tens, hundreds, or thousands if not more, stock.move for that particular product, aren't you going to just make it very large negative number?  I have a hunch you mean to do something else, maybe if you can state what you intend to do, a better help can be offered.

Avatar
Discard
Author

sure , on creating new product I added a one2many field which contains the pieces of the product , the product quantity will be the summation of the size for all pieces . now from the delivery order 'stock.move' , I want to decrease the selected pieces values . let's take an example. on creating the product A : the sizes will be 50m ,25m now if we create a delivery order and we insert 25m,25m this sizes will be subtracted from the sizes stored once we create the product , now the available sizes is : 25m,0m. for fabric use ^_^ thanks to you

Moayad, I think you should look into stock.production.lot (now labelled Serial Number). That is a way for you to track the the quantity of a certain batch of product. It is already built into the stock logic. A stock.production.lot is tied to a product. You can always create a new stock.production.lot for every delivery order.