Example #1
0
class he_employee(models.Model):
    _inherit = "hr.employee"

    formaciones_count = fields.Integer(compute='_formaciones_count',
                                       string='# formaciones')
    formacion_ids = fields.One2many('hr.employee.formacion', 'employee_id',
                                    'Formaciones empleado')
    albaranes_count = fields.Integer(compute='_albaranes_count',
                                     string='# albaranes')
    albaran_ids = fields.One2many('stock.picking', 'partner_id',
                                  'Albaranes empleado')
    partner_id = fields.Many2one(compute='_compute_partner')

    @api.one
    @api.depends('formacion_ids')
    def _formaciones_count(self):
        formaciones = self.env['hr.employee.formacion'].search([
            ('employee_id', '=', self.id)
        ])
        self.formaciones_count = len(formaciones)

    @api.one
    @api.depends('albaran_ids')
    def _albaranes_count(self):
        albaranes = self.env['stock.picking'].search([
            ('partner_id', '=', self.user_id.partner_id.id)
        ])
        self.albaranes_count = len(albaranes)

    @api.one
    def _compute_partner(self):
        partner = self.env['res.partner'].search([
            ('id', '=', self.user_id.partner_id.id)
        ])
        self.partner_id = partner.id
Example #2
0
class task3(models.Model):
    _name = 'task3'

    name = fields.Char('Name:')
    roll_no = fields.Integer('Roll No:')
    partner = fields.Many2one('res.partner','select Partner:')
    stand = fields.Integer('Standard:',default='3',readonly=True)

    @api.model
    def create(self,vals,context):
        print "INSIDE CREATE==============="
        print "SELF=================",self._context
        print "VALS=================",vals
        print "VALS=================",vals['name']
        print "VALS=================",vals['roll_no']
        d_name = vals['name']
        d_roll_no = vals['roll_no']

        vals = {
            'd_name':d_name,
            'd_roll_no':d_roll_no,
        }
        # for record in self.env['demo.class']
        # res = self.env['demo.class'].create(vals)
        return super(task3, self).create(vals)
Example #3
0
class wizard_total_calculation_o2m(models.Model):
    _name = 'wizard.total.calculate.o2m'

    sidd_challenge_2 = fields.Many2one('student.student', 'Name')
    paid_fees = fields.Integer('Paid Fees:')
    amount_due = fields.Integer('Amount Due:')
    month_name = fields.Char('Month Name:')
Example #4
0
class sale_order_custom(models.TransientModel):
    _name = 'sale.order.cust'

    product = fields.Many2one('product.product', 'Product:')
    qty = fields.Integer('Quantity:')
    unit_price = fields.Integer('Unit Price:')

    @api.multi
    def insert_wiz(self, vals):
        print "vals=================", vals
        product_name = self.product
        print "a=================", product_name
        product_qty = self.qty
        print "qty==============", product_qty
        units = self.unit_price
        print "units==================", units
        # active_id = self._context.get('active_id')
        my_id = vals.get('active_id')
        print "=========================================", my_id
        # print "activeID=====",active_id
        a = self.env['sale.order.line'].create({
            'product_id': product_name.id,
            'product_uom_qty': product_qty,
            'price_unit': units,
            'order_id': my_id
        })
        print "a========================", a
Example #5
0
class wizard_declaration_fiscal(models.TransientModel):
    _name = 'declaration_fiscale.declaration_fiscal'
    fiscalyear_id = fields.Many2one('account.fiscalyear',
                                    string='Exercice fiscal',
                                    required=True,
                                    help="entrer ici l'année fiscale")
    periode = fields.Many2one('account.period',
                              string='Période',
                              required=True,
                              help="entrer les methodes ici")
    sum_vnt_loc = fields.Integer(
        required=True,
        string='Somme des ventes locale',
        help="ici en va entrer la somme des vente locales")
    sum_vnt_ext = fields.Integer(
        required=True,
        string='Somme des ventes export',
        help="ici en va entrer la somme des ventes distant")

    @api.v7
    def print_report(self, cr, uid, ids, context=None):
        datas = {'ids': context.get('active_ids', [])}
        datas['model'] = False
        datas['form'] = self.read(cr, uid, ids, context=context)[0]
        return {
            'type': 'ir.actions.report.xml',
            'report_name': 'declaration_fiscale.declaration_fiscal_report',
            'datas': datas,
            'name': u'Rapport de declaration Fiscal',
            'context': context
        }
Example #6
0
class Message(models.Model):
    _name = 'test_new_api.message'

    discussion = fields.Many2one('test_new_api.discussion', ondelete='cascade')
    body = fields.Text()
    author = fields.Many2one('res.users', default=lambda self: self.env.user)
    name = fields.Char(string='Title', compute='_compute_name', store=True)
    display_name = fields.Char(string='Abstract',
                               compute='_compute_display_name')
    size = fields.Integer(compute='_compute_size', search='_search_size')
    double_size = fields.Integer(compute='_compute_double_size')
    discussion_name = fields.Char(related='discussion.name')

    @api.one
    @api.constrains('author', 'discussion')
    def _check_author(self):
        if self.discussion and self.author not in self.discussion.participants:
            raise ValueError(
                _("Author must be among the discussion participants."))

    @api.one
    @api.depends('author.name', 'discussion.name')
    def _compute_name(self):
        self.name = "[%s] %s" % (self.discussion.name or '', self.author.name
                                 or '')

    @api.one
    @api.depends('author.name', 'discussion.name', 'body')
    def _compute_display_name(self):
        stuff = "[%s] %s: %s" % (self.author.name, self.discussion.name
                                 or '', self.body or '')
        self.display_name = stuff[:80]

    @api.one
    @api.depends('body')
    def _compute_size(self):
        self.size = len(self.body or '')

    def _search_size(self, operator, value):
        if operator not in ('=', '!=', '<', '<=', '>', '>=', 'in', 'not in'):
            return []
        # retrieve all the messages that match with a specific SQL query
        query = """SELECT id FROM "%s" WHERE char_length("body") %s %%s""" % \
                (self._table, operator)
        self.env.cr.execute(query, (value, ))
        ids = [t[0] for t in self.env.cr.fetchall()]
        return [('id', 'in', ids)]

    @api.one
    @api.depends('size')
    def _compute_double_size(self):
        # This illustrates a subtle situation: self.double_size depends on
        # self.size. When size is computed, self.size is assigned, which should
        # normally invalidate self.double_size. However, this may not happen
        # while self.double_size is being computed: the last statement below
        # would fail, because self.double_size would be undefined.
        self.double_size = 0
        size = self.size
        self.double_size = self.double_size + size
class add_part(models.Model):
    _inherit = "res.partner"

    cin = fields.Integer('Numero Cin')
    passport = fields.Integer('Numero passeport')
    tva = fields.Integer('Code TVA')
    catg = fields.Integer('Code catégorie')
    nsec = fields.Integer('Numero etablissement secondaire')
Example #8
0
class descuentos_escuela(models.Model):
    _name = 'descuentos'

    name = fields.Char('Descripción')
    porcentaje = fields.Float('Porcentaje')
    sequence = fields.Integer('Sequence')
    cuenta_id = fields.Many2one('account.account', string="Cuenta")
    is_pronto_pago = fields.Boolean(string="Es pronto pago", default=False)
    dias = fields.Integer(string="Dias de Descuento")
Example #9
0
class attendance_information(models.Model):
    _name = 'attendance.information'

    total_no_of_working_day = fields.Integer('Total No Of Working Days:')
    actual_working_days = fields.Integer('Actual Working Days:')
    absent_days = fields.Integer('Absent Days:')
    date = fields.Date('Date :')
    status = fields.Selection([('check-in', 'Check-In'),
                               ('check-out', 'Check-Out')], 'Status :')
class marks_child(models.TransientModel):
    _name = 'marks.child'


    marks_parent_M2O = fields.Many2one('marks','Marks Calling Child:')
    subject10 = fields.Integer('Physics:')
    subject20 = fields.Integer('Chemistry')
    subject30 = fields.Integer('Maths')
    percentage_new = fields.Float('Percentage : ')
Example #11
0
class sale_order_inherit(models.Model):
    _name = 'sale.order.inherit'
    # _description = "Sales Orders Statistics"
    _auto = False
    # _rec_name = 'date'

    my_name = fields.Many2one('product.product','NAME:')
    my_total_qty = fields.Integer('TOTAL QTY:')
    my_price_unit = fields.Integer('PRICE UNIT')
    my_price_total = fields.Integer('PRICE TOTAL')
    my_avg_unit_price = fields.Integer('AVERAGE PRICE')
    default_code = fields.Char('DEFAULT CODE:')

    # def _select(self):
    #     print "INSIDE SELECT============================="
    #     select_str = """select distinct product_id as my_name,min(id) as id,
    #     SUM(product_uom_qty) as my_total_qty,
    #     SUM(price_unit) as my_price_unit,
    #     SUM(product_uom_qty * price_unit) as my_price_total,
    #     (SUM(product_uom_qty * price_unit) / SUM(product_uom_qty)) AS my_avg_unit_price"""
    #     return select_str

    def _select(self):
        print "INSIDE SELECT============================="
        select_str = """SELECT distinct sl.product_id as my_name,min(sl.id) as id,
        SUM(sl.product_uom_qty) as my_total_qty,
        SUM(sl.price_unit) as my_price_unit,
        SUM(product_uom_qty * price_unit) as my_price_total,
        SUM(sl.product_uom_qty * sl.price_unit) / SUM(sl.product_uom_qty) AS my_avg_unit_price,
        pp.default_code as default_code"""
        return select_str


    def _from(self):
        print "INSIDE FROM=========================="
        from_str = """sale_order_line sl LEFT JOIN product_product pp ON sl.product_id = pp.id"""
        return from_str

    def _group_by(self):
        group_by_str = """GROUP BY sl.product_id,pp.default_code ORDER BY sl.product_id DESC"""
        return group_by_str

    # def _order_by(self):
    #     order_by_str = """"""
    #     return order_by_str

    def init(self, cr):
        print "INSIDE INIT==========================="
        # self._table = sale_report
        tools.drop_view_if_exists(cr, self._table)
        cr.execute("""CREATE or REPLACE VIEW %s as (
            %s
            FROM %s
            %s
            )""" % (self._table, self._select(), self._from(),self._group_by()))
Example #12
0
class marks(models.TransientModel):
    _name = 'marks'

    # student_name = fields.Char('Student Name:')
    subject10 = fields.Integer('Physics:')
    subject20 = fields.Integer('Chemistry')
    subject30 = fields.Integer('Maths')
    percentage_new = fields.Float('Percentage : ')
    # total_marks = fields.Integer('Total Marks')
    marks_child_O2M = fields.One2many('marks.child', 'marks_parent_M2O',
                                      'Calling Child:')

    @api.model
    def default_get(self, fields_list):
        res = super(marks, self).default_get(fields_list)
        context = dict(self._context or {})
        active_ids = context.get('active_ids', False).subject_rel
        print 'active ID:', active_ids
        print 'hello'
        for each in active_ids:
            each = self.env['student'].browse(active_ids)
            print each
            print 'Hi'
            print str(each.subject1)
            print str(each.subject2)
            print str(each.subject3)
            print str(each.percentage)
            # res.update({'subject10':each.subject_rel.subject1})

            #
            # for line in self.marks_child_O2M:
            #     vals = {}
            #     print "=======line======",line
            #     vals.update({'subject10': line.subject10,
            #              'subject20': line.subject20,
            #              'subject30': line.subject30,
            #              'percentage_new': line.percentage_new,
            #              'marks_parent_M2O': line.marks_parent_M2O.id})
            #     self.env['marks.child'].create(vals)
            #     print "vals==========",vals
            #
            # return {
            # 'name': _('Returned Picking'),
            # 'view_type': 'form',
            # 'view_mode': 'form',
            # 'res_model': 'marks',
            # 'res_id': marks,
            # 'type': 'ir.actions.act_window',
            # 'target' : 'new',
            #         }

            print "res============", res
            print "context============", self._context
            return res
Example #13
0
class Bar(models.Model):
    _name = 'test_new_api.bar'

    name = fields.Char()
    foo = fields.Many2one('test_new_api.foo', compute='_compute_foo')
    value1 = fields.Integer(related='foo.value1')
    value2 = fields.Integer(related='foo.value2')

    @api.depends('name')
    def _compute_foo(self):
        for bar in self:
            bar.foo = self.env['test_new_api.foo'].search([('name', '=', bar.name)], limit=1)
Example #14
0
class sale_billing_plan(models.Model):
    _name = "sale.billing.plan"
    _description = "Billing Plan"
    _order = "order_id,sequence,id"

    order_id = fields.Many2one('sale.order',
                               string='Order Reference',
                               readonly=True,
                               index=True,
                               ondelete='cascade')
    order_line_id = fields.Many2one('sale.order.line',
                                    string='Order Line Reference',
                                    readonly=True,
                                    index=True,
                                    ondelete='cascade')
    sequence = fields.Integer(
        string='Sequence',
        default=10,
        help="Gives the sequence of this line when displaying the billing plan."
    )
    installment = fields.Integer(
        string='Installment',
        help="Group of installment. Each group will be an invoice")
    date_invoice = fields.Date(string='Invoice Date', index=True)
    product_id = fields.Many2one(
        'product.product',
        string='Product',
        related='order_line_id.product_id',
        store=True,
        readonly=True,
    )
    name = fields.Text(
        string='Description',
        related='order_line_id.name',
        store=True,
        readonly=True,
    )
    bill_percent = fields.Float(string='Percent', digits=(12, 6))
    bill_amount = fields.Float(string='Amount',
                               digits=dp.get_precision('Account'))

    @api.one
    @api.onchange('bill_percent')
    def _onchange_bill_percent(self):
        subtotal = self.order_line_id.price_subtotal
        self.bill_amount = subtotal and self.bill_percent / 100 * subtotal or 0.0

    @api.one
    @api.onchange('bill_amount')
    def _onchange_bill_amount(self):
        subtotal = self.order_line_id.price_subtotal
        self.bill_percent = subtotal and (self.bill_amount /
                                          subtotal) * 100 or 0.0
class sale_order_line_standard(models.Model):
    _inherit = 'sale.order.line'

    sequence_no = fields.Integer('Sequence', default=0)
    my_bool = fields.Boolean('Boolean', default=True)
    sale_order_child = fields.Many2one('sale.order.line')

    @api.multi
    def unlink(self):
        if not self.sale_order_child:
            record = self.env['sale.order.line'].search([('sale_order_child',
                                                          '=', self.id)])
            for each in record:
                each.unlink()
            self.reorder()
        return super(sale_order_line_standard, self).unlink()

    @api.model
    def reorder(self):
        seq = 1
        order = self.order_id.id
        record = self.env['sale.order.line'].search([('order_id', '=', order)])
        for each in record:
            if each.id == self.id:
                continue
            else:
                if each.my_bool == False:
                    each.update({'sequence_no': seq})
                    seq = seq + 1
                else:
                    each.update({'sequence_no': seq})
Example #16
0
class account_voucher(models.Model):
    _inherit= "account.voucher"

    enviado = fields.Boolean(string="Enviado")
    veces_descarga = fields.Integer(string="# Descargado")
    egreso = fields.Char('Egreso', readonly=True, copy=False)
    res_partner_bank_id = fields.Many2one('res.partner.bank',string="Banco")
    cod_proveedor = fields.Char(related='res_partner_bank_id.bank_bic',string="Codigo de Proveedor en el Banco")
    partner_id_related = fields.Many2one(related='partner_id',string="Proveedir")


    @api.multi
    def default_banco_ids(self, partner_id_related):
        obj_datos=self.env['res.partner.bank'].search([('partner_id','=',partner_id_related)])
        if len(obj_datos)==1:
            return {
                'value': {
                    'res_partner_bank_id': obj_datos.id,
                    }
                }
    

    @api.model
    def create(self, vals):
        seq = self.env['ir.sequence'].next_by_code('account.voucher') or '/'
        vals['egreso'] = seq
        a = super(account_voucher, self).create(vals)
        return a
Example #17
0
class stagiaires(models.Model):
    _name = "hr.stagiaires"
    _description = "liste des stagiaires"
    _rec_name = "nom"
    image = fields.Binary('Image')
    nom = fields.Char("Nom du stagiaire")
    adresse_pro = fields.Char("Adresse Professionelle")
    tel_pro = fields.Char('Tél. portable professionel')
    user_id = fields.Many2one('res.users', string="Utilisateur lié")
    departement = fields.Many2one('hr.department', string="Département")
    job = fields.Many2one('hr.job', string="Titre de poste")
    responsa = fields.Many2one('hr.employee', string="Responsable")
    date_entre = fields.Date('Date debut')
    date_fin = fields.Date('Date fin de stage')
    nationalite = fields.Many2one('res.country', string="Nationalité")
    cin = fields.Integer('CIN')
    deliv = fields.Date('Date delivrance CIN')
    naiss = fields.Date('Date naissance')
    naisslieux = fields.Many2one('res.country.state',
                                 string="Lieux de naissance")
    pers_addr = fields.Char('Adresse personnelle')
    gender = fields.Selection(selection=[('Masculin', 'Masculin'),
                                         ('Feminin', 'Feminin')],
                              string="Genre")
    etciv = fields.Selection(selection=[('Divorcé', 'Divorcé'),
                                        ('Marié', 'Marié'),
                                        ('Celibataire', 'Celibataire'),
                                        ('Voeuf', 'Voeuf')],
                             string="etat Civil")
    actif = fields.Boolean('Active')
    theme = fields.Char('Théme de stage')
Example #18
0
class maintenance_panne(models.Model):
    _name = 'maintenance.panne'
    _order = "occurrence_panne"

    @api.one
    @api.depends('demande_intervention_ids')
    def _get_occurrence_panne(self):
        self.occurrence_panne = len(self.demande_intervention_ids)

    @api.one
    @api.depends('demande_intervention_ids')
    def _get_panne_courante(self):
        for p in self.env['maintenance.panne'].search([]):
            p.panne_courante = False
        for p in self.env['maintenance.panne'].search(
            [], limit=5, order='occurrence_panne desc'):
            p.panne_courante = True

    name = fields.Char('Panne', required=True)
    description = fields.Text('Description')
    occurrence_panne = fields.Integer(compute='_get_occurrence_panne',
                                      string="Nombre d\'occurrence",
                                      store=True)
    demande_intervention_ids = fields.One2many(
        'maintenance.demande.intervention', 'panne_id', 'Demande intervention')
    panne_courante = fields.Boolean(compute='_get_panne_courante',
                                    string='Panne courante',
                                    store=True)
class result_wizard_data(models.TransientModel):
    _name = 'result.wizard.data'
    _description = 'New Description'

    wiz_id = fields.Many2one('result.wizard', 'Wizard')
    name = fields.Char('Subject Name')
    marks_obtained = fields.Integer('Marks Of Student:')
Example #20
0
class Discussion(models.Model):
    _name = 'test_new_api.discussion'

    name = fields.Char(
        string='Title',
        required=True,
        help="General description of what this discussion is about.")
    moderator = fields.Many2one('res.users')
    categories = fields.Many2many('test_new_api.category',
                                  'test_new_api_discussion_category',
                                  'discussion', 'category')
    participants = fields.Many2many('res.users')
    messages = fields.One2many('test_new_api.message', 'discussion')
    message_changes = fields.Integer(string='Message changes')
    important_messages = fields.One2many('test_new_api.message',
                                         'discussion',
                                         domain=[('important', '=', True)])

    @api.onchange('moderator')
    def _onchange_moderator(self):
        self.participants |= self.moderator

    @api.onchange('messages')
    def _onchange_messages(self):
        self.message_changes = len(self.messages)
Example #21
0
class student_enroll_line(models.Model):
    _inherit = 'student.enroll.line'

    @api.onchange('student_id')
    def onchange_student_id(self):
        if self.student_id:
            self.std_idd = self.student_id.std_idd or ''

    @api.multi
    def open_instalment_duedate(self):
        res_id = self.env['student.enroll.duedate'].search([('enrol_id', 'in',
                                                             self.ids)])
        return {
            'name': 'Instalment Due Date',
            'type': 'ir.actions.act_window',
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'student.enroll.duedate',
            'res_id': res_id and res_id[0].id or False,
            'context': {
                'default_enrol_id': self.ids[0],
                'default_name': self.browse(self.ids[0]).install_num
            },
            'target': 'new',
        }

    duedate_ids = fields.One2many('student.enroll.duedate', 'enrol_id',
                                  'Due Date')
    std_idd = fields.Char(related='student_id.std_idd',
                          string='Student ID',
                          size=256)
    install_num = fields.Integer(string='Number of Instalment')
Example #22
0
class subject(models.Model):
    _name = 'subject'

    name = fields.Char('Name', required=1)
    lectures_required = fields.Integer('Lectures Required')
    teacher_ids = fields.Many2many('teacher', 'teacher_subject_rel',
                                   'subject_id', 'teacher_id', 'Teachers')
Example #23
0
class born_shop_category(models.Model):
    _name = 'born.shop.category'

    @api.one
    @api.depends('image')
    def _make_local_url(self):
        for line in self:
            if self.image:
                domain = [('type', '=', 'binary'), ('res_field', '=', 'image'),
                          ('res_model', '=', 'born.shop.category'),
                          ('res_id', '=', self.id)]
                attachment = self.env['ir.attachment'].search(domain, limit=1)
                if attachment:
                    server_url = openerp.tools.config['localhost_server_url']
                    image_url = '%s%s' % (server_url, attachment.local_url)
                    line.image_url = image_url

    name = fields.Char(u'名称')
    image = fields.Binary(u'标志图片', attachment=True)
    image_url = fields.Char(string=u'图片地址',
                            compute='_make_local_url',
                            multi='_make_local_url',
                            help=u"图片地址")
    type = fields.Selection([('url', u'链接'), ('product_ids', u'商品'),
                             ('category_ids', u'分类'), ('content_ids', u'文章'),
                             ('function_ids', u'功能')],
                            default='url',
                            string=u'类型',
                            help=u'类型')
    sequence = fields.Integer(u'排序')
    description = fields.Text(u'说明')
Example #24
0
class ret_taux(models.Model):
    _name="taux_rs"
    _rec_name="nom"
    code = fields.Integer('Code du taxe')
    nom = fields.Char('Nom du taux')
    account  = fields.Many2one('account.account',string="Compte")

    value = fields.Float('Valeur')
Example #25
0
class born_lottery(osv.osv):
    _name = 'born.lottery'

    name = fields.Char(u'名称', size=255, help=u"名称")
    path = fields.Char(u'文件夹名称', size=255, help=u"文件夹名称")
    image = fields.Binary(u"预览")
    level = fields.Integer(u'中奖等级', digits=(2, 0))
    description = fields.Text(u'说明', )
Example #26
0
class descuentos_tomar_escuela(models.Model):
    _name = "descuentos.tomar"

    sequence = fields.Integer('Sequence')
    descuento_id = fields.Many2one('descuentos', 'Descuento')
    porcentaje = fields.Float(related='descuento_id.porcentaje',
                              string='Porcentaje')
    partner_ids = fields.Many2one('res.partner', 'Alumno', ondelete="cascade")
class maintenace_failure_report(osv.osv):
    _name = "maintenance.failure.report"
    _description = "Maintenance Failure Analysis"
    _auto = False

    name = fields.Char('Year', required=False, readonly=True)
    brand = fields.Many2one('maintenance.element.brand',
                            'Brand',
                            readonly=True)
    intervention_id = fields.Many2one('maintenance.intervention',
                                      'Intervention',
                                      readonly=True)
    nbr = fields.Integer('# of Interventions', readonly=True)
    date_start = fields.Datetime('Start Date', readonly=True)
    date_end = fields.Datetime('End Date', readonly=True)
    effective_duration = fields.Datetime('Effective Duration')
    failure_type_id = fields.Many2one('maintenance.failure.type',
                                      'Failure Type',
                                      readonly=True)
    failure_element_id = fields.Many2one('maintenance.element',
                                         'Element damaged',
                                         readonly=True)
    partner_id = fields.Many2one('res.partner', 'Partner', readonly=True)
    time_planned = fields.Float('Time Planned', readonly=True)

    def init(self, cr):
        tools.sql.drop_view_if_exists(cr, 'maintenance_failure_report')
        cr.execute("""
            CREATE view maintenance_failure_report as
              SELECT
                    (select 1 ) AS nbr,
                    i.id as id,
                    i.id as intervention_id,
                    i.date_start as date_start,
                    i.date_end as date_end,
                    (DATE_PART('day', MAX(mit.date_end)::timestamp - i.date_start::timestamp) * 24 + 
               DATE_PART('hour', MAX(mit.date_end)::timestamp - i.date_start::timestamp)) as effective_duration,
                    i.time_planned,
                    i.installation_id,
                    i.failure_type_id,
                    i.failure_element_id,
                    me.brand,
                    mi.partner_id
              FROM maintenance_intervention i
              JOIN maintenance_installation mi ON i.installation_id = mi.id
              JOIN maintenance_intervention_task mit ON i.id = mit.intervention_id 
              JOIN maintenance_element me ON me.id = i.failure_element_id
                GROUP BY
                    i.id,
                    i.date_start,
                    i.date_end,
                    time_planned,
                    i.installation_id,
                    failure_type_id,
                    failure_element_id,
                    me.brand,
                    mi.partner_id
        """)
Example #28
0
class born_activity_gift(osv.osv):
    _name = 'born.activity.gift'
    _description = u"活动奖品情况"

    @api.one
    @api.depends('line_ids')
    def _compute_num(self):
        for line in self:
            use_num = 0
            for item in line.line_ids:
                use_num += 1
            line.remain_qty = line.qty - use_num

    name = fields.Char(u'名称', size=255, required=True, help=u"名称")
    activity_id = fields.Many2one('born.activity',
                                  required=True,
                                  string=u'活动',
                                  ondelete='cascade',
                                  help=u'活动')
    gift_id = fields.Many2one('born.game.gift',
                              required=True,
                              string=u'奖品',
                              ondelete='cascade',
                              help=u'奖品')
    level = fields.Selection([(1, u'一等奖'), (2, u'二等奖'), (3, u'三等奖'),
                              (4, u'四等奖 '), (5, u'五等奖 '), (6, u'六等奖 ')],
                             string=u'几等奖',
                             default=3,
                             help=u"标记为几等奖",
                             required=True)
    qty = fields.Integer(u'数量', help=u"奖项的数量")
    probability = fields.Float(u'概率', help=u"概率")
    note = fields.Char(u'说明', size=255, help=u"说明")
    line_ids = fields.One2many('born.activity.result',
                               'activity_gift_id',
                               string=u'中奖情况',
                               help=u'中奖情况')
    remain_qty = fields.Integer(string=u'剩余数量',
                                compute='_compute_num',
                                multi='_compute_num',
                                help=u"该奖项的剩余中奖次数")

    _sql_constraints = [
        ('unique_activity_gift', 'unique (activity_id,level)', u'奖项不能重复!'),
    ]
Example #29
0
class marks_child(models.TransientModel):
    _name = 'marks.child'
    _rec_name = 'student_name_ref'

    marks_parent_M2O = fields.Many2one('marks', 'Marks Calling Child:')

    student_name_ref = fields.Many2one('student', 'Student Name Ref:')
    subject_name_ref = fields.Many2one('subject.details', 'Subject Name Ref:')
    marks_of_student = fields.Integer('Marks Of Student:')
Example #30
0
class Configuracion(models.Model):
    _name = "configuracion"

    id_pais = fields.Many2one('res.country', string="País")
    id_provincia = fields.Many2one('res.country.state', string="Provincia")
    dias_pago = fields.Integer(string="Cantidad de dias para pronto pago")
    ciudad = fields.Char(string='Ciudad')
    cuenta_id_default = fields.Many2one('fiscal.tipodocumento',
                                        string="Tipo de Documento Por Defecto")