Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
3283 Представления

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>





Аватар
Отменить
Лучший ответ

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.   

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
февр. 23
7253
4
мар. 22
32499
0
сент. 18
3710
6
окт. 15
9396
3
авг. 24
1688