purchase_reference.py 519 B

12345678910111213141516
  1. # -*- encoding: utf-8 -*-
  2. from openerp import models,fields,api
  3. class purchase_order_line(models.Model):
  4. _name = 'purchase.order.line'
  5. _inherit = 'purchase.order.line'
  6. #obtener referencia
  7. @api.one
  8. #@api.onchange('product_id')
  9. @api.depends('product_id')
  10. def _get_factory_reference(self):
  11. self.product_factory_ref = self.product_id.factory_reference
  12. #campo
  13. product_factory_ref = fields.Char(string='Referencia de fábrica', compute='_get_factory_reference')