Odoo Help

Welcome!

This community 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.

0

How to create an Invoice for orders inside of Restaurant

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


Hi,

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, {

'orderno':order.order_number,

'resno':order.reservationno,

'kot_date':order.date1,

'w_name':order.waitername.name,

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

})

for order_line in order.order_list:

o_line = {

'kot_order_list':kot_data,

'name':order_line.name.id,

'item_qty':order_line.item_qty,

}

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):

_inherit="account.move"

_columns={

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

}

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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