I have a restaurant management module in which food orders are taken.
I have created a red button called bill_button and it is of type object.
Now I want to add functionality to that button in python in which, the value of amount_total field should get invoiced. I want an invoice to be created of that value.
Currently, customer name is not taken in my restaurant module. Just the table number and food items order.
Can someone suggest how I can program the creation of the invoice through the bill button?
Here's some of my code that I wrote:
class hotel_restaurant_order(osv.Model):
_columns = {
'order_list':fields.one2many('hotel.restaurant.order.list', 'o_list', 'Order List'),
'tax': fields.float('Tax (%) '),
'table_no':fields.many2many('hotel.restaurant.tables', 'temp_table2', 'table_no', 'name', 'Table Number'),
'amount_subtotal': fields.function(_sub_total, method=True, string='Subtotal'),
'amount_total':fields.function(_total, method=True, string='Total'),
}
def bill_button(self, cr, uid, ids, part):
total=self.pool.get('hotel.restaurant.order.amount_total')
return total
Please help me?