|
@@ -0,0 +1,17 @@
|
|
|
+# -*- encoding: utf-8 -*-
|
|
|
+from openerp import models, fields, api, _
|
|
|
+from openerp.exceptions import Warning
|
|
|
+
|
|
|
+class account_invoice(models.Model):
|
|
|
+ _inherit = 'account.invoice'
|
|
|
+
|
|
|
+ product_id = fields.Many2one('product.product', 'Pieza Asociada al gasto')
|
|
|
+
|
|
|
+ # @api.one
|
|
|
+ # @api.onchange('invoice_line.product_id')
|
|
|
+ # def update_product_account(self):
|
|
|
+ # if self.product_id:
|
|
|
+ # product = self.env['product.product'].browse([('id','=',self.product_id.id)])
|
|
|
+ # for each in self.invoice_line:
|
|
|
+ # each.account_id = product.property_account_expense.id
|
|
|
+ # self.env['account.invoice.line'].onchange_account_id(each.product_id, each.partner_id, self.type, self.fiscal_position, product.property_account_expense):
|