Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1380 Lượt xem

Hi,
I'm trying to search table product_product and create a scheduled action which prints product attributes to console.

Since the model for scheduled action has to be product.template,

I'm trying to add to it product.product and use it's method for search.

I'm getting following error: 

Error: The _name attribute Product_template_custom is not valid.


please help me solve this, I supposed it's easy, but I'm not sure how should I solve the inheritance issue. Tx

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Just modify the code as follows:


Class ProductTemplate(models.Model):
_inherit = 'product.template'


and in get_all_products function as:

products = self.env['product.product'].search([])


Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

You saved my Monday :)
Thank you!