account_payment_term.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # -*- coding: utf-8 -*-
  2. from openerp import api, fields, models
  3. from openerp.exceptions import except_orm
  4. class AccountPaymentTerm(models.Model):
  5. _inherit = 'account.payment.term'
  6. invoice_amount = fields.Float(string="Invoice Amount")
  7. amount = fields.Float(string="Amount")
  8. frequency = fields.Selection([('week','Week'), ('month','Month')], string="Frequency")
  9. # amount_untaxed = fields.Float( compute='_compute_amount_all')
  10. # amount_tax = fields.Float( compute='_compute_amount_all')
  11. # amount_total = fields.Float( compute='_compute_amount_all')
  12. # @api.model
  13. # def join_sale_lines(self, values):
  14. # new_line = self.env['sale.order.line']
  15. # sale_order_line = {
  16. # 'product_id': values['product_id'],
  17. # 'product_uom_qty': values['product_uom_qty'],
  18. # 'order_id' : values['id']
  19. # }
  20. # new_line.create(sale_order_line)
  21. # @api.depends('order_line.price_subtotal')
  22. # def _compute_amount_all(self):
  23. # for order in self:
  24. # amount_tax = amount_untaxed = 0.0
  25. # currency = order.currency_id.with_context(date=order.date_order or fields.Date.context_today(order))
  26. # for line in order.order_line:
  27. # amount_untaxed += line.price_subtotal
  28. # amount_tax += (line.product_uom_qty * line.price_unit) - line.price_subtotal
  29. # order.amount_tax = currency.round(amount_tax)
  30. # order.amount_untaxed = currency.round(amount_untaxed)
  31. # order.amount_total = currency.round(amount_tax + amount_untaxed)