77 lines
2.0 KiB
Python
77 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2026 Nexa Systems Inc.
|
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
|
# Part of the Fusion Plating product family.
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class FpProofOfDelivery(models.Model):
|
|
"""Proof of delivery record — captured at the delivery point.
|
|
|
|
Captures:
|
|
* recipient name
|
|
* recipient signature (binary image)
|
|
* photos of the delivered load
|
|
* GPS coordinates at time of capture
|
|
* delivery timestamp
|
|
|
|
A POD is typically created via the delivery's "Create POD" action,
|
|
which pre-fills the delivery_id and timestamps the record.
|
|
"""
|
|
_name = 'fusion.plating.proof.of.delivery'
|
|
_description = 'Fusion Plating — Proof of Delivery'
|
|
_order = 'delivered_at desc, id desc'
|
|
|
|
name = fields.Char(
|
|
string='Reference',
|
|
required=True,
|
|
copy=False,
|
|
default=lambda self: self._default_name(),
|
|
)
|
|
delivery_id = fields.Many2one(
|
|
'fusion.plating.delivery',
|
|
string='Delivery',
|
|
ondelete='cascade',
|
|
)
|
|
partner_id = fields.Many2one(
|
|
'res.partner',
|
|
related='delivery_id.partner_id',
|
|
store=True,
|
|
readonly=True,
|
|
)
|
|
recipient_name = fields.Char(
|
|
string='Recipient Name',
|
|
)
|
|
recipient_signature = fields.Binary(
|
|
string='Signature',
|
|
attachment=True,
|
|
)
|
|
delivered_at = fields.Datetime(
|
|
string='Delivered At',
|
|
default=fields.Datetime.now,
|
|
)
|
|
photo_ids = fields.Many2many(
|
|
'ir.attachment',
|
|
'fp_pod_photo_rel',
|
|
'pod_id',
|
|
'attachment_id',
|
|
string='Photos',
|
|
)
|
|
notes = fields.Text(
|
|
string='Notes',
|
|
)
|
|
gps_lat = fields.Float(
|
|
string='GPS Latitude',
|
|
digits=(9, 6),
|
|
)
|
|
gps_lon = fields.Float(
|
|
string='GPS Longitude',
|
|
digits=(9, 6),
|
|
)
|
|
|
|
@api.model
|
|
def _default_name(self):
|
|
seq = self.env['ir.sequence'].next_by_code('fusion.plating.proof.of.delivery')
|
|
return seq or '/'
|