-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] crm_claim_non_conformity: In crm new nenu "NC Quality".
- Loading branch information
1 parent
1eb6769
commit bdf36b8
Showing
10 changed files
with
244 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
], | ||
"data": [ | ||
"views/crm_claim_type_views.xml", | ||
"views/crm_claim_views.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import crm_claim_type | ||
from . import crm_claim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2024 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import api, fields, models | ||
|
||
|
||
class CrmClaim(models.Model): | ||
_inherit = "crm.claim" | ||
|
||
def _default_claim_type(self): | ||
claim_type_obj = self.env["crm.claim.type"] | ||
if "non_conformity" in self.env.context and self.env.context.get( | ||
"non_conformity" | ||
): | ||
cond = [("non_conformity", "=", True)] | ||
claim_type = claim_type_obj.search(cond, limit=1) | ||
if claim_type: | ||
return claim_type.id | ||
return claim_type_obj | ||
|
||
def _default_non_conformity(self): | ||
if "non_conformity" in self.env.context: | ||
return self.env.context.get("non_conformity") | ||
return False | ||
|
||
claim_type = fields.Many2one(default=_default_claim_type) | ||
non_conformity = fields.Boolean( | ||
string="Is Non Conformity?", default=_default_non_conformity | ||
) | ||
|
||
@api.onchange("non_conformity") | ||
def onchange_non_conformity(self): | ||
return { | ||
"domain": {"claim_type": [("non_conformity", "=", self.non_conformity)]} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<record id="crm_case_claims_form_view" model="ir.ui.view"> | ||
<field name="model">crm.claim</field> | ||
<field name="inherit_id" ref="crm_claim_type.crm_case_claims_form_view" /> | ||
<field name="arch" type="xml"> | ||
<field name="claim_type" position="after"> | ||
<field name="non_conformity" invisible="1" /> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
<record model="ir.actions.act_window" id="crm_claim.crm_claim_category_claim0"> | ||
<field name="name">Claims</field> | ||
<field name="res_model">crm.claim</field> | ||
<field name="view_mode">tree,calendar,form</field> | ||
<field name="view_id" ref="crm_claim.crm_case_claims_tree_view" /> | ||
<field name="domain">[('claim_type.non_conformity', '=', False)]</field> | ||
<field name="context"> | ||
{"search_default_user_id":uid, "stage_type": 'claim', "non_conformity": False}</field> | ||
<field name="search_view_id" ref="crm_claim.view_crm_case_claims_filter" /> | ||
<field name="help" type="html"> | ||
<p class="oe_view_nocontent_create"> | ||
Record and track your customers' claims. | ||
Claims may be linked to a sales order or a lot. | ||
You can send emails with attachments and keep the full history for a claim (emails sent, intervention type and so on). | ||
Claims may automatically be linked to an email address using the mail gateway module. | ||
</p> | ||
</field> | ||
</record> | ||
|
||
<record model="ir.actions.act_window" id="action_crm_claim_non_conformity"> | ||
<field name="name">NC Quality</field> | ||
<field name="res_model">crm.claim</field> | ||
<field name="view_mode">tree,calendar,form</field> | ||
<field name="view_id" ref="crm_claim.crm_case_claims_tree_view" /> | ||
<field name="domain">[('claim_type.non_conformity', '=', True)]</field> | ||
<field name="context"> | ||
{"search_default_user_id":uid, "stage_type": 'claim', "non_conformity": True}</field> | ||
<field name="search_view_id" ref="crm_claim.view_crm_case_claims_filter" /> | ||
<field name="help" type="html"> | ||
<p class="oe_view_nocontent_create"> | ||
Record and track your customers' claims. | ||
Claims may be linked to a sales order or a lot. | ||
You can send emails with attachments and keep the full history for a claim (emails sent, intervention type and so on). | ||
Claims may automatically be linked to an email address using the mail gateway module. | ||
</p> | ||
</field> | ||
</record> | ||
|
||
<menuitem | ||
name="NC Quality" | ||
id="menu_crm_claim_non_conformit" | ||
parent="crm_claim.menu_aftersale" | ||
action="action_crm_claim_non_conformity" | ||
sequence="10" | ||
/> | ||
</odoo> |