Odoo modules related to events management
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

26 lines
1.0 KiB

from odoo import models, api
class EventRegistration(models.Model):
_inherit = "event.registration"
def action_set_done(self):
super().action_set_done()
for regis in self:
tic_prod = regis.event_ticket_id.product_id
bal_prod = tic_prod.balance_variant_id
if tic_prod.is_event_deposit and bal_prod:
order = regis.sale_order_id
lines = order.order_line
line = lines.filtered(lambda sol: sol.product_id == bal_prod, limit=1)
if line:
# Update existing line
update_values = order._prepare_order_line_update_values(
line, line.product_uom_qty + 1
)
if update_values:
order._update_cart_line_values(line, update_values)
else:
# Create new line
line_values = order._prepare_order_line_values(bal_prod, 1)
line.sudo().create(line_values)