Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dffce52
Fix .gitmodules for design-themes submodule
John75SunCity Jun 20, 2025
118bf85
Update docker-compose.yml to use Odoo 16.0 and version 3 format
John75SunCity Jun 20, 2025
c83511a
Add index.html for Records Management module documentation
John75SunCity Jun 20, 2025
4d7d3a8
Update static/description/index.html and project files
John75SunCity Jun 20, 2025
1aadbc1
Update static/description/index.html and project files
John75SunCity Jun 20, 2025
af4a7a3
Update static/description/index.html and project files
John75SunCity Jun 20, 2025
05cbd69
Update static/description/index.html and project files
John75SunCity Jun 20, 2025
9309c47
Update static/description/index.html and project files
John75SunCity Jun 20, 2025
5c56a48
Update static/description/index.html and project files
John75SunCity Jun 20, 2025
c8bedf5
Update project files and directory structure
John75SunCity Jun 20, 2025
679166f
Fix manifest version for Odoo 18 compatibility
John75SunCity Jun 20, 2025
96d9345
Fix merge conflict in http_controller.py
John75SunCity Jun 20, 2025
cb455dc
Fix imports and update controllers/__init__.py
John75SunCity Jun 20, 2025
bee448b
Remove unmatched closing brace in scrm_records_management.py
John75SunCity Jun 20, 2025
b08a2a9
Update project with latest changes
John75SunCity Jun 20, 2025
1218788
Update project with latest changes
John75SunCity Jun 20, 2025
9c6db9a
Update project with latest changes
John75SunCity Jun 20, 2025
94d801b
Fix unmatched closing brace in pickup_request.py
John75SunCity Jun 20, 2025
9d5be72
Update pickup_request.py and related improvements
John75SunCity Jun 20, 2025
6556b5d
Update pickup_request.py and related improvements
John75SunCity Jun 20, 2025
a5b39be
Fix manifest formatting and update module metadata
John75SunCity Jun 20, 2025
14ebdb4
Fix manifest formatting and update module metadata
John75SunCity Jun 20, 2025
6e2a5b1
Add scrm_records_management_data.xml to manifest data list
John75SunCity Jun 20, 2025
3b33915
Add scrm_records_management_data.xml to manifest data list
John75SunCity Jun 20, 2025
335f68e
Fix formatting in __manifest__.py by adding a missing comma in the de…
John75SunCity Jun 20, 2025
cd71021
Fix formatting in __manifest__.py by removing an unnecessary comma in…
John75SunCity Jun 20, 2025
8e6b49b
Fix formatting in __manifest__.py by correcting the dependencies list…
John75SunCity Jun 20, 2025
ab8d2c4
Add scrm_records_management_data.xml to manifest data list
John75SunCity Jun 20, 2025
6bc36b9
Ensure 'installable' and 'application' fields are set to True in __ma…
John75SunCity Jun 20, 2025
9f27d37
Fix formatting in __manifest__.py by removing unnecessary line breaks…
John75SunCity Jun 20, 2025
017bf63
Fix formatting in __manifest__.py by adjusting indentation and ensuri…
John75SunCity Jun 20, 2025
5de1a53
Fix formatting in __manifest__.py by correcting the description strin…
John75SunCity Jun 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "design-themes"]
path = design-themes
url = https://github.com/odoo/design-themes.git
File renamed without changes
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"python.analysis.typeCheckingMode": "basic",
"python.analysis.extraPaths": [
"/workspaces/ssh-git-github.com-odoo-odoo.git-8.0"
]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ It is designed for use in a Dockerized development environment, such as GitHub C

## Project Structure

```
```text
.
├── records_management/
│ ├── __init__.py
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3'
services:
db:
image: postgres:10
Expand All @@ -9,16 +9,16 @@ services:
restart: always

odoo:
image: odoo:8.0
image: odoo:16.0
depends_on:
- db
ports:
- "8069:8069"
volumes:
# Ensure the 'records_management' directory exists at the project root or update the path below to an absolute path if needed
- ./records_management:/mnt/extra-addons/records_management
environment:
- HOST=db
- USER=odoo
- PASSWORD=odoo
restart: always
/mnt/extra-addons/records_management/__manifest__.py
restart: always
# /mnt/extra-addons/records_management/__manifest__.py
34 changes: 34 additions & 0 deletions records_management-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Records Management Odoo Module

## Overview
The Records Management module for Odoo is designed to streamline the management of records related to shredding services and inventory control. This module allows users to create and manage pickup requests, track shredding services, and maintain an organized inventory of stock items.

## Features
- **Pickup Requests**: Users can create and manage pickup requests for items associated with customers.
- **Shredding Services**: Track shredding services provided to customers, including service types and associated charges.
- **Inventory Management**: View and manage inventory items linked to customers, including serial numbers and quantities.
- **Audit Logging**: Maintain a log of actions taken on records for accountability and tracking purposes.

## Installation Instructions
1. **Clone the Repository**: Clone the repository to your local machine.
```
git clone <repository-url>
```
2. **Install Dependencies**: Ensure that you have Odoo installed and running. Install any required Python packages.
3. **Add the Module**: Place the `records_management` directory in your Odoo addons path.
4. **Update the App List**: In the Odoo interface, go to Apps and click on "Update Apps List".
5. **Install the Module**: Search for "Records Management" in the Apps menu and click "Install".

## Usage
- **Creating Pickup Requests**: Navigate to the Pickup Requests menu to create new requests for items.
- **Managing Shredding Services**: Access the Shredding Services menu to log and track shredding activities.
- **Viewing Inventory**: Use the Inventory menu to view and manage stock items associated with customers.

## Security
The module includes security settings to manage access rights for different user groups, ensuring that only authorized personnel can perform sensitive actions.

## JavaScript Functionality
The module integrates JavaScript for enhanced user interaction, including barcode scanning capabilities for quick item identification.

## Support
For any issues or feature requests, please open an issue in the repository or contact the module maintainer.
2 changes: 2 additions & 0 deletions records_management-1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import controllers
26 changes: 26 additions & 0 deletions records_management-1/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Records Management",
"version": "1.0",
"category": "Inventory",
"summary": "Module for managing records and shredding services.",
"description": "This module provides functionalities for managing stock production lots, shredding services, and pickup requests, including customer references and audit logging.",
"author": "Your Name",
"website": "https://yourwebsite.com",
"depends": [
"base",
"stock",
"sale",
"web"
],
"data": [
"security/ir.model.access.csv",
"security/security.xml",
"data/scrm_records_management_data.xml",
"views/scrm_records_management_views.xml",
"views/scrm_records_management_templates.xml",
"views/assets.xml"
],
"installable": true,
"application": false,
"auto_install": false
}
3 changes: 3 additions & 0 deletions records_management-1/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# File: /records_management/records_management/controllers/__init__.py

from . import scrm_records_management_controller
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from odoo import http
from odoo.http import request
from odoo.exceptions import AccessError, ValidationError
from odoo import _

class ScrmRecordsManagementController(http.Controller):

@http.route('/my/inventory', type='http', auth='user', website=True)
def inventory(self, **kw):
partner = request.env.user.partner_id
if not partner:
raise AccessError(_("No partner associated with this user."))

serials = request.env['stock.production.lot'].search([('customer_id', '=', partner.id)])
quants = request.env['stock.quant'].search([('lot_id', 'in', serials.ids), ('location_id.usage', '=', 'internal')])

return request.render('records_management.inventory_template', {'quants': quants})

@http.route('/my/request_pickup', type='http', auth='user', website=True, methods=['GET', 'POST'])
def request_pickup(self, **post):
partner = request.env.user.partner_id
error = None

if request.httprequest.method == 'POST':
try:
raw_ids = request.httprequest.form.getlist('item_ids')
item_ids = [int(id) for id in raw_ids if id.isdigit()]
if not item_ids:
error = _("Please select at least one item for pickup.")
else:
request.env['pickup.request'].sudo().create_pickup_request(partner, item_ids)
return request.redirect('/my/inventory')
except (ValidationError, Exception) as e:
error = str(e)

serials = request.env['stock.production.lot'].search([('customer_id', '=', partner.id)])
return request.render('records_management.pickup_request_form', {
'serials': serials,
'error': error,
'pickup_item_ids_field': 'item_ids',
'partner': partner,
'pickup_request': request.env['pickup.request'].new({
'customer_id': partner.id,
'item_ids': [(6, 0, [])]
}),
})
49 changes: 49 additions & 0 deletions records_management-1/data/scrm_records_management_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<record id="shredding_service_product" model="product.template">
<field name="name">Shredding Service</field>
<field name="type">service</field>
<field name="categ_id" ref="product.product_category_all"/>
<field name="list_price">50.0</field>
<field name="uom_id" ref="product.product_uom_hour"/>
</record>

<record id="shredding_bin_product" model="product.template">
<field name="name">Shredding Bin</field>
<field name="type">product</field>
<field name="categ_id" ref="product.product_category_all"/>
<field name="list_price">100.0</field>
<field name="uom_id" ref="product.product_uom_unit"/>
</record>

<record id="pickup_request_email_template" model="mail.template">
<field name="name">Pickup Request Notification</field>
<field name="model_id" ref="model_pickup_request"/>
<field name="email_from">${(object.customer_id.email or '')|safe}</field>
<field name="subject">Pickup Request Confirmation</field>
<field name="body_html"><![CDATA[
<p>Dear ${object.customer_id.name},</p>
<p>Your pickup request has been successfully created.</p>
<p>Request Date: ${object.request_date}</p>
<p>Items for Pickup: ${object.item_ids.mapped('name')}</p>
<p>Thank you!</p>
]]></field>
</record>

<record id="shredding_service_action" model="ir.actions.server">
<field name="name">Send Pickup Request Email</field>
<field name="model_id" ref="model_pickup_request"/>
<field name="state">code</field>
<field name="code">
action = env['mail.template'].browse(ref('pickup_request_email_template')).send_mail(record.id, force_send=True)
</field>
</record>

<record id="shredding_service_cron" model="ir.cron">
<field name="name">Send Pickup Request Emails</field>
<field name="model_id" ref="model_pickup_request"/>
<field name="state">code</field>
<field name="code">model.send_pickup_request_emails()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
</record>
1 change: 1 addition & 0 deletions records_management-1/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import scrm_records_management
98 changes: 98 additions & 0 deletions records_management-1/models/scrm_records_management.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
"""
Odoo manifest dictionary has been removed from this Python file.
Please place the manifest dictionary in a separate __manifest__.py file as required by Odoo module structure.
"""
from odoo import fields, models, api, _
from odoo.exceptions import ValidationError, AccessError
from odoo import http
from odoo.http import request

# Constant for the pickup request form field name
PICKUP_ITEM_IDS_FIELD = 'item_ids'

class StockProductionLot(models.Model):
_inherit = 'stock.production.lot'

customer_id = fields.Many2one('res.partner', string='Customer')

class ShreddingService(models.Model):
_name = 'shredding.service'
_description = 'Document Shredding Service'

service_date = fields.Date(string='Service Date', default=lambda self: fields.Date.today())
customer_id = fields.Many2one('res.partner', string='Customer', required=True)
service_type = fields.Selection([
('bin', 'Bin Shredding'),
('box', 'Box Shredding')
], string='Service Type', required=True)
bin_ids = fields.Many2many('stock.production.lot', string='Serviced Bins',
domain=[('product_id.name', '=', 'Shredding Bin')])
box_quantity = fields.Integer(string='Number of Boxes', default=0)
shredded_box_ids = fields.Many2many('stock.production.lot', string='Shredded Boxes',
domain=[('customer_id', '!=', False)])
audit_barcodes = fields.Text(string='Audit Barcodes')
total_charge = fields.Float(string='Total Charge', compute='_compute_total_charge')
timestamp = fields.Datetime(string='Service Timestamp', default=lambda self: fields.Datetime.now())
latitude = fields.Float(string='Latitude')
longitude = fields.Float(string='Longitude')
attachment_ids = fields.Many2many('ir.attachment', string='Attachments')
map_display = fields.Char(compute='_compute_map_display', string='Map')

@api.constrains('box_quantity')
def _check_box_quantity(self):
for rec in self:
if rec.service_type == 'box' and (rec.box_quantity is None or rec.box_quantity < 1):
raise ValidationError(_("Box quantity must be a positive integer for box shredding."))

@api.constrains('latitude', 'longitude')
def _check_lat_long(self):
for rec in self:
if rec.latitude and not (-90 <= rec.latitude <= 90):
raise ValidationError(_("Latitude must be between -90 and 90."))
if rec.longitude and not (-180 <= rec.longitude <= 180):
raise ValidationError(_("Longitude must be between -180 and 180."))

@api.depends('service_type', 'bin_ids', 'box_quantity', 'shredded_box_ids')
def _compute_total_charge(self):
for record in self:
if record.service_type == 'bin':
record.total_charge = len(record.bin_ids) * 10.0
else:
qty = record.box_quantity or len(record.shredded_box_ids) or 0
record.total_charge = qty * 5.0

@api.depends('latitude', 'longitude')
def _compute_map_display(self):
for record in self:
record.map_display = f"{record.latitude},{record.longitude}"

class PickupRequest(models.Model):
_name = 'pickup.request'
_description = 'Pickup Request'

customer_id = fields.Many2one('res.partner', string='Customer', required=True)
request_date = fields.Date(string='Request Date', default=fields.Date.today)
state = fields.Selection([
('draft', 'Draft'),
('submitted', 'Submitted'),
('approved', 'Approved'),
('done', 'Done'),
('cancel', 'Cancelled'),
], default='draft', string='Status')
item_ids = fields.Many2many('stock.production.lot', string='Items',
domain="[('customer_id', '=', customer_id)]")

@api.model
def create_pickup_request(self, partner, item_ids):
if not item_ids:
raise ValidationError(_("No items selected for pickup."))
items = self.env['stock.production.lot'].search([
('id', 'in', item_ids),
('customer_id', '=', partner.id)
])
if not items:
raise ValidationError(_("Selected items are invalid or do not belong to you."))
return self.create({
'customer_id': partner.id,
'item_ids': [(6, 0, items.ids)],
})
6 changes: 6 additions & 0 deletions records_management-1/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_pickup_request,access_pickup_request,model_pickup_request,,1,1,1,1
access_shredding_service,access_shredding_service,model_shredding_service,,1,1,1,1
access_stock_production_lot,access_stock_production_lot,model_stock_production_lot,,1,1,1,1
access_inventory_portal,access_inventory_portal,model_inventory_portal,,1,1,1,1
access_audit_log,access_audit_log,model_audit_log,,1,1,1,1
29 changes: 29 additions & 0 deletions records_management-1/security/security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<record id="group_records_manager" model="res.groups">
<field name="name">Records Manager</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>

<record id="group_shredding_technician" model="res.groups">
<field name="name">Shredding Technician</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>

<record id="model_pickup_request_access" model="ir.model.access">
<field name="name">pickup.request access</field>
<field name="model_id" ref="model_pickup_request"/>
<field name="group_id" ref="group_records_manager"/>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_unlink" eval="1"/>
</record>

<record id="model_shredding_service_access" model="ir.model.access">
<field name="name">shredding.service access</field>
<field name="model_id" ref="model_shredding_service"/>
<field name="group_id" ref="group_shredding_technician"/>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_unlink" eval="1"/>
</record>
Loading