Merge pull request #6260 from expsa/op

Op
This commit is contained in:
kchyounes19 2026-01-20 11:57:12 +01:00 committed by GitHub
commit a4036f0bb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 36 additions and 0 deletions

View File

@ -18530,3 +18530,14 @@ msgstr "يمكن طلب استثناء مؤقت"
msgid "Exception Family Services Manager Approve"
msgstr "اعتماد مديرة خدمات المستفيدين للاستثناء"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__allowed_country_ids
msgid "Allowed Countries"
msgstr "الجنسيات المسموح بها"
#. module: odex_benefit
#: model:ir.model.fields,help:odex_benefit.field_services_settings__allowed_country_ids
msgid ""
"Countries where this service is available. Leave empty to allow all "
"countries."
msgstr "الجنسيات التي تتوفر فيها هذه الخدمة. اتركها فارغة للسماح بجميع الجنسيات."

View File

@ -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'))

View File

@ -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):

View File

@ -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>