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

Hi,

i have a  model wich is transient :

class ProjectMakeQuotation(models.TransientModel):

_name = "project.make.quotation"

 and sale order model inherited :

class SaleOrder(models.Model):

_inherit = "sale.order"

quotation_type_id = fields.Many2one('project.make.quotation', string='Quotation Type', readonly=True) 

I want to add the field  quotation_type_id  in the tree view of sale.order

I done like this :

<xpath expr="//tree/field[@name='partner_id']" position="after">

<attribute name="quotation_type_id"/>

    </xpath>

i got error that says : AssertionError: Many2One relationships from non-transient Model to TransientModel are forbidden

How can i do to solve it please ??



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

Hi,

Transient models are not stored in the database.   It is normally used to define the model for a wizard, where the data has to be stored temporarily . All the data in transient tables are flushed frequently. So it's not at all a good solution to use ref. of such transient tables in non-transient tables. 


Thanks

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

Thanks for the explanation @Niyas.