Odoo Help
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.
How to create an Invoice for orders inside of Restaurant
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')
}
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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 5/28/15, 8:00 AM |
Seen: 723 times |
Last updated: 5/28/15, 8:00 AM |