u/Salty_Draft_9907

▲ 2 r/Odoo

Odoo Module extension with inheritance and adding mail mixin

Hello odooers

I am trying to inherit a model from odoo models the model definition however doesn't include the mail and activity trackers in the inherit. I tried adding as an array of models names in the inherit but it crashed the server.

How to add activity and mail mixins inheritance to a model already defined in odoo.

reddit.com
u/Salty_Draft_9907 — 10 days ago
▲ 0 r/Odoo

Odoo.sh development database backup and restore

Hello odooers.

I am using a development database for testing purposes but I need the data in it to demo.

And knowing it's volitile nature I can't presist the data in it. Is there a way to back it up?.

I can't use the staging database for that since it contains customer data that shouldn't be available for others in the demo.

reddit.com
u/Salty_Draft_9907 — 29 days ago
▲ 1 r/Odoo

Product Category and Company ID

Hello odooers.

I am being tasked with customization of a multi company inventory.

In order to change product Category to have campany uds field since the user doesn't all categories to be available for all companies. By doing this does this break anything in the default odoo structure

reddit.com
u/Salty_Draft_9907 — 2 months ago
▲ 5 r/Odoo

project.task map location override

Hello odooers,

I am trying to have the location of the task be based on a custom model I made.

The default behaviour is that the task takes the address of the partner as the task location in the map. However when I override the address fields in the task to point to the model I made it doesn't show the locations of the custom model records.

So what is the correct way to override the default odoo behaviour?

reddit.com
u/Salty_Draft_9907 — 2 months ago
▲ 1 r/Odoo

Worksheet templates customization from code

Hello odoores I hope you doing well.

I customised project.task model to have lines which represent products. I am trying to customise the worksheet template to be per line. I know I need to specify the res model for the worksheet template to work on the line level.

But I am wondering what's the correct way to customise the worksheet template to keep the customisation as odoo Friendly as possible?

reddit.com
u/Salty_Draft_9907 — 3 months ago

Video casting from phone to my PS3

Trying to find a way to cast videos from phone "web caster app" or via projection to my Ps3

Hello,

I searched on how to cast a video from my phone to the Ps3 since the Ps3 browser won't function well with modern sites. I tried installed the Web caster view mod but it gets stuck on loading the video the freezes.

Tried looking at the DLNA option in the Ps3 but couldn't find it.

Is there a serious of steps, mods or packages I need to know about for this to work?

reddit.com
u/Salty_Draft_9907 — 4 months ago

Trying to find a way to cast videos from phone "web caster app" or via projection to my Ps3

Hello,

I searched on how to cast a video from my phone to the Ps3 since the Ps3 browser won't function well with modern sites. I tried installed the Web caster view mod but it gets stuck on loading the video the freezes.

Tried looking at the DLNA option in the Ps3 but couldn't find it.

Is there a serious of steps, mods or packages I need to know about for this to work?

reddit.com
u/Salty_Draft_9907 — 4 months ago
▲ 1 r/Odoo

Odoo Balance Sheet Report

Hello Odooers,
I was tasked with checking if the balance sheet report can be customizable ie by breaking down the report lines in more detailed lines.
if this possible and if it is possible what is the correct odoo way to go about it without messing up the balance sheet report.

I am using Odoo 18 sh
the report is in Acccount > Reporting > Balance Sheet

reddit.com
u/Salty_Draft_9907 — 4 months ago
▲ 1 r/Odoo

Payroll dashboard warning component

Hello odooers.

In the payroll dashboard the warning component is a part of the view. How can I take only the warning component and show it elsewhere?

reddit.com
u/Salty_Draft_9907 — 5 months ago
▲ 0 r/Odoo

Showing HTML template with it's styles in the standard odoo internal view

Hello odooers,

I have this template with HTML and styles from the static added in the manifest to Web.assests_frontend. Which works fine but this particular template needs to be part of the internal user ie with the odoo menu and header inside the module. How is that possible I only dealt with the standard odoo views so far in the backend like form, list... etc.

What is the most odoo Friendly way of making that HTML show with it's styles in the backend.?

Thanks in advance

reddit.com
u/Salty_Draft_9907 — 5 months ago
▲ 2 r/Odoo

Using image_data_uri on the img tag source property to get an image from the documents app

Hello odooers.

I am trying to get an image to show in an XML report using the img tag. To place the image in there I uploaded it in the documents module.

From there how to add the image in the sec property of the img tag to be displayed in the report?

reddit.com
u/Salty_Draft_9907 — 5 months ago
▲ 1 r/Odoo

Wizard presisting data problem when applying changes to other models

Hello Odooers,

I have a problem when saving changes made in a wizard to a model record in the system.

The structure is as follows:

  1. Wizard model
  2. Wizard line model (this model contains the desired changes)

However, when saving, the data from the wizard line model seems to be erased/reset, which prevents correct updates/inserts into the database.

Here is the model structure:

from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
import logging

_logger = logging.getLogger(__name__)

# =========================================================
# Wizard Line
# =========================================================

class DemoAssignmentWizardLine(models.TransientModel):
    _name = 'demo.assignment.wizard.line'
    _description = 'Demo Assignment Wizard Line'

    item_id = fields.Many2one(
        'demo.item',
        string='Item',
        readonly=True,
    )

    already_linked = fields.Boolean(
        string='Already Linked',
        readonly=True,
    )

    selected = fields.Boolean(
        string='Select',
    )


# =========================================================
# Wizard
# =========================================================

class DemoAssignmentWizard(models.TransientModel):
    _name = 'demo.assignment.wizard'
    _description = 'Demo Assignment Wizard'

    parent_id = fields.Many2one(
        'demo.parent',
        string='Parent',
        required=True,
        readonly=True,
    )

    available_group_ids = fields.Many2many(
        'demo.group',
        compute='_compute_available_groups',
        string='Available Groups',
    )

    group_id = fields.Many2one(
        'demo.group',
        string='Group',
        required=True,
        domain="[('id', 'in', available_group_ids)]",
    )

    available_item_ids = fields.Many2many(
        'demo.item',
        'demo_assignment_item_rel',
        compute='_compute_available_items',
        string='Available Items',
        store=True,
    )

    line_ids = fields.Many2many(
        'demo.assignment.wizard.line',
        'demo_assignment_wizard_line_rel',
        string='Lines',
    )

    # =========================================================
    # DEFAULTS
    # =========================================================

    @api.model
    def default_get(self, fields_list):
        res = super().default_get(fields_list)

        parent_id = self.env.context.get('default_parent_id')

        if parent_id:
            res['parent_id'] = parent_id

        return res

    # =========================================================
    # COMPUTE AVAILABLE GROUPS
    # =========================================================

    @api.depends('parent_id')
    def _compute_available_groups(self):
        for rec in self:

            if not rec.parent_id:
                rec.available_group_ids = False
                continue

            parent_item_ids = rec.parent_id.item_ids.ids

            if not parent_item_ids:
                rec.available_group_ids = False
                continue

            groups = self.env['demo.group'].search([])

            available = groups.filtered(
                lambda g: bool(
                    set(g.allowed_item_ids.ids)
                    & set(parent_item_ids)
                )
            )

            rec.available_group_ids = available

    # =========================================================
    # COMPUTE AVAILABLE ITEMS
    # =========================================================

    @api.depends('parent_id', 'group_id')
    def _compute_available_items(self):
        for rec in self:

            if not rec.parent_id or not rec.group_id:
                rec.available_item_ids = False
                continue

            parent_item_ids = rec.parent_id.item_ids.ids
            group_item_ids = rec.group_id.allowed_item_ids.ids

            available_items = self.env['demo.item'].search([
                ('id', 'in', parent_item_ids),
                ('id', 'in', group_item_ids),
            ])

            rec.available_item_ids = available_items

    # =========================================================
    # ONCHANGE GROUP
    # =========================================================

    @api.onchange('group_id')
    def _onchange_group_id(self):
        for rec in self:

            if not rec.parent_id or not rec.group_id:
                rec.line_ids = [(5, 0, 0)]
                continue

            lines = []

            for item in rec.available_item_ids:

                line = self.env[
                    'demo.assignment.wizard.line'
                ].create({
                    'item_id': item.id,
                    'already_linked': False,
                    'selected': False,
                })

                existing_link = self.env[
                    'demo.link'
                ].search([
                    ('group_id', '=', rec.group_id.id),
                    ('item_id', '=', item.id),
                ], limit=1)

                is_linked = (
                    existing_link.parent_id == rec.parent_id
                )

                line.already_linked = is_linked
                line.selected = is_linked

                lines.append(line.id)

            rec.line_ids = [(6, 0, lines)]

    # =========================================================
    # ACTION APPLY
    # =========================================================

    def action_apply(self):
        self.ensure_one()

        if not self.parent_id or not self.group_id:
            raise ValidationError(
                _('Parent and Group are required.')
            )

        link_model = self.env['demo.link']

        for line in self.line_ids:

            existing_link = link_model.search([
                ('group_id', '=', self.group_id.id),
                ('item_id', '=', line.item_id.id),
            ], limit=1)

            if line.selected:

                if existing_link:
                    existing_link.parent_id = self.parent_id.id

                else:
                    link_model.create({
                        'group_id': self.group_id.id,
                        'item_id': line.item_id.id,
                        'parent_id': self.parent_id.id,
                    })

            else:

                if (
                    existing_link
                    and existing_link.parent_id == self.parent_id
                ):
                    existing_link.parent_id = False

        return {
            'type': 'ir.actions.act_window_close'
        }

What could be wrong here?

I know Odoo deletes transient records and resets them, but I thought that should happen only after the wizard closes, not during the action.

reddit.com
u/Salty_Draft_9907 — 5 months ago
▲ 1 r/Odoo

Missing required field error when trying to change configurations in settings

Hello odooers, hope you are doing well.

Whenever I try changing anything in the settings it keeps popping the missing required field error.

What could possibly cause that? I tried looking up required studio fields but didn't manage to find any.

How should I start looking around for this field the message is ambiguous.

I am using Odoo19 Saas.

reddit.com
u/Salty_Draft_9907 — 5 months ago
▲ 1 r/Odoo

Hello odooers.

I am using Odoo SaaS so no python customizations.

In this project the client wants the allocated_hours field to show the days between the given date ranges which is done no problems.

But when setting the value to allocated_hours field it runs computations that set the field to a different value.

I already added a new field to have the days value in but it doesn't factor into the remaining days calculation of the tasks yet.

The question is. Is it wise to make any changes to the allocated_hours field or should I just leave it as it is and use the new added field?

reddit.com
u/Salty_Draft_9907 — 6 months ago