As a service company we do not use products and therefore we cannot predefine the tax in order lines which is usually defined by the product. I wrote a simple extension to set the tax on sale order line on creation:
class SaleOrderLine(osv.osv):
_inherit = 'sale.order.line'
def create(self, cr, uid, values, context=None):
tax = self.pool.get('account.tax').browse(cr, uid, 12, context=context)
values['tax_id'] = [[6, 0, [tax.id]]]
return super(SaleOrderLine, self).create(cr, uid, values, context=context)
My questions are:
1.) How can I obtain the default sales tax from account configuration within the SaleOrderLine extension?
2.) At the moment the tax will be set after saving the sale order. Is there a way to pre-fill the tax field on creatrion of an order line in the frontend (Link: Add Entry)? I presume this must be done with JavaScript but I do not know how to obtain the default sales tax there and how to add a default value to the tax field.
Thanks for your help!