Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
Browse files Browse the repository at this point in the history
… fixup! fixup! fixup! fixup! [REF] rename date_tour into start_date ; [IMP] add calendar view
  • Loading branch information
legalsylvain committed Sep 16, 2021
1 parent cfed275 commit eedf97e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions joint_buying_product/models/joint_buying_purchase_order_grouped.py
Expand Up @@ -5,6 +5,7 @@
from datetime import datetime, timedelta

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.osv import expression

from odoo.addons import decimal_precision as dp
Expand Down Expand Up @@ -104,6 +105,20 @@ class JointBuyingPurchaseOrderGrouped(models.Model):

is_mine = fields.Boolean(compute="_compute_is_mine", search="_search_is_mine")

# Constraint Section
@api.constrains("start_date", "end_date", "deposit_date")
def _check_dates(self):
if self.filtered(
lambda x: x.start_date >= x.end_date or x.end_date >= x.deposit_date
):
raise ValidationError(
_(
"Incorrect setting:\n\n"
" * start date should be less than end date\n"
" * end date should be less that deposit date"
)
)

# Default Section
def _default_name(self):
return self.env["ir.sequence"].next_by_code(
Expand Down

0 comments on commit eedf97e

Please sign in to comment.