diff --git a/asset_documents/README.md b/asset_documents/README.md new file mode 100755 index 000000000..c6e0e893e --- /dev/null +++ b/asset_documents/README.md @@ -0,0 +1,36 @@ +Asset Documents Management +========================= + +Manage asset documents. + + +Installation +============ +- www.odoo.com/documentation/12.0/setup/install.html +- Install our custom addon + +License +======= +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl.html) + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Credits +======= +* Cybrosys Techno Solutions + +Author +------ + +Developer: Tintuk Tomin @ Cybrosys + +Maintainer +---------- + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. + diff --git a/asset_documents/__init__.py b/asset_documents/__init__.py new file mode 100644 index 000000000..5305644df --- /dev/null +++ b/asset_documents/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models \ No newline at end of file diff --git a/asset_documents/__manifest__.py b/asset_documents/__manifest__.py new file mode 100644 index 000000000..60c559acb --- /dev/null +++ b/asset_documents/__manifest__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies (). +# Authors: Tintuk Tomin () +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### +{ + 'name': 'Asset Documents Management', + 'version': '12.0.1.0.0', + 'summary': """Manage the company assets documents and their expiry notifications""", + 'description': 'Manages the company documents and its expiry notifications as emails to the managers.', + 'category': 'Accounting', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['hr','account_asset'], + 'data': [ + 'security/ir.model.access.csv', + "views/asset_notebook.xml", + ], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'demo': [], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/asset_documents/doc/RELEASE_NOTES.md b/asset_documents/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..0bd69712d --- /dev/null +++ b/asset_documents/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 19.03.2019 +#### Version 12.0.1.0.0 +##### ADD +- Initial commit diff --git a/asset_documents/models/__init__.py b/asset_documents/models/__init__.py new file mode 100644 index 000000000..2687c5860 --- /dev/null +++ b/asset_documents/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import asset_management \ No newline at end of file diff --git a/asset_documents/models/asset_management.py b/asset_documents/models/asset_management.py new file mode 100644 index 000000000..8266a8f7c --- /dev/null +++ b/asset_documents/models/asset_management.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api, _ +from odoo.exceptions import Warning,UserError +from datetime import date, datetime, time, timedelta +from dateutil.relativedelta import * + +class AssetCatagory(models.Model): + _inherit = 'account.asset.category' + + category_code = fields.Char(string='Category Code') + next_number = fields.Integer(string='Next Number', default=1) + padding = fields.Integer(string='Padding', + default=4, + help='If padding is 4 then the sequence number will be 3 digit number, eg 0009,0055,0471') + + +class AssetManagment(models.Model): + _inherit = 'account.asset.asset' + + + documents = fields.One2many('account.asset.document', 'document', string='Documents') + sequence_number = fields.Text(string="Number") + description = fields.Html(string='Notes') + + @api.onchange('category_id') + def _onchange_asset_catagory(self): + + # interpolated_prefix + '%%0%sd' % self.padding % number_next + interpolated_suffix + self.sequence_number = str(self.category_id.category_code) + '%%0%sd' % self.category_id.padding % self.category_id.next_number + + @api.model + def create(self, vals): + + if vals['category_id']: + obj=self.env['account.asset.category'].search([('id','=',vals['category_id'])]) + obj.next_number = obj.next_number + 1 + # self.category_id.next_number = self.category_id.next_number + 1 + return super(AssetManagment,self).create(vals) + + +class AssetDocument(models.Model): + _name = 'account.asset.document' + + document = fields.Many2one('account.asset.asset') + document_name = fields.Char(string='Document', required=True, copy=False, help="You can give your Document name or number.") + description = fields.Text(string='Description', copy=False) + expiry_date = fields.Date(string='Expiry Date', copy=False) + doc_attachment_id = fields.Many2many('ir.attachment', string="Attachment", + help='You can attach the copy of your document', copy=False) + warning_before = fields.Integer(string='Before',help="Number of days before the expiry date to get the warning message") + repeat = fields.Boolean(string='Repeat', help="Tick the check box for repeated notification. For example EMIs") + period_type = fields.Selection([('day', 'Daily'), + ('week', 'Weekily'), + ('month', 'Monthly'), + ('year', 'Yearly')], + string='Period Type', + help="Type of reminder you need. If you select Monthly then you will get notification on every month.") + no_of_periods = fields.Integer(string='Period', + default=1, + help="Period of repetition. If you put 3 then you will get notification in every 3 day/week/month/year resepectively") + + def create(self,val): + flag=0 + for data in val: + if data['repeat']: + if not(data['period_type'] and data['no_of_periods'] and data['expiry_date']): + flag=1 + if flag: + raise Warning(("Some fields are missing. Please check Period Type, Period and expiry Date")) + else: + return super(AssetDocument, self).create(val) + + def asset_mail_reminder(self): + now = datetime.now() + timedelta(days=1) + date_now = now.date() + match = self.search([]) + + emp_list=[] + groups = self.env['res.groups'].search([('id','=',45)]) + + for usr in groups.users: + emp = self.env['hr.employee'].search([('user_id','=',usr.id)]) + if emp.id: + emp_list.append(emp.work_email) + for i in match: + if i.expiry_date: + exp_date = i.expiry_date - timedelta(days=i.warning_before) + if date_now >= exp_date: + mail_content = " CHECK ,
The Document " + i.document_name + " of the asset " + i.document.name + " is going to expire on " + \ + str(i.expiry_date) + ". Please renew it before expiry date." + main_content = { + 'subject': _('Asset Document-%s Expired On %s') % (i.document_name, i.expiry_date), + 'author_id': self.env.user.partner_id.id, + 'body_html': mail_content, + 'email_to': ', '.join(emp_list), + } + self.env['mail.mail'].create(main_content).send() + if i.expiry_date == date_now: + if i.repeat: + if i.period_type == 'day': + i.expiry_date = i.expiry_date + timedelta(days=i.no_of_periods) + elif i.period_type == 'week': + i.expiry_date = i.expiry_date + timedelta(weeks=i.no_of_periods) + elif i.period_type == 'month': + i.expiry_date = i.expiry_date + relativedelta(months=+i.no_of_periods) + else: + i.expiry_date = i.expiry_date + relativedelta(years=+i.no_of_periods) \ No newline at end of file diff --git a/asset_documents/security/ir.model.access.csv b/asset_documents/security/ir.model.access.csv new file mode 100644 index 000000000..fd51f4a2b --- /dev/null +++ b/asset_documents/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_asset_document_manager,account.asset.document,model_account_asset_document,account.group_account_manager,1,1,1,1 +access_account_asset_document_invoicing_payment,account.asset.document,model_account_asset_document,account.group_account_invoice,1,0,1,0 +access_account_asset_document,account.asset.document,model_account_asset_document,account.group_account_user,1,0,0,0 \ No newline at end of file diff --git a/asset_documents/static/description/asset-management-cybrosys-1.png b/asset_documents/static/description/asset-management-cybrosys-1.png new file mode 100644 index 000000000..45bd195df Binary files /dev/null and b/asset_documents/static/description/asset-management-cybrosys-1.png differ diff --git a/asset_documents/static/description/asset-management-cybrosys-2.png b/asset_documents/static/description/asset-management-cybrosys-2.png new file mode 100644 index 000000000..648984e50 Binary files /dev/null and b/asset_documents/static/description/asset-management-cybrosys-2.png differ diff --git a/asset_documents/static/description/asset-management-cybrosys-3.png b/asset_documents/static/description/asset-management-cybrosys-3.png new file mode 100644 index 000000000..59e48b64a Binary files /dev/null and b/asset_documents/static/description/asset-management-cybrosys-3.png differ diff --git a/asset_documents/static/description/asset-management-cybrosys-4.png b/asset_documents/static/description/asset-management-cybrosys-4.png new file mode 100644 index 000000000..c789fc0b3 Binary files /dev/null and b/asset_documents/static/description/asset-management-cybrosys-4.png differ diff --git a/asset_documents/static/description/banner.png b/asset_documents/static/description/banner.png new file mode 100644 index 000000000..f89fdd3e3 Binary files /dev/null and b/asset_documents/static/description/banner.png differ diff --git a/asset_documents/static/description/icon.png b/asset_documents/static/description/icon.png new file mode 100644 index 000000000..0d04423da Binary files /dev/null and b/asset_documents/static/description/icon.png differ diff --git a/asset_documents/static/description/index.html b/asset_documents/static/description/index.html new file mode 100644 index 000000000..7ce5549f1 --- /dev/null +++ b/asset_documents/static/description/index.html @@ -0,0 +1,365 @@ +
+
+

+ Assets Document Management +

+

+ Manages company assets and its documents +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies
+
+
+
+
+
+

+ Overview +

+

+ Provides a new provision for managing the company asset documents, expiry notifications and other informations. + Also manages the asset serial number. +

+
+
+

+ Configuration +

+

+ The app is depends upon the Odoo's default Asset Management module and it will be only available in + Enterprise of Odoo V12. +

+
+
+ +
+
+

+ Features +

+

+ + Provision to manage the serial number in the asset category +

+

+ + Automatic generation of serial number for asset under an asset category. +

+ + Provision to manage asset documents +

+

+ + Manages document notification through emails

+

+ + Provision to add other informations of the assets +

+
+
+
+
+

+ Screenshots +

+

+ + Here you can manage the serial number of different assets under this asset category. +

+
+ +
+

+ + The serial number will automatic comes here according to asset category type. +

+
+ +
+

+ + New provision to manage asset documents and its expiry. +

+
+ +
+

+ + New provision to add any information regarding the asset. +

+
+ +
+
+
+ +
+
+ cybrosys technologies +
+
+ +
+
+

+ Our Services +

+
+ + + +
+ +
+ + + +
+

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
diff --git a/asset_documents/views/asset_notebook.xml b/asset_documents/views/asset_notebook.xml new file mode 100644 index 000000000..2937728cd --- /dev/null +++ b/asset_documents/views/asset_notebook.xml @@ -0,0 +1,58 @@ + + + + + account.asset.inherit + account.asset.asset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + account.asset.catagory.inherit + account.asset.category + + + + + + + + + + + + Asset Document Expiry + + code + model.asset_mail_reminder() + 1 + days + -1 + + + + \ No newline at end of file