mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-26 21:32:04 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -0,0 +1,33 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo.fields import Domain
|
||||
|
||||
|
||||
class WebsiteCheckoutStep(models.Model):
|
||||
_name = 'website.checkout.step'
|
||||
_description = 'Website Checkout Step'
|
||||
_inherit = ['website.published.multi.mixin']
|
||||
|
||||
name = fields.Char(required=True, translate=True)
|
||||
sequence = fields.Integer()
|
||||
step_href = fields.Char(string="Href", required=True)
|
||||
main_button_label = fields.Char(translate=True)
|
||||
back_button_label = fields.Char(translate=True)
|
||||
website_id = fields.Many2one('website', ondelete='cascade')
|
||||
|
||||
def _get_next_checkout_step(self, allowed_steps_domain):
|
||||
""" Get the next step in the checkout flow based on the sequence."""
|
||||
|
||||
next_step_domain = Domain.AND(
|
||||
[allowed_steps_domain, [('sequence', '>', self.sequence)]]
|
||||
)
|
||||
return self.search(next_step_domain, order='sequence', limit=1)
|
||||
|
||||
def _get_previous_checkout_step(self, allowed_steps_domain):
|
||||
""" Get the previous step in the checkout flow based on the sequence."""
|
||||
|
||||
previous_step_domain = Domain.AND(
|
||||
[allowed_steps_domain, [('sequence', '<', self.sequence)]]
|
||||
)
|
||||
return self.search(previous_step_domain, order='sequence DESC', limit=1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue