From ca5efde35b7e10fc8b5f7c88ebf37907e2c7fadd Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Wed, 12 Mar 2025 14:56:10 +0530 Subject: [PATCH] Mar 7 :[UPDT] Updated 'mobile_service_shop' --- mobile_service_shop/models/mobile_brand.py | 1 - .../models/mobile_complaint.py | 1 - .../models/mobile_complaint_description.py | 2 +- .../models/product_template.py | 14 +++++++++++-- mobile_service_shop/models/terms_condition.py | 1 - .../static/description/index.html | 4 ++-- .../views/mobile_brand_views.xml | 21 ++----------------- .../views/mobile_complaint_views.xml | 21 ++----------------- .../views/mobile_service_views.xml | 2 +- .../views/product_product_views.xml | 2 +- .../views/product_template_views.xml | 3 ++- .../views/terms_and_condition_views.xml | 19 ++--------------- 12 files changed, 25 insertions(+), 66 deletions(-) diff --git a/mobile_service_shop/models/mobile_brand.py b/mobile_service_shop/models/mobile_brand.py index 085e5d829..00e30806e 100644 --- a/mobile_service_shop/models/mobile_brand.py +++ b/mobile_service_shop/models/mobile_brand.py @@ -26,7 +26,6 @@ class MobileBrand(models.Model): """This model represents the Mobile Brand""" _name = 'mobile.brand' _description = 'Mobile Brand' - _inherit = ['mail.thread', 'mail.activity.mixin'] _rec_name = 'brand_name' brand_name = fields.Char(string="Mobile Brand", required=True, diff --git a/mobile_service_shop/models/mobile_complaint.py b/mobile_service_shop/models/mobile_complaint.py index f4c68521d..ebf9c6297 100644 --- a/mobile_service_shop/models/mobile_complaint.py +++ b/mobile_service_shop/models/mobile_complaint.py @@ -26,7 +26,6 @@ class MobileComplaint(models.Model): """This model represents for the mobile Complaint type managing""" _name = 'mobile.complaint' _description = 'Mobile Complaint' - _inherit = ['mail.thread', 'mail.activity.mixin'] _rec_name = 'complaint_type' complaint_type = fields.Char(string="Complaint Type", required=True, diff --git a/mobile_service_shop/models/mobile_complaint_description.py b/mobile_service_shop/models/mobile_complaint_description.py index 6ec03d43a..d8b4a65c6 100644 --- a/mobile_service_shop/models/mobile_complaint_description.py +++ b/mobile_service_shop/models/mobile_complaint_description.py @@ -31,7 +31,7 @@ class MobileComplaintDescription(models.Model): complaint_type_template = fields.Many2one('mobile.complaint', string="Complaint Type", - required=True, + required=True, copy=False, help="Complaint type template.") description = fields.Text(string="Description", help="Complaint description.") diff --git a/mobile_service_shop/models/product_template.py b/mobile_service_shop/models/product_template.py index 6a87716eb..a97166ac8 100644 --- a/mobile_service_shop/models/product_template.py +++ b/mobile_service_shop/models/product_template.py @@ -19,7 +19,7 @@ # If not, see . # ############################################################################# -from odoo import fields, models +from odoo import api, fields, models class ProductTemplate(models.Model): @@ -31,9 +31,19 @@ class ProductTemplate(models.Model): help="Specify if the product is a mobile part or not.") brand_name = fields.Many2one('mobile.brand', string="Brand", help="Select a mobile brand for the part.") + allowed_model_ids = fields.Many2many('brand.model', compute='_compute_allowed_model_ids') model_name = fields.Many2one('brand.model', string="Model Name", - domain="[('mobile_brand_name','=',brand_name)]", help="Select a model for the part.") model_colour = fields.Char(string="Colour", help="Colour for the part.") extra_descriptions = fields.Text(string="Note", help="Extra description " "for the part.") + + @api.depends('brand_name') + def _compute_allowed_model_ids(self): + for rec in self: + if rec.brand_name: + rec.allowed_model_ids = self.env['brand.model'].search([ + ('mobile_brand_name', '=', rec.brand_name.id) + ]).ids + else: + rec.allowed_model_ids = self.env['brand.model'].search([]).ids diff --git a/mobile_service_shop/models/terms_condition.py b/mobile_service_shop/models/terms_condition.py index b4450a3a3..c7569c9ea 100644 --- a/mobile_service_shop/models/terms_condition.py +++ b/mobile_service_shop/models/terms_condition.py @@ -26,7 +26,6 @@ class TermsConditions(models.Model): """Used to add the Mobile Service Terms and Conditions""" _name = 'terms.conditions' _description = 'Terms and Conditions' - _inherit = ['mail.thread', 'mail.activity.mixin'] _rec_name = 'terms_id' terms_id = fields.Char(String="Terms and condition", diff --git a/mobile_service_shop/static/description/index.html b/mobile_service_shop/static/description/index.html index bb20584d3..c265633b5 100644 --- a/mobile_service_shop/static/description/index.html +++ b/mobile_service_shop/static/description/index.html @@ -132,7 +132,7 @@ font-size: 46px; font-weight: 700; line-height: normal; - ">Mobile Service Management + ">Mobile Service Management
+
- diff --git a/mobile_service_shop/views/mobile_brand_views.xml b/mobile_service_shop/views/mobile_brand_views.xml index 9d1977754..10ece9f82 100644 --- a/mobile_service_shop/views/mobile_brand_views.xml +++ b/mobile_service_shop/views/mobile_brand_views.xml @@ -1,28 +1,11 @@ - - - mobile.brand.view.form - mobile.brand - -
- - - - - - - - - -
-
mobile.brand.view.tree mobile.brand - + @@ -31,7 +14,7 @@ Mobile Brand mobile.brand - list,form + list

diff --git a/mobile_service_shop/views/mobile_complaint_views.xml b/mobile_service_shop/views/mobile_complaint_views.xml index 95f485c1f..063ab9833 100644 --- a/mobile_service_shop/views/mobile_complaint_views.xml +++ b/mobile_service_shop/views/mobile_complaint_views.xml @@ -1,28 +1,11 @@ - - - mobile.complaint.view.form - mobile.complaint - -

- - - - - - - - - -
-
mobile.complaint.view.tree mobile.complaint - + @@ -31,7 +14,7 @@ Complaint Types mobile.complaint - list,form + list

diff --git a/mobile_service_shop/views/mobile_service_views.xml b/mobile_service_shop/views/mobile_service_views.xml index 60fa3f053..cb7a15587 100644 --- a/mobile_service_shop/views/mobile_service_views.xml +++ b/mobile_service_shop/views/mobile_service_views.xml @@ -264,7 +264,7 @@ + name="Mobile Service" sequence="20" groups="mobile_service_shop.mobile_service_group_executer"/> ir.actions.act_window product.product kanban,list,form - {"search_default_consumable":1, 'default_type': 'consu'} + {"search_default_consumable":1, 'default_type': 'consu', 'default_is_a_parts': 1} [('is_a_parts', '=', True)]

diff --git a/mobile_service_shop/views/product_template_views.xml b/mobile_service_shop/views/product_template_views.xml index 14ce21dbb..732fa8885 100644 --- a/mobile_service_shop/views/product_template_views.xml +++ b/mobile_service_shop/views/product_template_views.xml @@ -15,7 +15,8 @@ - + + diff --git a/mobile_service_shop/views/terms_and_condition_views.xml b/mobile_service_shop/views/terms_and_condition_views.xml index 9b94f7219..7e345577a 100644 --- a/mobile_service_shop/views/terms_and_condition_views.xml +++ b/mobile_service_shop/views/terms_and_condition_views.xml @@ -1,26 +1,11 @@ - - - terms.conditions.view.form - terms.conditions - -

- - - - - - - -
-
terms.conditions.view.tree terms.conditions - + @@ -29,7 +14,7 @@ Terms and Conditions terms.conditions - list,form + list