Odoo / Model / Open New page from model
Open new page from model
-
Step 1:
1. order model
class orders(models.Model): _name='pickabite.orders' _rec_name='order_id' state = fields.Selection([ ('draft','Draft'), ('confirmed', 'Confirmed'), ('bill','Bill'), ('in_payment', 'In Payment'), ('paid', 'Paid'), ('cancel', 'Cancelled'),], string='Status', index=True, readonly=True, default='draft', track_visibility='onchange', copy=False) #register payment button action @api.multi def in_payment(self): self.write({'state': 'in_payment'}) return { #'name': self.order_id, 'res_model': 'pickabite.payment', 'type': 'ir.actions.act_window', 'context': {}, 'view_mode': 'form', 'view_type': 'form', 'view_id': self.env.ref("pickabite.payment_form_view").id, 'target': 'new' } 2. -payment model
class payment(models.Model): _name='pickabite.payment' _rec_name='bill_id' bill_id=fields.Many2one('pickabite.orders',string='Bill Id') customer_id=fields.Many2one(related='bill_id.customer_name', string='Customer Id') bill_amount=fields.Float(related='bill_id.order_price', string='Bill amount') 3. Order Form View
Orders pickabite.orders 4. Payment Form View
Payment Form View pickabite.payment 5. window action
Orders pickabite.orders form kanban,tree,form [] Create The First Order
6. payment menu
Payment pickabite.payment form form current