sale.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. from datetime import datetime, timedelta
  3. import time
  4. from openerp import SUPERUSER_ID
  5. from openerp.osv import fields, osv
  6. from openerp.tools.translate import _
  7. from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
  8. import openerp.addons.decimal_precision as dp
  9. from openerp import workflow
  10. class sale_order(osv.osv):
  11. _inherit = "sale.order"
  12. def _amount_all_wrapper(self, cr, uid, ids, field_name, arg, context=None):
  13. """ Wrapper because of direct method passing as parameter for function fields """
  14. return self._amount_all(cr, uid, ids, field_name, arg, context=context)
  15. def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
  16. cur_obj = self.pool.get('res.currency')
  17. res = {}
  18. # print "******************************algo*************************"
  19. # for order in self.browse(cr, uid, ids, context=context):
  20. # res[order.id] = {
  21. # 'amount_untaxed': 0.0,
  22. # 'amount_tax': 0.0,
  23. # 'amount_total': 0.0,
  24. # }
  25. # val = val1 = 0.0
  26. # cur = order.pricelist_id.currency_id
  27. # for line in order.order_line:
  28. # val1 += line.price_subtotal
  29. # val += self._amount_line_tax(cr, uid, line, context=context)
  30. # res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)
  31. # res[order.id]['amount_untaxed'] = cur_obj.round(cr, uid, cur, val1)
  32. # res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax']
  33. # return res