46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2026 Nexa Systems Inc.
|
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
|
# Part of the Fusion Plating product family.
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = 'res.partner'
|
|
|
|
x_fc_portal_enabled = fields.Boolean(
|
|
string='Plating Portal Access',
|
|
default=False,
|
|
help='Allow this customer to see Plating quote requests and jobs '
|
|
'in their portal.',
|
|
)
|
|
x_fc_quote_request_ids = fields.One2many(
|
|
'fusion.plating.quote.request',
|
|
'partner_id',
|
|
string='Quote Requests',
|
|
)
|
|
x_fc_portal_job_ids = fields.One2many(
|
|
'fusion.plating.portal.job',
|
|
'partner_id',
|
|
string='Plating Jobs',
|
|
)
|
|
x_fc_quote_request_count = fields.Integer(
|
|
string='Quote Request Count',
|
|
compute='_compute_x_fc_quote_request_count',
|
|
)
|
|
x_fc_portal_job_count = fields.Integer(
|
|
string='Plating Job Count',
|
|
compute='_compute_x_fc_portal_job_count',
|
|
)
|
|
|
|
@api.depends('x_fc_quote_request_ids')
|
|
def _compute_x_fc_quote_request_count(self):
|
|
for partner in self:
|
|
partner.x_fc_quote_request_count = len(partner.x_fc_quote_request_ids)
|
|
|
|
@api.depends('x_fc_portal_job_ids')
|
|
def _compute_x_fc_portal_job_count(self):
|
|
for partner in self:
|
|
partner.x_fc_portal_job_count = len(partner.x_fc_portal_job_ids)
|