import uuid
from odoo import models, fields, api


class MarketplaceCompany(models.Model):
    _name = 'marketplace.company'
    _description = 'Marketplace Company'
    _order = 'name'

    # Основные поля
    uuid = fields.Char(string='UUID', required=True, default=lambda self: str(uuid.uuid4()), index=True)
    name = fields.Char(string='Company Name', required=True)
    tax_id = fields.Char(string='Tax ID', required=True, help='ИНН/VAT/Tax Registration Number')
    country_id = fields.Many2one('res.country', string='Country', required=True)
    
    # Статус
    active = fields.Boolean(string='Active', default=True)
    
    # Связи с другими модулями будут добавлены через наследование в соответствующих модулях
    
    def name_get(self):
        result = []
        for company in self:
            name = f"{company.name} ({company.tax_id}, {company.country_id.code})"
            result.append((company.id, name))
        return result