Browse Source

[FIX] Bug Fixed 'fleet_car_workshop'

Ajmal JK 6 years ago
parent
commit
7cac16f205
  1. 3
      fleet_car_workshop/__manifest__.py
  2. 4
      fleet_car_workshop/models/car_workshop.py
  3. 12
      fleet_car_workshop/models/config.py
  4. 109
      fleet_car_workshop/models/dashboard.py~

3
fleet_car_workshop/__manifest__.py

@ -19,7 +19,7 @@
############################################################################## ##############################################################################
{ {
'name': 'Car Workshop', 'name': 'Car Workshop',
'version': '10.0.2.0.1', 'version': '10.0.2.0.2',
'summary': 'Complete Vehicle Workshop Operations & Reports', 'summary': 'Complete Vehicle Workshop Operations & Reports',
'description': 'Vehicle workshop operations & Its reports', 'description': 'Vehicle workshop operations & Its reports',
'category': 'Industries', 'category': 'Industries',
@ -30,6 +30,7 @@
'base', 'base',
'fleet', 'fleet',
'account_accountant', 'account_accountant',
'stock'
], ],
'data': [ 'data': [
'views/worksheet_views.xml', 'views/worksheet_views.xml',

4
fleet_car_workshop/models/car_workshop.py

@ -208,9 +208,9 @@ class CarWorkshop(models.Model):
[('id', '=', lines.material.id)]) [('id', '=', lines.material.id)])
for prod_id in product_ids: for prod_id in product_ids:
move_id = self.env['stock.picking'] move_id = self.env['stock.picking']
type_obj = self.env['stock.picking.type'] type_object = self.env['stock.picking.type']
company_id = self.env.context.get('company_id') or self.env.user.company_id.id company_id = self.env.context.get('company_id') or self.env.user.company_id.id
types = type_obj.search([('code', '=', 'outgoing'), ('warehouse_id.company_id', '=', company_id)], limit=1) types = type_object.search([('code', '=', 'outgoing'), ('warehouse_id.company_id', '=', company_id)], limit=1)
vals = { vals = {
'partner_id': self.partner_id.id, 'partner_id': self.partner_id.id,
'origin': self.name, 'origin': self.name,

12
fleet_car_workshop/models/config.py

@ -76,15 +76,3 @@ class WorksheetStages(models.Model):
} }
_order = 'sequence' _order = 'sequence'
class Services(models.Model):
_inherit = 'product.product'
type = fields.Selection([('consu', _('Consumable')), ('service', _('Service')), ('product', _('Stockable Product'))], 'Product Type', required=True,
help="A consumable is a product for which you don't manage stock,"
" a service is a non-material product provided by a company or an individual.")
_defaults = {
'type': 'service',
}

109
fleet_car_workshop/models/dashboard.py~

@ -1,109 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
from odoo.osv import osv
from odoo.tools.translate import _
from odoo import fields, api
class CarVehicle(osv.osv):
_name = 'car.car'
_description = "Vechicles"
_inherit = ['mail.thread']
def _get_visibility_selection_id(self, cr, uid, context=None):
return [('portal', _('Customer Works: visible in portal if the customer is a follower')),
('employees', _('All Employees Work: all employees can access')),
('followers', _('Private Work: followers only'))]
_visibility_selections = lambda self, *args, **kwargs: self._get_visibility_selection_id(*args, **kwargs)
def _compute_attached_docs_count(self):
Attachment = self.env['ir.attachment']
for vehicle in self:
vehicle.doc_count = Attachment.search_count([
'|',
'&',
('res_model', '=', 'car.car'), ('res_id', '=', vehicle.id),
'&',
('res_model', '=', 'car.worksheet'), ('res_id', 'in', vehicle.task_ids.ids)
])
def _compute_task_count(self):
for vehicle in self:
vehicle.task_count = len(vehicle.task_ids)
def attachment_tree_views(self):
self.ensure_one()
domain = [
'|',
'&', ('res_model', '=', 'car.car'), ('res_id', 'in', self.ids),
'&', ('res_model', '=', 'car.workshop'), ('res_id', 'in', self.task_ids.ids)]
return {
'name': _('Attachments'),
'domain': domain,
'res_model': 'ir.attachment',
'type': 'ir.actions.act_window',
'view_id': False,
'view_mode': 'kanban,tree,form',
'view_type': 'form',
'help': _('''<p class="oe_view_nocontent_create">
Documents are attached to the tasks and issues of your Worksheet.</p><p>
Send messages or log internal notes with attachments to link
documents to your Worksheet.
</p>'''),
'limit': 80,
'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
}
active = fields.Boolean('Active',default=True)
name = fields.Many2one('fleet.vehicle', string='Vehicle Name', track_visibility='onchange', required=True)
sequence = fields.Integer('Sequence', help="Gives the sequence order when displaying a list of Projects.")
label_tasks = fields.Char(string='Use Tasks as', help="Gives label to Work on kanban view.", default="Task")
worksheet = fields.One2many('car.workshop', 'vehicle_id', string="Task Activities")
type_ids = fields.Many2many('worksheet.stages', 'car_workshop_type_rel',
'vehicle_id', 'type_id', string='Worksheet Stages',
states={'close': [('readonly', True)], 'cancelled': [('readonly', True)]})
task_count = fields.Integer(compute=_compute_task_count, type='integer', string="Tasks", )
task_ids = fields.One2many('car.workshop', 'vehicle_id',
domain=['|', ('stage_id.fold', '=', False), ('stage_id', '=', False)])
doc_count = fields.Integer(compute=_compute_attached_docs_count, string="Number of documents attached")
color = fields.Integer(string='Color Index')
partner_id = fields.Many2one('res.partner', string='Customer')
state = fields.Selection([('draft', 'New'),
('open', 'In Progress'),
('cancelled', 'Cancelled'),
('pending', 'Pending'),
('close', 'Closed')], string='Status', required=True,
track_visibility='onchange',default='open', copy=False)
date_start = fields.Date(string='Start Date')
date = fields.Date(string='Expiration Date', select=True, track_visibility='onchange'),
use_tasks = fields.Boolean(string='Tasks', default=True)
image_medium = fields.Binary(string="Logo (medium)")
@api.onchange('name')
def on_change_vehicle(self):
self.image_medium = self.name.image_medium
Loading…
Cancel
Save