Files
odoo_source/addons/event_sale/models/product.py
T
Suhani Modi 0546a1297a [IMP] event_sale: set proper invoicing policy for event product(s)
Right now, the default invoice policy policy for the products is set to
'delivery'. However, in the case of event ticket products, usually you
don't really handle the "delivery" of the ticket. It's most likely to be
sent by email automatically.

With this commit, the invocing policy for the default ticket product is
set to 'order' to ease inovicing the SO. Apart from default product, the
onchage method for 'event_ok' is adapted for setting the correct invoice
policy and product type.

Task Id : 2243915

closes odoo/odoo#63725

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-25 18:03:35 +00:00

30 lines
892 B
Python

# -*- coding: utf-8 -*-
from odoo import api, fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
event_ok = fields.Boolean(string='Is an Event Ticket', help="If checked this product automatically "
"creates an event registration at the sales order confirmation.")
@api.onchange('event_ok')
def _onchange_event_ok(self):
if self.event_ok:
self.type = 'service'
self.invoice_policy = 'order'
class Product(models.Model):
_inherit = 'product.product'
event_ticket_ids = fields.One2many('event.event.ticket', 'product_id', string='Event Tickets')
@api.onchange('event_ok')
def _onchange_event_ok(self):
""" Redirection, inheritance mechanism hides the method on the model """
if self.event_ok:
self.type = 'service'
self.invoice_policy = 'order'