Skip to Content
Menu
This question has been flagged
1 Reply
2567 Views

So i'm trying to create a module that inherits the stock_location class, so I can put the 'stock_real' and 'stock_virtual' fields inside the FormView of the product. WORKING ON ODOO V8 by the way.

Basically I want the same tree view (summarized) you get when you clic More-> stock by location (I think, in spanish it says 'existencias por ubicacion', so i'm not sure what it says exactly in english), but inside the formview of each product, inside a new notebook page. 

I'm far from the results I want, but my code right now is looking like this: 

py file: 

class ExistenciaUbicacion(models.Model):
_name = 'existencia.ubicacion'
_inherit = ['stock.location', 'product.product']

stock_real = fields.Float(compute='_product_value', string='Real Stock', multi="stock", store=True)
stock_virtual = fields.Float(compute='_product_value', string='Virtual Stock', multi="stock", store=True)

#i'm redefining the 2 fields, because when I tryed to install the module to check it out, I got errors saying the fields didn't exist... my guess was that it's because both are calculated fields and not stored in the DB, but even tho I redefined them in my new class, I still get the same error:

Error details:
Field `stock_real` does not exist

xml file: 

​​ <notebook position="inside">

     <page string="Existencias">

<tree string="existencias>

<field name="complete_name"/>

<field name="stock_real">

<field name="stock_virtual">

 </tree>

 </page>

</notebook>





Avatar
Discard
Best Answer

Verify content of your file odoo.log, probably the error in python code is reported. I do not see the _product_value method in your code.   

Avatar
Discard
Related Posts Replies Views Activity
1
Feb 23
5763
4
Mar 22
30577
0
Sep 18
2922
6
Oct 15
7887
3
Aug 24
289