123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- # -*- coding: utf-8 -*-
- ##############################################################################
- #
- # OpenERP, Open Source Management Solution
- # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU Affero General Public License as
- # published by the Free Software Foundation, either version 3 of the
- # License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Affero General Public License for more details.
- #
- # You should have received a copy of the GNU Affero General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- #
- ##############################################################################
- from openerp import models, fields, api
- class product_template(models.Model):
- _name = 'product.template'
- _inherit = 'product.template'
- factory_reference = fields.Char('Referencia de fábrica',size=64)
- # @api.multi
- # def write(self, vals):
- # prod_tmpl_id = super(product_template,self).write(vals)
- #
- # for p in self.product_variant_ids:
- # prod = self.env['product.product'].browse(p['id'])
- # ref = ''
- #
- # if prod.factory_reference:
- # if prod['factory_reference'] != None:
- # prod.factory_reference = self.factory_reference
- # ref = prod['factory_reference']
- # elif self.factory_reference:
- # prod.factory_reference = self.factory_reference
- # ref = self['factory_reference']
- #
- # return prod_tmpl_id
- #
- class product_product(models.Model):
- _name = 'product.product'
- _inherit = 'product.product'
- factory_reference = fields.Char('Referencia de fábrica',size=64)
- #
- # @api.model
- # def create(self, vals):
- # prod_id = super(product_product,self).create(vals)
- # self.copiar_referencia(prod_id)
- # return prod_id
- #
- # @api.model
- # def copiar_referencia(self,prod_id):
- # prod_tmpl = self.env['product.template'].browse(prod_id['product_tmpl_id']['id'])
- #
- # ref = ''
- # if prod_tmpl.factory_reference:
- # prod_id['factory_reference'] = prod_tmpl.factory_reference
- # ref = prod_tmpl.factory_reference
- #
- # return True
- #
- # product_product()
|