Odoo Help


How to create an Invoice for orders inside of Restaurant

Kapil More
on 5/28/15, 8:00 AM 723 views


I am creating one of the restaurant management module in which orders are taken.

I created a button called Generate Invoice and it is of the type Object.

I just want the value of amount_total field should get invoiced and then Invoice will be created of that value.

Plz help me anyone with that!

Here is my code,

class hotel_reservation_order(osv.Model):

def reservation_generate_kot(self, cr, uid, ids, part):

order_tickets_obj = self.pool.get('hotel.restaurant.kitchen.order.tickets')

rest_order_list_obj = self.pool.get('hotel.restaurant.order.list')

for order in self.browse(cr, uid, ids):

table_ids = [x.id for x in order.table_no]

kot_data = order_tickets_obj.create(cr, uid, {





'tableno':[(6, 0, table_ids)],


for order_line in order.order_list:

o_line = {





rest_order_list_obj.create(cr, uid, o_line)

return True

_name = "hotel.reservation.order"

_description = "Reservation Order"

_columns = {

'order_number':fields.char('Order No', size=64),

'reservationno':fields.char('Reservation No', size=64),

'date1':fields.datetime('Date', required=True),

'waitername':fields.many2one('res.partner', 'Waiter Name', size=64),

'table_no':fields.many2many('hotel.restaurant.tables', 'temp_table4', 'table_no', 'name', 'Table Number', size=64),

'order_list':fields.one2many('hotel.restaurant.order.list', 'o_l', 'Order List'),

'tax': fields.float('Tax (%) ', size=64),

'amount_subtotal': fields.function(_sub_total, method=True, string='Subtotal'),

'amount_total':fields.function(_total, method=True, string='Total'),

'voucher_id':fields.many2one('account.move','order_id', string="Payments")


_defaults = {

'order_number':lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'hotel.reservation.order'),


class account_move(osv.Model):



'order_id':fields.many2one('hotel.reservation.order','Generating Order')


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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/28/15, 8:00 AM
Seen: 723 times
Last updated: 5/28/15, 8:00 AM