Initial commit: Sale packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:49 +02:00
commit 14e3d26998
6469 changed files with 2479670 additions and 0 deletions

View file

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import event_booth_configurator

View file

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, fields, _
from odoo.exceptions import ValidationError
class EventBoothConfigurator(models.TransientModel):
_name = 'event.booth.configurator'
_description = 'Event Booth Configurator'
product_id = fields.Many2one('product.product', string='Product', readonly=True)
sale_order_line_id = fields.Many2one('sale.order.line', string='Sale Order Line', readonly=True)
event_id = fields.Many2one('event.event', string='Event', required=True)
event_booth_category_available_ids = fields.Many2many(related='event_id.event_booth_category_available_ids', readonly=True)
event_booth_category_id = fields.Many2one(
'event.booth.category', string='Booth Category', required=True,
compute='_compute_event_booth_category_id', readonly=False, store=True)
event_booth_ids = fields.Many2many(
'event.booth', string='Booth', required=True,
compute='_compute_event_booth_ids', readonly=False, store=True)
@api.depends('event_id')
def _compute_event_booth_category_id(self):
self.event_booth_category_id = False
@api.depends('event_id', 'event_booth_category_id')
def _compute_event_booth_ids(self):
self.event_booth_ids = False
@api.constrains('event_booth_ids')
def _check_if_no_booth_ids(self):
if any(not wizard.event_booth_ids for wizard in self):
raise ValidationError(_('You have to select at least one booth.'))

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo><data>
<record id="event_booth_configurator_view_form" model="ir.ui.view">
<field name="name">event.booth.configurator.view.form</field>
<field name="model">event.booth.configurator</field>
<field name="arch" type="xml">
<form js_class="event_booth_configurator_form">
<group>
<field name="product_id" invisible="1"/>
<field name="event_id" options="{'no_open': True, 'no_create': True}"
domain="[
('event_booth_ids.product_id', '=', product_id),
('is_finished', '=', False)
]"/>
<field name="event_booth_category_available_ids" invisible="1"/>
<field name="event_booth_category_id" options="{'no_open': True, 'no_create': True}"
attrs="{'invisible': [('event_id', '=', False)]}"
domain="[('id', 'in', event_booth_category_available_ids)]"/>
<field name="event_booth_ids" options="{'no_open': True, 'no_create': True}"
widget="many2many_checkboxes" attrs="{'invisible': [('event_booth_category_id', '=', False)]}"
domain="[
('event_id', '=', event_id),
('booth_category_id', '=', event_booth_category_id),
('product_id', '=', product_id),
('state', '=', 'available')
]"/>
</group>
<footer>
<button string="Ok" class="btn-primary" special="save"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="event_booth_configurator_action" model="ir.actions.act_window">
<field name="name">Select an event booth</field>
<field name="res_model">event.booth.configurator</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data></odoo>