Odoo / UI / Line items UI
UI with line items
-
Step 1:
1. master model
from odoo import models, fields, api class document_entry(models.Model): _name = 'csms.document_entry' _description = 'csms.document_entry' company_id = fields.Many2one('res.company', string='Branch', required=True) country_id = fields.Many2one('csms.country', string='Country', required=True) customer_id = fields.Many2one('res.partner', string='Customer', required=True) email = fields.Char() document_item_ids = fields.One2many( 'csms.document_item', 'entry_id', string='Documents' ) 1. note document_item_ids
2. entry_id is relation id in the model document_item
3. document_item_ids is One2many in master model2. line item model
from odoo import models, fields, api class document_item(models.Model): _name = 'csms.document_item' _description = 'csms.document_item' document_name = fields.Char() university = fields.Char() rate = fields.Char() quantity = fields.Char() total = fields.Char() entry_id = fields.Many2one( 'csms.document_entry' ) entry_id is Many2one 3. menu
4. action window
Document Entry csms.document_entry tree,form 5. add permission to security
E:\odoo\16\server\addons\csms\security\ir.model.access.csv
access_csms_document_entry,csms.document_entry,model_csms_document_entry,base.group_user,1,1,1,1 access_csms_document_item,csms.document_item,model_csms_document_item,base.group_user,1,1,1,1 -
Step 2: Customization
1. Master UI customization
csms.document_entry csms.document_entry 1. note sheet, group , nested group, notebook 2. line item form
csms.document_item csms.document_item