The function you need is in the sale module in file sale.py,
this is the code,
def _amount_all_wrapper(self, cr, uid, ids, field_name, arg, context=None):
""" Wrapper because of direct method passing as parameter for function fields """
return self._amount_all(cr, uid, ids, field_name, arg, context=context)
def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
cur_obj = self.pool.get('res.currency')
res = {}
for order in self.browse(cr, uid, ids, context=context):
res[order.id] = {
'amount_untaxed': 0.0,
'amount_tax': 0.0,
'amount_total': 0.0,
}
val = val1 = 0.0
cur = order.pricelist_id.currency_id
for line in order.order_line:
val1 += line.price_subtotal
val += self._amount_line_tax(cr, uid, line, context=context)
res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)
res[order.id]['amount_untaxed'] = cur_obj.round(cr, uid, cur, val1)
res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax']
return res
just override the function _amount_all to change the price based on your coupon.
This functions are from v8.
Kind regards.
search for the text 'def _amount_all_wrapper' in sale module so you can see what this method do, then you need to override it creating a custom module. What kind of change do you want to make to the amount_total field?
Hi Juan, Thank you for your help ! I searched in the sale module and I also did a "cat * | grep -R -e "_amount_all_wrapper" > /home/matthieu/result.txt but I didn't found it, it's why I'm asking for the file to find it. To answer your question, I did a custom module and I need to add to this value the value of the attribute "coupon_nb" from an inherit of pos_order from Point Of Sale. Thanks so much for your help !