Closed mathisgauthey closed 5 months ago
Hello @mathisgauthey ,
I haven't seen any issues with the last update (0.22.5) yet. Do you have code samples to reproduce the issue?
Sure.
import logging
from datetime import timedelta, datetime
from odoo import fields, models, api, _
from odoo.addons.okteo_ouktuva import ride_utils
from odoo.exceptions import UserError, ValidationError
from odoo.tools import float_round
from odoo.tools import format_date
_logger = logging.getLogger(__name__)
class Ride(models.Model):
# ---------------------------------------- Private Attributes ---------------------------------
_inherit = ['mail.thread', 'mail.activity.mixin', 'avatar.mixin']
_name = 'ouktuva.ride'
_description = 'Ride'
_rec_name = "name"
# --------------------------------------- Fields Declaration ----------------------------------
# Basic
notice_driver = fields.Selection([
('yes', 'Yes'),
('no', 'No'),
('partial', 'Partial'),
], default='no', string="Notice Driver")
# Special
state = fields.Selection(
selection=[
('1_scheduled', 'Scheduled'),
('2_in_progress', 'In progress'),
('3_done', 'Done'),
('4_canceled', 'Canceled'),
],
string='Status',
required=True,
readonly=True,
copy=False,
tracking=True,
default='1_scheduled',
compute='_compute_status',
store='True'
)
active = fields.Boolean('Active', default=True, tracking=True)
# Relational
available_vehicles_ids = fields.Many2many('fleet.vehicle', store=True,
compute="_compute_available_vehicles_ids")
participation_ids = fields.One2many('ouktuva.ride.participation',
'ride_id',
'CARPOOLERS', copy=False)
departure_city_id = fields.Many2one('res.city', 'Departure City',
required=True)
arrival_city_id = fields.Many2one('res.city', 'Arrival City',
required=True)
vehicle_id = fields.Many2one('fleet.vehicle', "Vehicle", required=True,
domain="[('id', 'in', available_vehicles_ids)]")
company_id = fields.Many2one('res.company', 'Company',
default=lambda self: self.env.company)
driver_id = fields.Many2one('hr.employee', string='Driver', required=True,
default=lambda self: self.env.user.employee_id, copy=False)
current_campaign_id = fields.Many2one('ouktuva.campaign', 'Campaign',
compute='_compute_current_campaign_id',
store=True)
agency_id = fields.Many2one(related="vehicle_id.agency_id",
string="Agency Location", readonly=True)
seats_number = fields.Integer('Seats', related="vehicle_id.seats")
departure_date = fields.Datetime('Departure Date', required=True)
arrival_date = fields.Datetime('Arrival Date', required=True)
name = fields.Char("Ride Name", translate=True)
formatted_date = fields.Char(string="Date", compute="_compute_format_date",
store=True)
carpoolers_count = fields.Char(compute='_compute_passengers_count',
string='Carpoolers', readonly=True,
store=True)
# Computed
distance = fields.Float('Distance', readonly=True,
compute="_compute_distance", store=True)
total_carbon_estimated = fields.Float(string="Total Carbon Estimated (Kg CO2 / Ride)",
compute='_compute_total_carbon_estimated', store=True)
individual_carbon_estimated = fields.Float(
string="Estimated Individual Carbon Emissions",
compute='_compute_individual_carbon_estimated', store=True)
earned_points = fields.Float('Earned Points', readonly=True,
compute='_compute_individual_carbon_estimated',
store=True)
saved_km = fields.Float("Kilometers Saved",
compute="_compute_saved_km", store=True)
total_passengers = fields.Integer(compute='_compute_passengers_count',
string='Number Of Passengers',
store=True)
total_carpoolers = fields.Integer(compute='_compute_passengers_count',
string='Number Of Carpoolers',
store=True)
carpooling = fields.Integer(compute='_compute_passengers_count',
string='Carpooling',
store=True)
available_seats = fields.Integer(compute='_compute_passengers_count',
string='Available Seats',
store=True, default=0)
@api.model
def write(self, vals):
for rec in self:
old_driver_id = rec.driver_id
old_driver_partner_id = rec.driver_id.user_partner_id.id
result = super(Ride, self).write(vals)
for ride in self:
if 'participation_ids' in vals:
for participation in ride.participation_ids:
if participation.carpooler_id:
ride.message_subscribe(
[participation.carpooler_id.user_partner_id.id])
if 'driver_id' in vals:
new_driver_id = vals.get('driver_id')
if new_driver_id and old_driver_id != new_driver_id:
new_driver_partner_id = ride.driver_id.user_partner_id.id
ride.message_unsubscribe([old_driver_partner_id])
ride.message_subscribe([new_driver_partner_id])
return result
Yesterday, I had an issue on the old_driver_id
which I was going to fix today, but now the Odoo IDE doesn't generate any PROBLEMS
and my WSL RAM usage is skyrocketting.
Update :
Rolling back to yesterday extension settings and version seems to fix it.
But I'm having monstrous VRAM usage :
Can't seem to find out why yet
Hey there. I got back from my workspace state of yesterday.
At launch, I have an Intellicode error as well, output is on the screenshot. Pylance seems to get disabled by itself I don't know exactly why.
And the RAM usage was linked to Intellicode API Usage Examples
.
I can't have Pylance activated and working with Intellicode, I think the issue might be situated somewhere around here.
I'm pretty sure I used to be able to have both extensions
Usage with API Usage Examples activated :
/home/mat/.vscode-server/bin/863d2581ecda6849923a2118d93a088b0745d9d6/node /home/mat/.vscode-server/extensions/visualstudioexptteam.intellicode-api-usage-examples-0.2.8/dist/server/server.js --node-ipc --clientProcessId=19110
After disabling API Usage Examples :
Hope it helps. I'll stay here and happy to help.
Sure.
import logging from datetime import timedelta, datetime from odoo import fields, models, api, _ from odoo.addons.okteo_ouktuva import ride_utils from odoo.exceptions import UserError, ValidationError from odoo.tools import float_round from odoo.tools import format_date _logger = logging.getLogger(__name__) class Ride(models.Model): # ---------------------------------------- Private Attributes --------------------------------- _inherit = ['mail.thread', 'mail.activity.mixin', 'avatar.mixin'] _name = 'ouktuva.ride' _description = 'Ride' _rec_name = "name" # --------------------------------------- Fields Declaration ---------------------------------- # Basic notice_driver = fields.Selection([ ('yes', 'Yes'), ('no', 'No'), ('partial', 'Partial'), ], default='no', string="Notice Driver") # Special state = fields.Selection( selection=[ ('1_scheduled', 'Scheduled'), ('2_in_progress', 'In progress'), ('3_done', 'Done'), ('4_canceled', 'Canceled'), ], string='Status', required=True, readonly=True, copy=False, tracking=True, default='1_scheduled', compute='_compute_status', store='True' ) active = fields.Boolean('Active', default=True, tracking=True) # Relational available_vehicles_ids = fields.Many2many('fleet.vehicle', store=True, compute="_compute_available_vehicles_ids") participation_ids = fields.One2many('ouktuva.ride.participation', 'ride_id', 'CARPOOLERS', copy=False) departure_city_id = fields.Many2one('res.city', 'Departure City', required=True) arrival_city_id = fields.Many2one('res.city', 'Arrival City', required=True) vehicle_id = fields.Many2one('fleet.vehicle', "Vehicle", required=True, domain="[('id', 'in', available_vehicles_ids)]") company_id = fields.Many2one('res.company', 'Company', default=lambda self: self.env.company) driver_id = fields.Many2one('hr.employee', string='Driver', required=True, default=lambda self: self.env.user.employee_id, copy=False) current_campaign_id = fields.Many2one('ouktuva.campaign', 'Campaign', compute='_compute_current_campaign_id', store=True) agency_id = fields.Many2one(related="vehicle_id.agency_id", string="Agency Location", readonly=True) seats_number = fields.Integer('Seats', related="vehicle_id.seats") departure_date = fields.Datetime('Departure Date', required=True) arrival_date = fields.Datetime('Arrival Date', required=True) name = fields.Char("Ride Name", translate=True) formatted_date = fields.Char(string="Date", compute="_compute_format_date", store=True) carpoolers_count = fields.Char(compute='_compute_passengers_count', string='Carpoolers', readonly=True, store=True) # Computed distance = fields.Float('Distance', readonly=True, compute="_compute_distance", store=True) total_carbon_estimated = fields.Float(string="Total Carbon Estimated (Kg CO2 / Ride)", compute='_compute_total_carbon_estimated', store=True) individual_carbon_estimated = fields.Float( string="Estimated Individual Carbon Emissions", compute='_compute_individual_carbon_estimated', store=True) earned_points = fields.Float('Earned Points', readonly=True, compute='_compute_individual_carbon_estimated', store=True) saved_km = fields.Float("Kilometers Saved", compute="_compute_saved_km", store=True) total_passengers = fields.Integer(compute='_compute_passengers_count', string='Number Of Passengers', store=True) total_carpoolers = fields.Integer(compute='_compute_passengers_count', string='Number Of Carpoolers', store=True) carpooling = fields.Integer(compute='_compute_passengers_count', string='Carpooling', store=True) available_seats = fields.Integer(compute='_compute_passengers_count', string='Available Seats', store=True, default=0) @api.model def write(self, vals): for rec in self: old_driver_id = rec.driver_id old_driver_partner_id = rec.driver_id.user_partner_id.id result = super(Ride, self).write(vals) for ride in self: if 'participation_ids' in vals: for participation in ride.participation_ids: if participation.carpooler_id: ride.message_subscribe( [participation.carpooler_id.user_partner_id.id]) if 'driver_id' in vals: new_driver_id = vals.get('driver_id') if new_driver_id and old_driver_id != new_driver_id: new_driver_partner_id = ride.driver_id.user_partner_id.id ride.message_unsubscribe([old_driver_partner_id]) ride.message_subscribe([new_driver_partner_id]) return result
Yesterday, I had an issue on the
old_driver_id
which I was going to fix today, but now the Odoo IDE doesn't generate anyPROBLEMS
and my WSL RAM usage is skyrocketting.
@mathisgauthey ,
With your code sample, I also haven't seen any issues yet.
It works like you when I disable Pylance extension, but it used to work even with both.
And I still don't get what's going on now with the RAM usage, mystery on my end.
It works like you when I disable Pylance extension, but it used to work even with both.
And I still don't get what's going on now with the RAM usage, mystery on my end.
I also have Pylance and IntelliCode API Usage Examples installed. Everything seems to work fine.
Hey there, since last update (0.22.5), I can't see any issues under the
PROBLEMS
tab, even when opening files where there are functions using unknown fields and so on.It worked fine yesterday.
Here are the logs :
As I was writing the post, I noticed it generated something :
But using PyRight and not the usual Odoo IDE Code message. The source is
_generated_diagnostic_collection_name
, I found this.My project is inside WSL.