Skip to content

[IMP] academic: add company in same partner dni #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion academic/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Academic',
'version': "17.0.1.23.0",
'version': "17.0.1.24.0",
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
Expand Down
5 changes: 5 additions & 0 deletions academic/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ msgstr "<strong>Información de Estudiante:</strong>"
msgid "A partner with the same dni already exists ("
msgstr "Ya existe un contacto con el mismo dni ("

#. module: academic
#: model_terms:ir.ui.view,arch_db:academic.view_academic_partner_form
msgid "- Company:"
msgstr "- Compañía:"

#. module: academic
#: model:ir.module.category,description:academic.module_category_academic
#: model:ir.module.category,name:academic.module_category_academic
Expand Down
4 changes: 4 additions & 0 deletions academic/i18n/es_UY.po
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ msgstr "Contacto con mismo CI"
msgid "A partner with the same dni already exists ("
msgstr "Ya existe un contacto con el mismo CI ("

#. module: academic
#: model_terms:ir.ui.view,arch_db:academic.view_academic_partner_form
msgid "- Company:"
msgstr "- Compañía:"
6 changes: 5 additions & 1 deletion academic/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def _compute_student_links(self):
company_id = fields.Many2one(compute='_compute_company_id', store=True, readonly=False)
# company_type = fields.Selection(selection_add=[('family', 'Family')])
# is_family = fields.Boolean()
same_dni_partner_id = fields.Many2one('res.partner', string='Partner with same DNI', compute='_compute_same_dni_partner_id', store=False)
same_dni_partner_id = fields.Many2one('res.partner', string='Partner with same DNI', compute='_compute_same_dni_partner_id', store=False, search='_search_same_dni_partner_id')
same_dni_partner_company = fields.Many2one('res.company', string="Company same partner", related='same_dni_partner_id.company_id')
current_main_group_id = fields.Many2one('academic.group', compute='_compute_current_main_group', store=True)
category_id = fields.Many2many(check_company=True)
student_count = fields.Integer(compute="_compute_student_count", store=True)
Expand Down Expand Up @@ -200,6 +201,9 @@ def _compute_same_dni_partner_id(self):
partner.same_dni_partner_id = Partner.search(domain, limit=1)
(self - filtered_partners).same_dni_partner_id = False

def _search_same_dni_partner_id(self, operator, value):
return [('dni', operator, value)]

@api.constrains('current_main_group_id')
def _check_unique_main_group_per_year(self):
"""La validación se realiza sobre el campo `current_main_group_id` en lugar de `student_group_ids`
Expand Down
2 changes: 1 addition & 1 deletion academic/views/res_partner_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<xpath expr="//sheet" position="before">
<div class="alert alert-warning oe_edit_only" role="alert" invisible="not same_dni_partner_id">
A partner with the same dni already exists (<field name="same_dni_partner_id"/>)
A partner with the same dni already exists (<field name="same_dni_partner_id"/> - Company: <field name="same_dni_partner_company"/>).
</div>
</xpath>

Expand Down