Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/14/16, 6:42 AM|
|Seen: 228 times|
|Last updated: 11/14/16, 9:28 AM|