-
-
Save ovnicraft/357fc86e7a0c7149e961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AccountInvoiceLine(osv.osv): | |
_inherit = 'account.invoice.line' | |
def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict): | |
res = {} | |
tax_obj = self.pool.get('account.tax') | |
cur_obj = self.pool.get('res.currency') | |
company_currency = self.pool['res.company'].browse(cr, uid, obj.company_id.id).currency_id.id | |
for line in self.browse(cr, uid, ids): | |
res[obj.id] = {'amount_tax': 0, 'price_subtotal': 0} | |
price = line.price_unit * (1-(line.discount or 0.0)/100.0) | |
cur = line.invoice_id.currency_id | |
for tax_line in line.invoice_line_tax_id: | |
base_amount = cur_obj.compute(cr, uid, cur.id, company_currency, line.price_subtotal * tax_line.base_sign, context={}, round=False) | |
tax_amount = cur_obj.compute(cr, uid, cur.id, company_currency, tax_line.amount * tax_line.tax_sign, context={}, round=False) | |
res[obj.id]['amount_tax'] = base_amount * tax_amount | |
res[obj.id]['price_subtotal'] = el calculo de base del erp | |
return res | |
_columns = { | |
'discount_value': fields.float('Discount Value'), | |
'amount_tax': fields.function(_amount_line, string='Tax', type="float", digits_compute= dp.get_precision('Account'), store=True, multi='line',), | |
'price_subtotal': fields.function(_amount_line, string='Amount', type="float", digits_compute= dp.get_precision('Account'), store=True, multi='line'), | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment