コード例 #1
0
 def _comprobarEmail(self):
     if "@" and "." not in self.email:
         raise ValidationError(
             "El email no es correcto. Debe contener al menos @ y .")
コード例 #2
0
 def create_folio(self):
     """
     This method is for create new hotel folio.
     -----------------------------------------
     @param self: The object pointer
     @return: new record set for hotel folio.
     """
     hotel_folio_obj = self.env["hotel.folio"]
     room_obj = self.env["hotel.room"]
     for reservation in self:
         folio_lines = []
         checkin_date = reservation["checkin"]
         checkout_date = reservation["checkout"]
         if not self.checkin < self.checkout:
             raise ValidationError(
                 _("Checkout date should be greater \
                                      than the Check-in date."))
         duration_vals = self.onchange_check_dates(
             checkin_date=checkin_date,
             checkout_date=checkout_date,
             duration=False,
         )
         duration = duration_vals.get("duration") or 0.0
         folio_vals = {
             "date_order": reservation.date_order,
             "warehouse_id": reservation.warehouse_id.id,
             "partner_id": reservation.partner_id.id,
             "pricelist_id": reservation.pricelist_id.id,
             "partner_invoice_id": reservation.partner_invoice_id.id,
             "partner_shipping_id": reservation.partner_shipping_id.id,
             "checkin_date": reservation.checkin,
             "checkout_date": reservation.checkout,
             "duration": duration,
             "reservation_id": reservation.id,
             "service_lines": reservation["folio_id"],
         }
         for line in reservation.reservation_line:
             for r in line.reserve:
                 folio_lines.append((
                     0,
                     0,
                     {
                         "checkin_date": checkin_date,
                         "checkout_date": checkout_date,
                         "product_id": r.product_id and r.product_id.id,
                         "name": reservation["reservation_no"],
                         "price_unit": r.list_price,
                         "product_uom_qty": duration,
                         "is_reserved": True,
                     },
                 ))
                 res_obj = room_obj.browse([r.id])
                 res_obj.write({"status": "occupied", "isroom": False})
         folio_vals.update({"room_lines": folio_lines})
         folio = hotel_folio_obj.create(folio_vals)
         if folio:
             for rm_line in folio.room_lines:
                 rm_line.product_id_change()
         self._cr.execute(
             "insert into hotel_folio_reservation_rel"
             "(order_id, invoice_id) values (%s,%s)",
             (reservation.id, folio.id),
         )
         self.state = "done"
     return True
コード例 #3
0
 def _check_change_cuit(self):
     for rec in self.filtered('invoice_ids'):
         raise ValidationError(
             _('Can not change identification number/category of partner'
               ' that already have invoices. In this case please create a '
               ' new partner'))
コード例 #4
0
 def _check_company_id_picking_id(self):
     for rec in self.sudo():
         if not rec.picking_id.company_id.check_company(rec.company_id):
             raise ValidationError(
                 _('The Company in the Stock Move and in '
                   'Stock Picking must be the same.'))
コード例 #5
0
ファイル: models.py プロジェクト: wft999/FaviteTools
 def _check_name(self):
     if not re.match(PADNAME_PATTERN, self.name):
         raise ValidationError(
             _('Invalid name. Only alphanumerical characters, underscore, hyphen are allowed.'
               ))
コード例 #6
0
 def _check_company_id_partner_id(self):
     for rec in self.sudo():
         if not rec.partner_id.company_id.check_company(rec.company_id):
             raise ValidationError(
                 _('The Company in the Stock Move and in '
                   'Res Partner must be the same.'))
コード例 #7
0
 def _check_company_id_push_rule_id(self):
     for rec in self.sudo():
         if not rec.push_rule_id.company_id.check_company(rec.company_id):
             raise ValidationError(
                 _('The Company in the Stock Move and in '
                   'Stock Location Path must be the same.'))
コード例 #8
0
ファイル: ir_actions.py プロジェクト: zalejiang/odoo
 def _check_python_code(self):
     for action in self.sudo().filtered('code'):
         msg = test_python_expr(expr=action.code.strip(), mode="exec")
         if msg:
             raise ValidationError(msg)
コード例 #9
0
ファイル: ir_actions.py プロジェクト: zalejiang/odoo
 def _check_recursion(self):
     if not self._check_m2m_recursion('child_ids'):
         raise ValidationError(_('Recursion found in child server actions'))
コード例 #10
0
ファイル: event.py プロジェクト: pipatphol1997/odoo-test
 def _check_seats_limit(self):
     for registration in self:
         if registration.event_id.seats_availability == 'limited' and registration.event_id.seats_max and registration.event_id.seats_available < (
                 1 if registration.state == 'draft' else 0):
             raise ValidationError(
                 _('No more seats available for this event.'))
コード例 #11
0
ファイル: session.py プロジェクト: OHNZ/Formation
 def _verify_age(self):
      for r in self:
           for participant in r.participant_ids:
                print('====',self,r,participant,r.participant_ids)
                if participant.age > 30:
                     raise ValidationError(" l'age du  participant %s est %s L'age dépasse la limite de 30 ans" % (participant.name ,participant.age))
コード例 #12
0
ファイル: event.py プロジェクト: pipatphol1997/odoo-test
 def _check_closing_date(self):
     for event in self:
         if event.date_end < event.date_begin:
             raise ValidationError(
                 _('The closing date cannot be earlier than the beginning date.'
                   ))
コード例 #13
0
ファイル: event.py プロジェクト: pipatphol1997/odoo-test
 def _check_seats_limit(self):
     if any(event.seats_availability == 'limited' and event.seats_max
            and event.seats_available < 0 for event in self):
         raise ValidationError(_('No more available seats.'))
コード例 #14
0
ファイル: event.py プロジェクト: pipatphol1997/odoo-test
 def _check_seats_min_max(self):
     if any(event.seats_availability == 'limited'
            and event.seats_min > event.seats_max for event in self):
         raise ValidationError(
             _('Maximum attendees number should be greater than minimum attendees number.'
               ))
コード例 #15
0
 def _check_answered_or_skipped(self):
     if any(line.skipped == bool(line.answer_type) for line in self):
         raise ValidationError(
             _('A question is either skipped, either answered. Not both.'))
コード例 #16
0
 def _check_zip(self):
     for position in self:
         if self.zip_from and self.zip_to and position.zip_from > position.zip_to:
             raise ValidationError(
                 _('Invalid "Zip Range", please configure it properly.'))
コード例 #17
0
 def _check_company_id_rule_id(self):
     for rec in self.sudo():
         if not rec.rule_id.company_id.check_company(rec.company_id):
             raise ValidationError(
                 _('The Company in the Stock Move and in '
                   'Procurement Rule must be the same.'))
コード例 #18
0
 def _check_period_to_sum(self):
     for rec in self:
         if rec.period_id == rec.period_to_sum_id:
             raise ValidationError(
                 _("You cannot sum period %s with itself.") %
                 rec.period_id.name)
コード例 #19
0
 def _check_company_id_inventory_id(self):
     for rec in self.sudo():
         if not rec.inventory_id.company_id.check_company(rec.company_id):
             raise ValidationError(
                 _('The Company in the Stock Move and in '
                   'Stock Inventory must be the same.'))
コード例 #20
0
ファイル: ritase.py プロジェクト: silverkuya/dalsil_biglog
    def to_open(self):
        for record in self:
            if record.price <= 0:
                raise ValidationError("Harga tidak boleh 0 atau minus")
            setting = self.env["ir.model.data"].xmlid_to_object(
                "dalsil_pkg_basic.dalsil_config")
            # setting = self.env['dalsil.wiz_config'].get_default_setting()
            vals = {
                'jenis_inv': "sangu_driver",
                'partner_id': record.driver_id.id,
                'origin': record.name,
                'type': 'in_invoice',
                'payment_term_id': record.sangu_payment_term_id.id,
                'ritase_id': record.id,
                'date_invoice': fields.Date.today(),
                'invoice_line_ids': [(0, 0, {
                    'product_id': setting.product_sangu_driver.id,
                    'name': 'Sangu Driver Ritase No ({})'.format(record.name),
                    'quantity': 1.0,
                    'price_unit': self.sangu_driver,
                    'account_id': setting.acc_sangu_driver.id
                })]
            }
            self.env['account.invoice'].sudo().create(vals)

            if record.sangu_kuli > 0:
                vals = {
                    'jenis_inv': "sangu_kuli",
                    'partner_id': record.kuli_id.id,
                    'origin': record.name,
                    'type': 'in_invoice',
                    'payment_term_id': record.sangu_payment_term_id.id,
                    'ritase_id': record.id,
                    'date_invoice': fields.Date.today(),
                    'invoice_line_ids': [(0, 0, {
                        'product_id': setting.product_sangu_kuli.id,
                        'name': 'Sangu Kuli Ritase No ({})'.format(record.name),
                        'quantity': 1.0,
                        'price_unit': self.sangu_kuli,
                        'account_id': setting.acc_sangu_kuli.id
                    })]
                }
                self.env['account.invoice'].sudo().create(vals)

            if record.solar > 0:
                vals = {
                    'jenis_inv': "solar",
                    'partner_id': record.solar_id.id,
                    'origin': record.name,
                    'type': 'in_invoice',
                    'payment_term_id': record.sangu_payment_term_id.id,
                    'ritase_id': record.id,
                    'date_invoice': fields.Date.today(),
                    'invoice_line_ids': [(0, 0, {
                        'product_id': setting.product_solar.id,
                        'name': 'Solar Ritase No ({})'.format(record.name),
                        'quantity': 1.0,
                        'price_unit': self.solar,
                        'account_id': setting.acc_solar.id
                    })]
                }
                self.env['account.invoice'].sudo().create(vals)

            if record.tol > 0:
                vals = {
                    'jenis_inv': "tol",
                    'partner_id': record.tol_id.id,
                    'origin': record.name,
                    'type': 'in_invoice',
                    'payment_term_id': record.sangu_payment_term_id.id,
                    'ritase_id': record.id,
                    'date_invoice': fields.Date.today(),
                    'invoice_line_ids': [(0, 0, {
                        'product_id': setting.product_tol.id,
                        'name': 'Solar Ritase No ({})'.format(record.name),
                        'quantity': 1.0,
                        'price_unit': self.tol,
                        'account_id': setting.acc_tol.id
                    })]
                }
                self.env['account.invoice'].sudo().create(vals)

            if record.parkir > 0:
                vals = {
                    'jenis_inv': "parkir",
                    'partner_id': record.parkir_id.id,
                    'origin': record.name,
                    'type': 'in_invoice',
                    'payment_term_id': record.sangu_payment_term_id.id,
                    'ritase_id': record.id,
                    'date_invoice': fields.Date.today(),
                    'invoice_line_ids': [(0, 0, {
                        'product_id': setting.product_parkir.id,
                        'name': 'Solar Ritase No ({})'.format(record.name),
                        'quantity': 1.0,
                        'price_unit': self.parkir,
                        'account_id': setting.acc_parkir.id
                    })]
                }
                self.env['account.invoice'].sudo().create(vals)

            if record.premi > 0:
                vals = {
                    'jenis_inv': "premi",
                    'partner_id': record.premi_id.id,
                    'origin': record.name,
                    'type': 'in_invoice',
                    'payment_term_id': record.sangu_payment_term_id.id,
                    'ritase_id': record.id,
                    'date_invoice': fields.Date.today(),
                    'invoice_line_ids': [(0, 0, {
                        'product_id': setting.product_premi.id,
                        'name': 'Solar Ritase No ({})'.format(record.name),
                        'quantity': 1.0,
                        'price_unit': self.premi,
                        'account_id': setting.acc_premi.id
                    })]
                }
                self.env['account.invoice'].sudo().create(vals)

            vals = {
                'jenis_inv': "invoice",
                'partner_id': record.customer_id.id,
                'origin': record.name,
                'type': 'out_invoice',
                'payment_term_id': record.invoice_payment_term_id.id,
                'ritase_id': record.id,
                'date_invoice': fields.Date.today(),
                'invoice_line_ids': [(0, 0, {
                    'product_id': setting.product_invoice.id,
                    'name': 'Invoice Ritase No ({})'.format(record.name),
                    'quantity': 1.0,
                    'price_unit': self.price,
                    'account_id': setting.acc_invoice.id
                })]
            }
            self.env['account.invoice'].sudo().create(vals)
            record.state = 'open'
コード例 #21
0
 def _check_company_id_warehouse_id(self):
     for rec in self.sudo():
         if not rec.warehouse_id.company_id.check_company(rec.company_id):
             raise ValidationError(
                 _('The Company in the Stock Move and in '
                   'Stock Warehouse must be the same.'))
コード例 #22
0
ファイル: ritase.py プロジェクト: silverkuya/dalsil_biglog
 def to_cancel(self):
     for record in self:
         for invoice_id in record.invoice_ids:
             if invoice_id.state != 'cancel':
                 raise ValidationError("Harap cancel semua invoice terlebih dahulu.")
         record.state = 'cancel'
コード例 #23
0
ファイル: lunch.py プロジェクト: Avery1030/odoo12-dev
    def order(self):
        """
        The order_line is ordered to the vendor but isn't received yet
        """
        if self.user_has_groups("lunch.group_lunch_manager"):
            self.write({'state': 'ordered'})

            order = {
                'supplier': False,
                'company': False,
                'currency': False,
            }
            group_lines = {}
            for line in self:
                if not line.supplier:
                    # do not send emails for products with no suppliers
                    continue

                if order['supplier'] and line.supplier != order['supplier']:
                    raise ValidationError(
                        _("Validate order for one supplier at a time to send emails (mixed orders from %s and %s)"
                          ) % (order['supplier'].display_name,
                               line.supplier.display_name))
                order['supplier'] = line.supplier

                if order['company'] and line.order_id.company_id != order[
                        'company']:
                    raise ValidationError(
                        _("Validate order for one company at a time to send emails (mixed orders from %s and %s)"
                          ) %
                        (order['company'].name, line.order_id.company_id.name))
                order['company'] = line.order_id.company_id

                if order['currency'] and line.currency_id != order['currency']:
                    raise ValidationError(
                        _("Validate order for one currency at a time to send emails (mixed orders from %s and %s)"
                          ) % (order['currency'].name, line.currency_id.name))
                order['currency'] = line.currency_id

                # group the order by products and note
                key = (line.product_id, line.note)
                group_lines.setdefault(key, 0)
                group_lines[key] += 1

            order['company_name'] = order['company'].name
            order['currency_id'] = order['currency'].id
            order['supplier_id'] = order['supplier'].id
            order['supplier_name'] = order['supplier'].name
            order['supplier_email'] = order['supplier'].email_formatted

            lines = []
            # sort by product name, note
            for product, note in sorted(group_lines,
                                        key=lambda k: (k[0].name, bool(k[1]))):
                quantity = group_lines[(product, note)]
                lines.append({
                    'product': product.name,
                    'note': note or '',
                    'quantity': quantity,
                    'price': product.price * quantity,
                })

            order['amount_total'] = sum(l['price'] for l in lines)

            template = self.env.ref('lunch.lunch_order_mail_supplier',
                                    raise_if_not_found=False)
            ctx = dict(
                default_composition_mode='mass_mail',
                default_use_template=bool(template),
                default_template_id=template.id,
                default_lang=order['supplier'].lang or self.env.user.lang,
                order=order,
                lines=lines,
            )
            return {
                'type': 'ir.actions.act_window',
                'view_type': 'form',
                'view_mode': 'form',
                'res_model': 'mail.compose.message',
                'target': 'new',
                'context': ctx,
            }

        else:
            raise AccessError(
                _("Only your lunch manager processes the orders."))
コード例 #24
0
ファイル: account_payment.py プロジェクト: rbhatt-pm/odoo
 def _check_amount(self):
     for payment in self:
         if payment.amount < 0:
             raise ValidationError(_('The payment amount cannot be negative.'))
コード例 #25
0
 def confirmed_reservation(self):
     """
     This method create a new record set for hotel room reservation line
     -------------------------------------------------------------------
     @param self: The object pointer
     @return: new record set for hotel room reservation line.
     """
     reservation_line_obj = self.env["hotel.room.reservation.line"]
     vals = {}
     for reservation in self:
         reserv_checkin = reservation.checkin
         reserv_checkout = reservation.checkout
         room_bool = False
         for line_id in reservation.reservation_line:
             for room_id in line_id.reserve:
                 if room_id.room_reservation_line_ids:
                     for reserv in room_id.room_reservation_line_ids.search(
                         [
                             ("status", "in", ("confirm", "done")),
                             ("room_id", "=", room_id.id),
                         ]):
                         check_in = reserv.check_in
                         check_out = reserv.check_out
                         if check_in <= reserv_checkin <= check_out:
                             room_bool = True
                         if check_in <= reserv_checkout <= check_out:
                             room_bool = True
                         if (reserv_checkin <= check_in
                                 and reserv_checkout >= check_out):
                             room_bool = True
                         mytime = "%Y-%m-%d"
                         r_checkin = (reservation.checkin).date()
                         r_checkin = r_checkin.strftime(mytime)
                         r_checkout = (reservation.checkout).date()
                         r_checkout = r_checkout.strftime(mytime)
                         check_intm = (reserv.check_in).date()
                         check_outtm = (reserv.check_out).date()
                         check_intm = check_intm.strftime(mytime)
                         check_outtm = check_outtm.strftime(mytime)
                         range1 = [r_checkin, r_checkout]
                         range2 = [check_intm, check_outtm]
                         overlap_dates = self.check_overlap(
                             *range1) & self.check_overlap(*range2)
                         overlap_dates = [
                             datetime.strftime(dates, "%d/%m/%Y")
                             for dates in overlap_dates
                         ]
                         if room_bool:
                             raise ValidationError(
                                 _("You tried to Confirm "
                                   "Reservation with room"
                                   " those already "
                                   "reserved in this "
                                   "Reservation Period. "
                                   "Overlap Dates are "
                                   "%s") % overlap_dates)
                         else:
                             self.state = "confirm"
                             vals = {
                                 "room_id": room_id.id,
                                 "check_in": reservation.checkin,
                                 "check_out": reservation.checkout,
                                 "state": "assigned",
                                 "reservation_id": reservation.id,
                             }
                             room_id.write({
                                 "isroom": False,
                                 "status": "occupied"
                             })
                     else:
                         self.state = "confirm"
                         vals = {
                             "room_id": room_id.id,
                             "check_in": reservation.checkin,
                             "check_out": reservation.checkout,
                             "state": "assigned",
                             "reservation_id": reservation.id,
                         }
                         room_id.write({
                             "isroom": False,
                             "status": "occupied"
                         })
                 else:
                     self.state = "confirm"
                     vals = {
                         "room_id": room_id.id,
                         "check_in": reservation.checkin,
                         "check_out": reservation.checkout,
                         "state": "assigned",
                         "reservation_id": reservation.id,
                     }
                     room_id.write({"isroom": False, "status": "occupied"})
                 reservation_line_obj.create(vals)
     return True
コード例 #26
0
 def _check_parent_id(self):
     if not self._check_recursion():
         raise ValidationError(
             _('You cannot create recursive Partner hierarchies.'))
コード例 #27
0
    def _check_before_xml_exporting(self):
        self.ensure_one()
        seller = self.company_id
        buyer = self.commercial_partner_id

        # <1.1.1.1>
        if not seller.country_id:
            raise UserError(
                _("%s must have a country") % (seller.display_name))

        # <1.1.1.2>
        if not seller.vat:
            raise UserError(
                _("%s must have a VAT number") % (seller.display_name))
        elif len(seller.vat) > 30:
            raise UserError(
                _("The maximum length for VAT number is 30. %s have a VAT number too long: %s."
                  ) % (seller.display_name, seller.vat))

        # <1.2.1.2>
        if not seller.l10n_it_codice_fiscale:
            raise UserError(
                _("%s must have a codice fiscale number") %
                (seller.display_name))

        # <1.2.1.8>
        if not seller.l10n_it_tax_system:
            raise UserError(_("The seller's company must have a tax system."))

        # <1.2.2>
        if not seller.street and not seller.street2:
            raise UserError(
                _("%s must have a street.") % (seller.display_name))
        if not seller.zip:
            raise UserError(
                _("%s must have a post code.") % (seller.display_name))
        if len(seller.zip) != 5 and seller.country_id.code == 'IT':
            raise UserError(
                _("%s must have a post code of length 5.") %
                (seller.display_name))
        if not seller.city:
            raise UserError(_("%s must have a city.") % (seller.display_name))
        if not seller.country_id:
            raise UserError(
                _("%s must have a country.") % (seller.display_name))

        if seller.l10n_it_has_tax_representative and not seller.l10n_it_tax_representative_partner_id.vat:
            raise UserError(
                _("Tax representative partner %s of %s must have a tax number."
                  ) %
                (seller.l10n_it_tax_representative_partner_id.display_name,
                 seller.display_name))

        # <1.4.1>
        if not buyer.vat and not buyer.l10n_it_codice_fiscale and buyer.country_id.code == 'IT':
            raise UserError(
                _("The buyer, %s, or his company must have either a VAT number either a tax code (Codice Fiscale)."
                  ) % (buyer.display_name))

        # <1.4.2>
        if not buyer.street and not buyer.street2:
            raise UserError(_("%s must have a street.") % (buyer.display_name))
        if not buyer.zip:
            raise UserError(
                _("%s must have a post code.") % (buyer.display_name))
        if len(buyer.zip) != 5 and buyer.country_id.code == 'IT':
            raise UserError(
                _("%s must have a post code of length 5.") %
                (buyer.display_name))
        if not buyer.city:
            raise UserError(_("%s must have a city.") % (buyer.display_name))
        if not buyer.country_id:
            raise UserError(
                _("%s must have a country.") % (buyer.display_name))

        # <2.2.1>
        for invoice_line in self.invoice_line_ids:
            if len(invoice_line.tax_ids) != 1:
                raise UserError(
                    _("You must select one and only one tax by line."))

        for tax_line in self.line_ids.filtered(lambda line: line.tax_line_id):
            if not tax_line.tax_line_id.l10n_it_has_exoneration and tax_line.tax_line_id.amount == 0:
                raise ValidationError(
                    _(
                        "%s has an amount of 0.0, you must indicate the kind of exoneration.",
                        tax_line.name))
コード例 #28
0
    def set_student_level(self):
        for record in self:
            if record.student_ids:
                for rec in record.student_ids:

                    # Permettra de récupérer les bonnes dates inscription scolaire et garderie
                    domain = [('period_school_year', '=', True),
                              ('default_school_year', '=', False)]
                    records_years = self.env[
                        'ecole.partner.school.years'].search(domain, limit=1)

                    if rec.school_year_id.id + 1 != self.school_year_id.id:
                        raise ValidationError(
                            "Erreur : Les périodes scolaires ne correspondent pas. Merci de corriger"
                        )

                    school_level = rec.school_level_id.name
                    if "CM2" in school_level:
                        raise ValidationError(
                            "Erreur : Vous ne pouvez pas faire de passage de fin d'année "
                            "pour les classe de CM2")

                    # establishment_name = self.school_name_id.name.split()[-1]
                    # if establishment_name not in self.school_level_id.name:
                    #     raise ValidationError("Erreur : Problème entre niveau et établissement. Merci de modifier")

                    # Récupère les valeurs des champs de la table ecole.partner.school
                    partner = rec.partner_id.id

                    # Récupère les valeurs de l'inscription - APS
                    extracurricular_activity = rec.extracurricular_activity
                    extracurricular_activity_id = self.extracurricular_activity_id.id

                    # Récupère les valeurs pour inscription par défaut - Garderie mercredi après-midi
                    nursery_wednesday_evening = rec.nursery_wednesday_evening
                    if nursery_wednesday_evening:
                        nursery_evening_days_value = 4
                    else:
                        nursery_evening_days_value = 0
                    nursery_wednesday_afternoon_name_id = self.nursery_wednesday_afternoon_name_id.id

                    # Récupère les valeurs des champs de la table ecole.student.update
                    new_year = self.school_year_id.id
                    new_level = self.school_level_id.id
                    new_school = self.school_name_id.id

                    # if new_school:
                    #     if nursery_wednesday_evening:
                    #         records_nursery = self.env['ecole.nursery.school'].search([])
                    #         for record_nursery in records_nursery:
                    #             if record_nursery.name:
                    #                 place_nursery = record_nursery.name.split()[-1]
                    #                 if place_nursery in self.school_name_id.name:
                    #                     nursery_wednesday_afternoon_name_id = record_nursery.id + 2
                    #                     break
                    #     if extracurricular_activity:
                    #         records_aps_id = self.env['ecole.aps'].search([])
                    #         for record_aps_id in records_aps_id:
                    #             if record_aps_id.name:
                    #                 aps_id = record_aps_id.name.split()[-1]
                    #                 if aps_id in self.school_name_id.name:
                    #                     extracurricular_activity_id = record_aps_id.id
                    #                     break

                    new_begin_date_id = records_years.year_begin_date
                    new_end_date_id = records_years.year_end_date

                    # Préparation du dictionnaire de valeurs
                    vals = {
                        'partner_id':
                        partner,
                        'extracurricular_activity':
                        extracurricular_activity,
                        'extracurricular_activity_id':
                        extracurricular_activity_id,
                        'school_year_id':
                        new_year,
                        'school_registration':
                        new_begin_date_id,
                        'school_end_date':
                        new_end_date_id,
                        'school_name_id':
                        new_school,
                        'school_level_id':
                        new_level,
                        'nursery_wednesday_evening':
                        nursery_wednesday_evening,
                        'nursery_evening_days_value':
                        nursery_evening_days_value,
                        'nursery_wednesday_afternoon_name_id':
                        nursery_wednesday_afternoon_name_id
                    }

                    rec.create(vals)

            # Retourne le popup de validation
            return {
                'name': 'Validation',
                'view_type': 'form',
                'view_mode': 'form',
                'res_model': 'ecole.student.update',
                'view_id': False,
                'type': 'ir.actions.act_window',
                'target': 'new'
            }
コード例 #29
0
ファイル: hr_department.py プロジェクト: karthik1710/odoo13
 def _check_parent_id(self):
     if not self._check_recursion():
         raise ValidationError(_('You cannot create recursive departments.'))
コード例 #30
0
ファイル: res_partner.py プロジェクト: sgcalle/verita
    def create(self, vals):
        family_id = self.env["res.partner"].browse(vals["family_id"])
        if not family_id.is_family:
            raise ValidationError(_("%s is not a family!") % family_id.display_name)

        return super().create(vals)