Hi i created a module with a model related to sale.order with a Many2one field. I added a notebook to the sale.order view with a tree view of my model, similar to order line.
What i need to do is to prefill fields with current order (sale.order) and order date.
_description = 'Rtv' _name = 'waycon.rtv'
#omitted fields that don't need to be prefilled
order_id = fields.Many2one('sale.order', string='Order Reference', required=True, ondelete='cascade',
date = fields.Date(string="Data", help="Data creazione documento", required=True)
order_partner_id = fields.Many2one(related='order_id.partner_id', store=True, string='Customer')
#field added to sale.order
_inherit = 'sale.order'
rtv = fields.One2many( 'waycon.rtv', 'order_id',string='Related rtvs')
<record id="my_view_sale_form_inherit" model="ir.ui.view">
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<page string="R.T.V." >
<field name="rtv" mode="tree,kanban" string="RTV">
The only field prefilled is partner.id and i still don't understand how odoo do it since it's relater to order_id that is not filled. I wasn't able to add images directly in post so i used pasteboard and copy/past links.
Thank You in advance
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 11/14/16, 6:42 AM|
|Seen: 95 times|
|Last updated: 11/14/16, 9:28 AM|