Skip to content

Commit

Permalink
[IMP] sale_crm_school: add additional products to future students
Browse files Browse the repository at this point in the history
  • Loading branch information
oihane committed Aug 20, 2021
1 parent 72953c3 commit e19110e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 6 deletions.
13 changes: 11 additions & 2 deletions sale_crm_school/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-07-12 10:32+0000\n"
"PO-Revision-Date: 2021-07-12 10:32+0000\n"
"POT-Creation-Date: 2021-08-20 09:33+0000\n"
"PO-Revision-Date: 2021-08-20 09:33+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_crm_school
#: model:ir.model.fields,field_description:sale_crm_school.field_crm_lead_future_student__additional_product_ids
#: model_terms:ir.ui.view,arch_db:sale_crm_school.crm_case_form_view_oppor_inh2_sale_crm_school
#: model_terms:ir.ui.view,arch_db:sale_crm_school.crm_lead_future_student_form_view_inh_sale_crm_school
msgid "Additional Products"
msgstr "Productos adicionales"

#. module: sale_crm_school
#: model:ir.model,name:sale_crm_school.model_res_partner
msgid "Contact"
Expand Down Expand Up @@ -107,12 +114,14 @@ msgstr "Estado"

#. module: sale_crm_school
#: code:addons/sale_crm_school/models/crm_lead.py:120
#: code:addons/sale_crm_school/models/crm_lead.py:129
#, python-format
msgid "There are not future student to register."
msgstr "No hay alumnos a registrar."

#. module: sale_crm_school
#: code:addons/sale_crm_school/models/crm_lead.py:113
#: code:addons/sale_crm_school/models/crm_lead.py:122
#, python-format
msgid "There should be at least a current academic year"
msgstr "Debería existir al menos un año académico actual"
Expand Down
13 changes: 11 additions & 2 deletions sale_crm_school/i18n/eu_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-07-12 10:32+0000\n"
"PO-Revision-Date: 2021-07-12 10:32+0000\n"
"POT-Creation-Date: 2021-08-20 09:33+0000\n"
"PO-Revision-Date: 2021-08-20 09:33+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_crm_school
#: model:ir.model.fields,field_description:sale_crm_school.field_crm_lead_future_student__additional_product_ids
#: model_terms:ir.ui.view,arch_db:sale_crm_school.crm_case_form_view_oppor_inh2_sale_crm_school
#: model_terms:ir.ui.view,arch_db:sale_crm_school.crm_lead_future_student_form_view_inh_sale_crm_school
msgid "Additional Products"
msgstr ""

#. module: sale_crm_school
#: model:ir.model,name:sale_crm_school.model_res_partner
msgid "Contact"
Expand Down Expand Up @@ -107,12 +114,14 @@ msgstr "Egoera"

#. module: sale_crm_school
#: code:addons/sale_crm_school/models/crm_lead.py:120
#: code:addons/sale_crm_school/models/crm_lead.py:129
#, python-format
msgid "There are not future student to register."
msgstr ""

#. module: sale_crm_school
#: code:addons/sale_crm_school/models/crm_lead.py:113
#: code:addons/sale_crm_school/models/crm_lead.py:122
#, python-format
msgid "There should be at least a current academic year"
msgstr ""
Expand Down
13 changes: 11 additions & 2 deletions sale_crm_school/i18n/sale_crm_school.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-07-12 10:32+0000\n"
"PO-Revision-Date: 2021-07-12 10:32+0000\n"
"POT-Creation-Date: 2021-08-20 09:32+0000\n"
"PO-Revision-Date: 2021-08-20 09:32+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_crm_school
#: model:ir.model.fields,field_description:sale_crm_school.field_crm_lead_future_student__additional_product_ids
#: model_terms:ir.ui.view,arch_db:sale_crm_school.crm_case_form_view_oppor_inh2_sale_crm_school
#: model_terms:ir.ui.view,arch_db:sale_crm_school.crm_lead_future_student_form_view_inh_sale_crm_school
msgid "Additional Products"
msgstr ""

#. module: sale_crm_school
#: model:ir.model,name:sale_crm_school.model_res_partner
msgid "Contact"
Expand Down Expand Up @@ -107,12 +114,14 @@ msgstr ""

#. module: sale_crm_school
#: code:addons/sale_crm_school/models/crm_lead.py:120
#: code:addons/sale_crm_school/models/crm_lead.py:129
#, python-format
msgid "There are not future student to register."
msgstr ""

#. module: sale_crm_school
#: code:addons/sale_crm_school/models/crm_lead.py:113
#: code:addons/sale_crm_school/models/crm_lead.py:122
#, python-format
msgid "There should be at least a current academic year"
msgstr ""
Expand Down
9 changes: 9 additions & 0 deletions sale_crm_school/models/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class CrmLeadFutureStudent(models.Model):
sale_order_state = fields.Selection(
string="Sale Order Status", related="sale_order_id.state",
store=True)
additional_product_ids = fields.Many2many(
comodel_name="product.product", string="Additional Products",
relation="rel_future_student_addproduct", column1="student_id",
column2="product_id")

@api.multi
def create_new_student(self, partner_id=False):
Expand All @@ -103,6 +107,11 @@ def create_new_student(self, partner_id=False):
else:
super(CrmLeadFutureStudent,
self).create_new_student(partner_id=partner_id)
if self.additional_product_ids:
self.child_id.write({
"additional_product_ids": [
(4, x.id) for x in self.additional_product_ids],
})

@api.multi
def create_sale_order_for_student(self):
Expand Down
6 changes: 6 additions & 0 deletions sale_crm_school/views/crm_lead_future_student_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
<field name="year_birth" position="after">
<field name="sale_order_id" />
</field>
<group name="head" position="after">
<separator string="Additional Products"
attrs="{'invisible': [('child_id','!=',False)]}"/>
<field name="additional_product_ids"
attrs="{'invisible': [('child_id','!=',False)]}"/>
</group>
</field>
</record>

Expand Down
6 changes: 6 additions & 0 deletions sale_crm_school/views/crm_lead_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
<xpath expr="//field[@name='future_student_ids']/form//field[@name='year_birth']" position="after">
<field name="sale_order_id" />
</xpath>
<xpath expr="//field[@name='future_student_ids']/form//group[@name='head']" position="after">
<separator string="Additional Products"
attrs="{'invisible': [('child_id','!=',False)]}"/>
<field name="additional_product_ids"
attrs="{'invisible': [('child_id','!=',False)]}"/>
</xpath>
</field>
</record>

Expand Down

0 comments on commit e19110e

Please sign in to comment.