31
31
_inherit = 'product.template'
33
33
def _price_unit_tax(self, cr, uid, ids, field_name, arg, context=None):
34
"""This method calcul the sale price with/without taxes included depending on company configuration"""
35
This method calcul the sale price with/without taxes included depending on company configuration
35
37
if not context: context = {}
37
39
tax_obj = self.pool.get('account.tax')
41
43
cur_obj = self.pool.get('res.currency')
42
44
cur = user.company_id.partner_id.property_product_pricelist.currency_id
44
for product in self.browse(cr, uid, ids):
46
for product in self.browse(cr, uid, ids, context=context):
46
48
if prices_tax_include:
47
49
val = reduce(lambda x, y: x+cur_obj.round(cr, uid, cur, y['amount']),
48
tax_obj.compute_inv(cr, uid, product.taxes_id,
49
product.list_price, 1),
50
tax_obj.compute_inv(cr, uid, product.taxes_id, product.list_price, 1), val)
51
51
res[product.id] = cur_obj.round(cr, uid, cur, (product.list_price - val))
53
53
val = reduce(lambda x, y: x+cur_obj.round(cr, uid, cur, y['amount']),
54
tax_obj.compute(cr, uid, product.taxes_id,
55
product.list_price, 1),
54
tax_obj.compute(cr, uid, product.taxes_id, product.list_price, 1), val)
57
55
res[product.id] = cur_obj.round(cr, uid, cur, (product.list_price + val))
61
'price_unit_tax' : fields.function(_price_unit_tax,
63
string='price inc./exc. tax',
66
digits=(16, int(config['price_accuracy'])),
67
help="Price calculated with taxes included or excluded, depend of the configuration in company configuration"),
59
'price_unit_tax' : fields.function(_price_unit_tax,
61
string='price inc./exc. tax',
64
digits=(16, int(config['price_accuracy'])),
65
help="Price calculated with taxes included or excluded, depend of the configuration in company configuration"),