[IMP]odex_benefit: IMP benefit
This commit is contained in:
parent
c123806f3b
commit
56462e0709
|
|
@ -1148,6 +1148,22 @@ class ServiceRequest(models.Model):
|
|||
domain = [('is_seasonal_service', '=', False), ('service_type', '!=', 'main_service'),
|
||||
('benefit_category_ids', 'in', [rec.family_category.id])]
|
||||
|
||||
if rec.family_id:
|
||||
mother_country = rec.family_id.mother_country_id
|
||||
father_country = rec.family_id.father_country_id
|
||||
|
||||
country_domain = [
|
||||
'|',
|
||||
('allowed_country_ids', '=', False),
|
||||
'|',
|
||||
('allowed_country_ids', 'in', [mother_country.id] if mother_country else []),
|
||||
('allowed_country_ids', 'in', [father_country.id] if father_country else [])
|
||||
]
|
||||
|
||||
allowed_services = self.env['services.settings'].search(country_domain)
|
||||
|
||||
domain.append(('id', 'in', allowed_services.ids if allowed_services else []))
|
||||
|
||||
if rec.family_id.property_type_id:
|
||||
if rec.family_id.property_type_code != 'ownership':
|
||||
domain.append(('service_type', '!=', 'home_restoration'))
|
||||
|
|
|
|||
|
|
@ -145,6 +145,14 @@ class ServicesSettings(models.Model):
|
|||
domain="[('model_id.model', '=', 'family.member')]",
|
||||
help="Select fields from the Member profile to display only when the service is for a member."
|
||||
)
|
||||
allowed_country_ids = fields.Many2many(
|
||||
comodel_name='res.country',
|
||||
relation='services_settings_country_rel',
|
||||
column1='service_id',
|
||||
column2='country_id',
|
||||
string='Allowed Countries',
|
||||
help='Countries where this service is available. Leave empty to allow all countries.'
|
||||
)
|
||||
|
||||
@api.onchange('benefit_type')
|
||||
def _onchange_benefit_type(self):
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
<field name="parent_service"
|
||||
attrs="{'invisible':[('service_type','=','main_service')]}"/>
|
||||
<field name="benefit_category_ids" widget="many2many_tags" required="1"/>
|
||||
<field name="allowed_country_ids" widget="many2many_tags"/>
|
||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
|
|
|
|||
Loading…
Reference in New Issue