56 lines
2.1 KiB
Python
Raw Normal View History

2019-11-12 16:16:14 +05:00
from odoo import api, fields, models
class ResPartner(models.Model):
2019-12-17 09:53:47 +05:00
_inherit = "res.partner"
2019-11-12 16:16:14 +05:00
2019-12-17 09:53:47 +05:00
name_parent_case = fields.Char(string="Name Parent Case",)
name_initials_case = fields.Char(string="Name Initials Case",)
function_parent_case = fields.Char(string="Function Parent Case",)
2019-11-12 16:16:14 +05:00
client_contract_ids = fields.One2many(
2019-12-17 09:53:47 +05:00
"res.partner.contract", "partner_id", string="Contracts",
2019-11-12 16:16:14 +05:00
)
contract_count = fields.Integer(
2019-12-17 09:53:47 +05:00
compute="_compute_contract_count", string="# of contracts"
2019-11-12 16:16:14 +05:00
)
2019-12-12 20:01:33 +05:00
full_address = fields.Char(
2019-12-17 09:53:47 +05:00
compute="_compute_full_address"
) # Check for res.partner.contact_address in base/res
2019-12-17 09:53:47 +05:00
street_actual = fields.Many2one("res.partner", string="Actual Address",)
passport_authority = fields.Char(
string="Passport Authority", help="What Department issued the passport",
)
passport_date = fields.Date(
string="Passport Issue Date", help="Date when receive a passport",
)
passport_number = fields.Char(string="Passport Number",)
passport_series = fields.Char(string="Passport Series",)
psrn = fields.Char(string="PSRN", help="Primary State Registration Number",)
2019-11-12 16:16:14 +05:00
representative_id = fields.Many2one(
2019-12-17 09:53:47 +05:00
"res.partner", string="Representative", help="Person, who represents company"
2019-11-12 16:16:14 +05:00
)
2019-12-17 09:53:47 +05:00
signature = fields.Binary(string="Client signature")
2019-11-12 16:16:14 +05:00
2019-12-17 09:53:47 +05:00
@api.depends("street", "street2", "city", "state_id", "zip", "country_id")
2019-12-12 20:01:33 +05:00
def _compute_full_address(self):
for record in self:
2019-12-17 09:53:47 +05:00
data = filter(
None,
map(
lambda s: s and s.strip(),
[
record.zip,
record.street,
record.street2,
record.country_id.name,
record.city,
],
),
)
record.full_address = ", ".join(data)
2019-11-12 16:16:14 +05:00
@api.one
2019-12-17 09:53:47 +05:00
@api.depends("self.client_contract_ids")
2019-11-12 16:16:14 +05:00
def _compute_contract_count(self):
self.contract_count = len(self.client_contract_ids)