콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3269 화면

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.   

아바타
취소
관련 게시물 답글 화면 활동
1
2월 23
7212
4
3월 22
32483
0
9월 18
3704
6
10월 15
9357
3
8월 24
1657