If you want to import customize module in OpenERP(Odoo) follow the below mentioned code and paste it in your (Python).py file:
import decimal_precision as dp
from osv import fields, osv, orm
from tools.translate import _
import one2many_sorted
class account_invoice(osv.osv):
_inherit = "account.invoice"
def _amount_discount(self, cr, uid, ids, name, args, context=None):
res = {}
amount_discount = 0.0
for invoice in self.browse(cr, uid, ids, context=context):
if invoice.invoice_line:
for line in invoice.invoice_line:
amount_discount += line.discount
res[invoice.id] = amount_discount
return res
0 Comment(s)