Skip to content
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

[IMP] sale_crm_school: add additional products to future students #171

Open
wants to merge 1 commit into
base: 12.0
Choose a base branch
from
Open
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
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