123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- # -*- coding: utf-8 -*-
- ##############################################################################
- #
- # Cybrosys Technologies Pvt. Ltd.
- # Copyright (C) 2008-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
- # Author: Nilmar Shereef(<http://www.cybrosys.com>)
- # you can modify it under the terms of the GNU LESSER
- # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
- #
- # It is forbidden to publish, distribute, sublicense, or sell copies
- # of the Software or modified copies of the Software.
- #
- # 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
- #
- # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
- # GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
- # If not, see <http://www.gnu.org/licenses/>.
- #
- ##############################################################################
- from openerp import fields, models, api
- class PlannedWork (models.Model):
- _name = 'planned.work'
- planned_work = fields.Many2one('product.template', string='Planned work', domain=[('type', '=', 'service'),('sale_ok','=',True)])
- time_spent = fields.Float(string='Estimated Time')
- work_date = fields.Datetime(string='Date')
- responsible = fields.Many2one('res.users', string='Responsible')
- work_id = fields.Many2one('car.workshop', string="Work id")
- work_cost = fields.Float(string="Service Cost")
- completed = fields.Boolean(string="Completed")
- duration = fields.Float(string='Duration')
- work_date2 = fields.Datetime(string='Date')
- @api.onchange('planned_work')
- def get_price(self):
- self.work_cost = self.planned_work.lst_price
- class MaterialUsed (models.Model):
- _name = 'material.used'
- material = fields.Many2one('product.template', string='Productos', domain=[('sale_ok','=',True)])
- amount = fields.Integer(string='Cantidad', default=1)
- price = fields.Float(string='Precio Unitario')
- material_id = fields.Many2one('car.workshop', string='Material')
- @api.onchange('material')
- def get_price(self):
- self.price = self.material.lst_price
|