Merge pull request #5584 from expsa/search_res_partner
[FIX] search res partner by phone
This commit is contained in:
commit
28a3aee701
|
|
@ -135,6 +135,26 @@ class ResPartner(models.Model):
|
||||||
if is_family_or_beneficiary and is_donor_vendor_sponsor:
|
if is_family_or_beneficiary and is_donor_vendor_sponsor:
|
||||||
raise ValidationError(_("A contact cannot be both Family/Beneficiary and Donor/Member/Sponsor at the same time!"))
|
raise ValidationError(_("A contact cannot be both Family/Beneficiary and Donor/Member/Sponsor at the same time!"))
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def search(self, args, offset=0, limit=None, order=None, count=False):
|
||||||
|
|
||||||
|
if not self.env.context.get('from_contact_search'):
|
||||||
|
return super().search(args, offset=offset, limit=limit, order=order, count=count)
|
||||||
|
|
||||||
|
if self.env.context.get('mail_read') or self.env.context.get('mail_message_origin'):
|
||||||
|
return super().search(args, offset=offset, limit=limit, order=order, count=count)
|
||||||
|
|
||||||
|
base_results = super().search(args, offset=offset, limit=limit, order=order)
|
||||||
|
|
||||||
|
if not base_results:
|
||||||
|
return base_results
|
||||||
|
|
||||||
|
children = super().search([('parent_id', 'in', base_results.ids)])
|
||||||
|
|
||||||
|
final_ids = list(set(base_results.ids + children.ids))
|
||||||
|
|
||||||
|
return super().search([('id', 'in', final_ids)], offset=0, limit=limit, order=order, count=count)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||||
if not args:
|
if not args:
|
||||||
|
|
|
||||||
|
|
@ -196,16 +196,7 @@
|
||||||
<field name="perm_create" eval="1"/>
|
<field name="perm_create" eval="1"/>
|
||||||
<field name="perm_unlink" eval="1"/>
|
<field name="perm_unlink" eval="1"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="branch_manager_restrictions_lines" model="ir.rule">
|
|
||||||
<field name="name">Branch Manager can only see all his branch sponsorships and donations Lines</field>
|
|
||||||
<field name="model_id" ref="model_donations_details_lines"/>
|
|
||||||
<field name="groups" eval="[(4, ref('branch_manager_group'))]"/>
|
|
||||||
<field name="domain_force">[('branch_custom_id.branch.manager_id.user_id', 'in', [user.id, False])]</field>
|
|
||||||
<field name="perm_read" eval="1"/>
|
|
||||||
<field name="perm_write" eval="1"/>
|
|
||||||
<field name="perm_create" eval="1"/>
|
|
||||||
<field name="perm_unlink" eval="1"/>
|
|
||||||
</record>
|
|
||||||
<record id="sponsorship_system_manager_group" model="res.groups">
|
<record id="sponsorship_system_manager_group" model="res.groups">
|
||||||
<field name="name">Sponsorship System Manager</field>
|
<field name="name">Sponsorship System Manager</field>
|
||||||
<field name="category_id" ref="module_category_kufula"/>
|
<field name="category_id" ref="module_category_kufula"/>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<field name="acc_holder_name"/>
|
<field name="acc_holder_name"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="bank_id"/>
|
<field name="bank_id" required="1"/>
|
||||||
<field name="partner_id" readonly="1"/>
|
<field name="partner_id" readonly="1"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
||||||
|
|
@ -187,10 +187,10 @@
|
||||||
|
|
||||||
</notebook>
|
</notebook>
|
||||||
</sheet>
|
</sheet>
|
||||||
<footer>
|
<!-- <footer>-->
|
||||||
<button name="action_save_and_close" string="حفظ وإغلاق" type="object" class="btn-primary"/>
|
<!-- <button name="action_save_and_close" string="حفظ وإغلاق" type="object" class="btn-primary"/>-->
|
||||||
<button string="تجاهل" class="btn-secondary" special="cancel"/>
|
<!-- <button string="تجاهل" class="btn-secondary" special="cancel"/>-->
|
||||||
</footer>
|
<!-- </footer>-->
|
||||||
<div class="oe_chatter">
|
<div class="oe_chatter">
|
||||||
<field name="message_follower_ids" widget="mail_followers"/>
|
<field name="message_follower_ids" widget="mail_followers"/>
|
||||||
<field name="message_ids" widget="mail_thread"/>
|
<field name="message_ids" widget="mail_thread"/>
|
||||||
|
|
@ -210,7 +210,8 @@
|
||||||
'default_company_type': 'person',
|
'default_company_type': 'person',
|
||||||
'default_is_sponsor_portal': True,
|
'default_is_sponsor_portal': True,
|
||||||
'default_is_donor': True,
|
'default_is_donor': True,
|
||||||
'sponsor_contact': True
|
'sponsor_contact': True,
|
||||||
|
'from_contact_search': True
|
||||||
}
|
}
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
@ -249,6 +250,20 @@
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- <record id="res_partner_phone_filter" model="ir.ui.view">-->
|
||||||
|
<!-- <field name="name">res.partner.phone.filter</field>-->
|
||||||
|
<!-- <field name="model">res.partner</field>-->
|
||||||
|
<!-- <field name="inherit_id" ref="base.view_res_partner_filter"/>-->
|
||||||
|
<!-- <field name="arch" type="xml">-->
|
||||||
|
|
||||||
|
<!-- <xpath expr="//search" position="attributes">-->
|
||||||
|
<!-- <attribute name="context">{'from_contact_search': True}</attribute>-->
|
||||||
|
<!-- </xpath>-->
|
||||||
|
|
||||||
|
<!-- </field>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
<!-- Unarchive Sponsor -->
|
<!-- Unarchive Sponsor -->
|
||||||
<record id="activate_sponsor_multi" model="ir.actions.server">
|
<record id="activate_sponsor_multi" model="ir.actions.server">
|
||||||
<field name="name">Make Active</field>
|
<field name="name">Make Active</field>
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
<field name="payment_method" invisible="1"/>
|
<field name="payment_method" invisible="1"/>
|
||||||
<field name="check_number" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
<field name="check_number" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
||||||
<field name="check_due_date" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
<field name="check_due_date" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
||||||
<field name="partner_bank_id" context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': context.get('force_sponsorship_line_partner_id')}" attrs="{'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')], 'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','bank')]}"/>
|
<field name="partner_bank_id" context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': context.get('force_sponsorship_line_partner_id')}" attrs="{'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')], 'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','bank')]}" create="1" edit="1"/>
|
||||||
<field name="transaction_file_attachment" widget="binary"
|
<field name="transaction_file_attachment" widget="binary"
|
||||||
filename="transaction_attachment_file_name"
|
filename="transaction_attachment_file_name"
|
||||||
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank', 'check'])], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')]}"/>
|
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank', 'check'])], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')]}"/>
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,12 @@ class DonationExtensionWizardLine(models.TransientModel):
|
||||||
compute='_compute_new_end_date',
|
compute='_compute_new_end_date',
|
||||||
readonly=True
|
readonly=True
|
||||||
)
|
)
|
||||||
|
extension_invoice_id = fields.Many2one(
|
||||||
|
'account.move',
|
||||||
|
string="Extension Invoice",
|
||||||
|
readonly=True
|
||||||
|
)
|
||||||
|
|
||||||
direct_debit_partner_bank_id = fields.Many2one("res.partner.bank", string="Direct Debit Partner Bank", domain="[('partner_id', '=', partner_id)]")
|
direct_debit_partner_bank_id = fields.Many2one("res.partner.bank", string="Direct Debit Partner Bank", domain="[('partner_id', '=', partner_id)]")
|
||||||
debit_payment_file_attachment = fields.Binary(string='Debit Payment Attachment', attachment=True)
|
debit_payment_file_attachment = fields.Binary(string='Debit Payment Attachment', attachment=True)
|
||||||
debit_payment_attachment_file_name = fields.Char('Debit Payment File Name', required=False)
|
debit_payment_attachment_file_name = fields.Char('Debit Payment File Name', required=False)
|
||||||
|
|
@ -313,7 +319,7 @@ class DonationExtensionWizardLine(models.TransientModel):
|
||||||
|
|
||||||
if not self.donation_line_id:
|
if not self.donation_line_id:
|
||||||
raise ValidationError(_("No donation detail line selected."))
|
raise ValidationError(_("No donation detail line selected."))
|
||||||
|
if not self.extension_invoice_id:
|
||||||
# Update the donation detail line
|
# Update the donation detail line
|
||||||
new_end_date = self.current_end_date + relativedelta(months=self.months)
|
new_end_date = self.current_end_date + relativedelta(months=self.months)
|
||||||
old_end_date = self.current_end_date
|
old_end_date = self.current_end_date
|
||||||
|
|
@ -345,6 +351,7 @@ class DonationExtensionWizardLine(models.TransientModel):
|
||||||
|
|
||||||
# Create invoice for the extension
|
# Create invoice for the extension
|
||||||
invoice_id = self._create_extension_invoice()
|
invoice_id = self._create_extension_invoice()
|
||||||
|
self.extension_invoice_id = invoice_id
|
||||||
|
|
||||||
# Create extension history record
|
# Create extension history record
|
||||||
self.env['donation.extension.history'].create({
|
self.env['donation.extension.history'].create({
|
||||||
|
|
@ -361,7 +368,7 @@ class DonationExtensionWizardLine(models.TransientModel):
|
||||||
})
|
})
|
||||||
|
|
||||||
if not self.direct_debit:
|
if not self.direct_debit:
|
||||||
return invoice_id, self.donation_line_id
|
return self.extension_invoice_id, self.donation_line_id
|
||||||
|
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
<field name="direct_debit" force_save="1"/>
|
<field name="direct_debit" force_save="1"/>
|
||||||
<field name="direct_debit_partner_bank_id"
|
<field name="direct_debit_partner_bank_id"
|
||||||
context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': partner_id}"
|
context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': partner_id}"
|
||||||
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}" create="1" edit="1"/>
|
||||||
<field name="journal_id" attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
<field name="journal_id" attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
||||||
<field name="debit_payment_file_attachment" widget="binary"
|
<field name="debit_payment_file_attachment" widget="binary"
|
||||||
filename="debit_payment_attachment_file_name"
|
filename="debit_payment_attachment_file_name"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue