account_invoice.py 774 B

1234567891011121314151617
  1. # -*- encoding: utf-8 -*-
  2. from openerp import models, fields, api, _
  3. from openerp.exceptions import Warning
  4. class account_invoice(models.Model):
  5. _inherit = 'account.invoice'
  6. product_id = fields.Many2one('product.product', 'Pieza Asociada al gasto')
  7. # @api.one
  8. # @api.onchange('invoice_line.product_id')
  9. # def update_product_account(self):
  10. # if self.product_id:
  11. # product = self.env['product.product'].browse([('id','=',self.product_id.id)])
  12. # for each in self.invoice_line:
  13. # each.account_id = product.property_account_expense.id
  14. # self.env['account.invoice.line'].onchange_account_id(each.product_id, each.partner_id, self.type, self.fiscal_position, product.property_account_expense):