Browse Source

Jan 09 : [FIX] Bug Fixed 'cost_per_employee_manufacturing'

pull/299/head
RisvanaCybro 1 year ago
parent
commit
e5fd0473ec
  1. 4
      cost_per_employee_manufacturing/README.rst
  2. 3
      cost_per_employee_manufacturing/__init__.py
  3. 60
      cost_per_employee_manufacturing/__manifest__.py
  4. 2
      cost_per_employee_manufacturing/doc/RELEASE_NOTES.md
  5. 2
      cost_per_employee_manufacturing/models/__init__.py
  6. 25
      cost_per_employee_manufacturing/models/cost_per_employee.py
  7. 10
      cost_per_employee_manufacturing/models/hr_employee.py
  8. 7
      cost_per_employee_manufacturing/models/mrp_cost_structure.py
  9. 31
      cost_per_employee_manufacturing/models/mrp_production.py
  10. 17
      cost_per_employee_manufacturing/models/mrp_workcenter.py

4
cost_per_employee_manufacturing/README.rst

@ -1,4 +1,4 @@
.. image:: https://img.shields.io/badge/license-OPL--1-red.svg
.. image:: https://img.shields.io/badge/licence-OPL--1-red.svg
:target: https://www.odoo.com/documentation/16.0/legal/licenses.html#odoo-apps
:alt: License: OPL-1
@ -22,7 +22,7 @@ Odoo Proprietary License v1.0 (OPL-1)
Credits
-------
Developer: (v16) Sruthi Pavithran @ Cybrosys
(v16) Arwa VV @ Cybrosys
(v16) Arwa VV @ Cybrosys
Contact: odoo@cybrosys.com
Contacts

3
cost_per_employee_manufacturing/__init__.py

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Pavithran (odoo@cybrosys.com)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)

60
cost_per_employee_manufacturing/__manifest__.py

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Pavithran (odoo@cybrosys.com)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
@ -20,35 +19,40 @@
# DEALINGS IN THE SOFTWARE.
#
###############################################################################
{
'name': "Cost per Employees in Manufacturing",
'version': '16.0.1.0.0',
'category': 'Manufacturing',
'summary': """Calculate Cost per Employees in Manufacturing""",
'description': """This module helps to Calculate Cost per Employees in
"name": "Cost per Employees in Manufacturing",
"version": "16.0.1.0.0",
"category": "Manufacturing",
"summary": """Calculate Cost per Employees in Manufacturing""",
"description": """This module helps to Calculate Cost per Employees in
Manufacturing.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['base', 'mrp', 'hr', 'account_accountant', 'account',
'mrp_subcontracting_account_enterprise'],
'data': [
'security/ir.model.access.csv',
'views/hr_employee_views.xml',
'views/mrp_workcenter_views.xml',
'views/mrp_production_views.xml',
'views/cost_structure_report_templates.xml'
"author": "Cybrosys Techno Solutions",
"company": "Cybrosys Techno Solutions",
"maintainer": "Cybrosys Techno Solutions",
"website": "https://www.cybrosys.com",
"depends": [
"base",
"mrp",
"hr",
"account_accountant",
"account",
"mrp_subcontracting_account_enterprise",
],
'assets': {
'web.assets_backend': [
'cost_per_employee_manufacturing/static/src/js/cost_per_employee.js'
"data": [
"security/ir.model.access.csv",
"views/hr_employee_views.xml",
"views/mrp_workcenter_views.xml",
"views/mrp_production_views.xml",
"views/cost_structure_report_templates.xml",
],
"assets": {
"web.assets_backend": [
"cost_per_employee_manufacturing/static/src/js/cost_per_employee.js"
]
},
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': False,
"images": ["static/description/banner.jpg"],
"license": "OPL-1",
"installable": True,
"auto_install": False,
"application": False,
}

2
cost_per_employee_manufacturing/doc/RELEASE_NOTES.md

@ -1,6 +1,6 @@
## Module <cost_per_employee_manufacturing>
#### 05.01.2024
#### 09.01.2023
#### Version 16.0.1.0.0
#### ADD

2
cost_per_employee_manufacturing/models/__init__.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Pavithran (odoo@cybrosys.com)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)

25
cost_per_employee_manufacturing/models/cost_per_employee.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Pavithran (odoo@cybrosys.com)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
@ -24,15 +24,18 @@ from odoo import fields, models
class CostPerEmployee(models.Model):
"""Creating new models for storing cost per employee"""
_name = 'cost.per.employee'
_name = "cost.per.employee"
_description = "Storing cost per hour of employee"
employee_id = fields.Many2one('hr.employee',
help="Select Employees",
string="Employee Name")
cost = fields.Float(related="employee_id.hour_per_cost",
help="Hourly cost of employee",
string="Cost")
mrp_workcenter_id = fields.Many2one('mrp.workcenter',
string="Work Center",
help="Select work centers")
employee_id = fields.Many2one(
"hr.employee", help="Select Employees", string="Employee Name"
)
cost = fields.Float(
related="employee_id.hour_per_cost",
help="Hourly cost of employee",
string="Cost",
)
mrp_workcenter_id = fields.Many2one(
"mrp.workcenter", string="Work Center", help="Select work centers"
)

10
cost_per_employee_manufacturing/models/hr_employee.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Pavithran (odoo@cybrosys.com)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
@ -24,7 +24,9 @@ from odoo import fields, models
class HrEmployee(models.Model):
"""Adding field to hr employee"""
_inherit = 'hr.employee'
hour_per_cost = fields.Float(string='Hourly Cost',
help="Hourly cost of each employee")
_inherit = "hr.employee"
hour_per_cost = fields.Float(
string="Hourly Cost", help="Hourly cost of each employee"
)

7
cost_per_employee_manufacturing/models/mrp_cost_structure.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Pavithran (odoo@cybrosys.com)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
@ -24,11 +24,12 @@ from odoo import models
class MrpCostStructure(models.AbstractModel):
"""Override method for adding field to cost structure report"""
_inherit = 'report.mrp_account_enterprise.mrp_cost_structure'
_inherit = "report.mrp_account_enterprise.mrp_cost_structure"
def get_lines(self, productions):
"""get lines of production in cost structure report"""
lines = super().get_lines(productions)
for line in lines:
line['cost_per_hour'] = productions.cost_per_hour
line["cost_per_hour"] = productions.cost_per_hour
return lines

31
cost_per_employee_manufacturing/models/mrp_production.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Pavithran (odoo@cybrosys.com)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
@ -24,15 +24,20 @@ from odoo import api, fields, models
class MrpProduction(models.Model):
"""Adding fields to mrp production"""
_inherit = 'mrp.production'
cost_per_hour = fields.Float(compute='_compute_cost_per_hour', store=True,
string="Cost per hour",
help="Cost per hour of production")
cost = fields.Float(related='cost_per_hour', store=True, string="Cost",
help="Cost of production")
_inherit = "mrp.production"
@api.depends('workorder_ids', 'workorder_ids.duration')
cost_per_hour = fields.Float(
compute="_compute_cost_per_hour",
store=True,
string="Cost per hour",
help="Cost per hour of production",
)
cost = fields.Float(
related="cost_per_hour", store=True, string="Cost", help="Cost of production"
)
@api.depends("workorder_ids", "workorder_ids.duration")
def _compute_cost_per_hour(self):
"""Calculate cost per hour of employee"""
for record in self:
@ -43,9 +48,13 @@ class MrpProduction(models.Model):
for work_order in record.workorder_ids:
work_center_employees = (
work_order.workcenter_id.cost_per_employee_ids.mapped(
'employee_id.id'))
"employee_id.id"
)
)
if logged_in_user in work_center_employees:
cost_per = record.env['hr.employee'].browse(
logged_in_user).hour_per_cost * work_order.duration
cost_per = (
record.env["hr.employee"].browse(logged_in_user).hour_per_cost
* work_order.duration
)
cost.append(cost_per)
record.cost_per_hour = sum(cost)

17
cost_per_employee_manufacturing/models/mrp_workcenter.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Pavithran (odoo@cybrosys.com)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
@ -23,10 +23,13 @@ from odoo import fields, models
class MrpWorkCenter(models.Model):
"""Adding field in mrp workcenter"""
_inherit = 'mrp.workcenter'
"""Adding field in mrp work-center"""
cost_per_employee_ids = fields.One2many('cost.per.employee',
'mrp_workcenter_id',
string="Employee Cost",
help="Cost per employee")
_inherit = "mrp.workcenter"
cost_per_employee_ids = fields.One2many(
"cost.per.employee",
"mrp_workcenter_id",
string="Employee Cost",
help="Cost per employee",
)

Loading…
Cancel
Save