Compare commits

...

3 Commits

Author SHA1 Message Date
gsinghpal
d13517071c feat(receiving): SO auto-create + MRP soft gate + menu structure
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 19:24:54 -04:00
gsinghpal
6a368993bf feat(receiving): fp.receiving model with state machine and views
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 19:22:22 -04:00
gsinghpal
d06b9fd522 feat(receiving): module scaffold + fp.receiving.damage + fp.receiving.line models
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 19:18:57 -04:00
15 changed files with 698 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
from . import models

View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
{
'name': 'Fusion Plating — Receiving & Inspection',
'version': '19.0.1.0.0',
'category': 'Manufacturing/Plating',
'summary': 'Parts receiving, inspection, damage logging, and manufacturing gate.',
'description': """
Fusion Plating — Receiving & Inspection
=========================================
Part of the Fusion Plating product family by Nexa Systems Inc.
Provides:
- Parts receiving records linked to sale orders
- Quantity verification and condition inspection
- Damage logging with photos and severity tracking
- Auto-creation of receiving records on SO confirmation
- Soft manufacturing gate (warns if parts not received)
""",
'author': 'Nexa Systems Inc.',
'website': 'https://www.nexasystems.ca',
'maintainer': 'Nexa Systems Inc.',
'support': 'support@nexasystems.ca',
'license': 'OPL-1',
'price': 0.00,
'currency': 'CAD',
'depends': [
'fusion_plating_configurator',
'sale_management',
'mrp',
],
'data': [
'security/fp_receiving_security.xml',
'security/ir.model.access.csv',
'data/fp_receiving_sequence_data.xml',
'views/fp_receiving_views.xml',
'views/sale_order_views.xml',
'views/fp_receiving_menu.xml',
],
'installable': True,
'application': False,
'auto_install': False,
}

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Plating product family.
-->
<odoo noupdate="1">
<record id="seq_fp_receiving" model="ir.sequence">
<field name="name">Fusion Plating: Receiving</field>
<field name="code">fp.receiving</field>
<field name="prefix">RCV-</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
</record>
</odoo>

View File

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
from . import fp_receiving_damage
from . import fp_receiving_line
from . import fp_receiving
from . import sale_order
from . import mrp_production

View File

@@ -0,0 +1,150 @@
# -*- 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, _
from odoo.exceptions import UserError
class FpReceiving(models.Model):
"""Parts receiving record.
Created automatically when a sale order is confirmed. Tracks
quantity verification, condition inspection, and damage logging
for customer parts arriving at the shop.
"""
_name = 'fp.receiving'
_description = 'Fusion Plating — Receiving'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'received_date desc, id desc'
name = fields.Char(string='Reference', readonly=True, copy=False, default='New')
sale_order_id = fields.Many2one(
'sale.order', string='Sale Order', required=True, ondelete='restrict',
tracking=True,
)
partner_id = fields.Many2one(
'res.partner', string='Customer', related='sale_order_id.partner_id',
store=True, readonly=True,
)
po_number = fields.Char(
string='Customer PO #', related='sale_order_id.x_fc_po_number',
store=True, readonly=True,
)
received_by_id = fields.Many2one(
'res.users', string='Received By', default=lambda self: self.env.user,
tracking=True,
)
received_date = fields.Datetime(
string='Received Date', default=fields.Datetime.now, tracking=True,
)
state = fields.Selection(
[
('draft', 'Awaiting Parts'),
('inspecting', 'Inspecting'),
('accepted', 'Accepted'),
('discrepancy', 'Discrepancy'),
('resolved', 'Resolved'),
],
string='Status', default='draft', tracking=True, required=True,
)
expected_qty = fields.Integer(string='Expected Qty', help='Total quantity expected from the sale order.')
received_qty = fields.Integer(string='Received Qty', help='Total quantity actually received.')
qty_match = fields.Boolean(
string='Qty Match', compute='_compute_qty_match', store=True,
)
carrier_name = fields.Char(string='Carrier', help='Who delivered the parts (Purolator, customer drop-off, etc.).')
carrier_tracking = fields.Char(string='Inbound Tracking #')
notes = fields.Html(string='Notes')
line_ids = fields.One2many('fp.receiving.line', 'receiving_id', string='Receiving Lines')
damage_ids = fields.One2many('fp.receiving.damage', 'receiving_id', string='Damage Log')
damage_count = fields.Integer(string='Damage Count', compute='_compute_damage_count')
unresolved_damage_count = fields.Integer(
string='Unresolved Damage', compute='_compute_damage_count',
)
attachment_ids = fields.Many2many(
'ir.attachment', 'fp_receiving_attachment_rel', 'receiving_id', 'attachment_id',
string='Photos / Documents',
)
@api.depends('expected_qty', 'received_qty')
def _compute_qty_match(self):
for rec in self:
rec.qty_match = rec.expected_qty > 0 and rec.received_qty == rec.expected_qty
@api.depends('damage_ids', 'damage_ids.resolved')
def _compute_damage_count(self):
for rec in self:
rec.damage_count = len(rec.damage_ids)
rec.unresolved_damage_count = len(rec.damage_ids.filtered(lambda d: not d.resolved))
# -------------------------------------------------------------------------
# Sequence
# -------------------------------------------------------------------------
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get('name', 'New') == 'New':
vals['name'] = self.env['ir.sequence'].next_by_code('fp.receiving') or 'New'
return super().create(vals_list)
# -------------------------------------------------------------------------
# State actions
# -------------------------------------------------------------------------
def action_start_inspection(self):
"""Move from draft to inspecting."""
for rec in self:
if rec.state != 'draft':
raise UserError(_('Only draft records can start inspection.'))
rec.state = 'inspecting'
rec.received_by_id = self.env.user
rec.received_date = fields.Datetime.now()
def action_accept(self):
"""Accept the receiving — parts match and condition is OK."""
for rec in self:
if rec.state not in ('inspecting', 'resolved'):
raise UserError(_('Can only accept from Inspecting or Resolved state.'))
if rec.unresolved_damage_count > 0:
raise UserError(_('Cannot accept — there are %d unresolved damage entries.') % rec.unresolved_damage_count)
rec.state = 'accepted'
rec._update_so_receiving_status()
rec.message_post(body=_('Parts accepted — quantity: %d, all checks passed.') % rec.received_qty)
def action_flag_discrepancy(self):
"""Flag a discrepancy — qty mismatch or damage found."""
for rec in self:
if rec.state != 'inspecting':
raise UserError(_('Can only flag discrepancy from Inspecting state.'))
rec.state = 'discrepancy'
rec._update_so_receiving_status()
# Create follow-up activity for the sales team
rec.activity_schedule(
'mail.mail_activity_data_todo',
summary=_('Receiving discrepancy — %s') % rec.name,
note=_('Qty expected: %d, received: %d. Check damage log for details.') % (
rec.expected_qty, rec.received_qty),
)
rec.message_post(body=_('Discrepancy flagged — follow-up required.'))
def action_resolve(self):
"""Resolve a discrepancy after customer follow-up."""
for rec in self:
if rec.state != 'discrepancy':
raise UserError(_('Can only resolve from Discrepancy state.'))
rec.state = 'resolved'
rec._update_so_receiving_status()
rec.message_post(body=_('Discrepancy resolved.'))
def _update_so_receiving_status(self):
"""Update the linked sale order's receiving status."""
for rec in self:
if rec.sale_order_id:
if rec.state in ('accepted', 'resolved'):
rec.sale_order_id.x_fc_receiving_status = 'received'
elif rec.state == 'discrepancy':
rec.sale_order_id.x_fc_receiving_status = 'partial'
elif rec.state == 'inspecting':
rec.sale_order_id.x_fc_receiving_status = 'partial'

View File

@@ -0,0 +1,38 @@
# -*- 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 fields, models
class FpReceivingDamage(models.Model):
"""Damage log entry on a receiving record.
Documents condition issues found during parts inspection:
severity, photos, required action, and customer follow-up.
"""
_name = 'fp.receiving.damage'
_description = 'Fusion Plating — Receiving Damage'
_order = 'id'
receiving_id = fields.Many2one(
'fp.receiving', string='Receiving', required=True, ondelete='cascade',
)
description = fields.Text(string='Description', required=True, help='What is damaged.')
severity = fields.Selection(
[('cosmetic', 'Cosmetic'), ('functional', 'Functional'), ('rejected', 'Rejected')],
string='Severity', required=True, default='cosmetic',
)
photo_ids = fields.Many2many(
'ir.attachment', 'fp_receiving_damage_photo_rel', 'damage_id', 'attachment_id',
string='Photos',
)
action_required = fields.Selection(
[('none', 'None'), ('notify_customer', 'Notify Customer'),
('return_parts', 'Return Parts'), ('proceed_as_is', 'Proceed As-Is')],
string='Action Required', default='none',
)
customer_notified = fields.Boolean(string='Customer Notified')
customer_response = fields.Text(string='Customer Response')
resolved = fields.Boolean(string='Resolved')

View File

@@ -0,0 +1,33 @@
# -*- 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 fields, models
class FpReceivingLine(models.Model):
"""Per-part-number receiving detail line.
Tracks expected vs received quantity and condition for each
distinct part number in the receiving record.
"""
_name = 'fp.receiving.line'
_description = 'Fusion Plating — Receiving Line'
_order = 'id'
receiving_id = fields.Many2one(
'fp.receiving', string='Receiving', required=True, ondelete='cascade',
)
part_catalog_id = fields.Many2one(
'fp.part.catalog', string='Part (Catalog)',
)
part_number = fields.Char(string='Part Number')
description = fields.Char(string='Description')
expected_qty = fields.Integer(string='Expected Qty')
received_qty = fields.Integer(string='Received Qty')
condition = fields.Selection(
[('good', 'Good'), ('damaged', 'Damaged'), ('mixed', 'Mixed')],
string='Condition', default='good',
)
notes = fields.Text(string='Notes')

View File

@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
import logging
from odoo import models, _
_logger = logging.getLogger(__name__)
class MrpProduction(models.Model):
_inherit = 'mrp.production'
def action_confirm(self):
"""Soft gate: warn if parts haven't been received yet.
Checks the linked sale order's receiving status. If parts
are not yet received, logs a warning. This is informational
only -- it does not block confirmation. The gate is soft
because handshake deals and urgent jobs need flexibility.
"""
for production in self:
so = production._get_source_sale_order()
if so and so.x_fc_receiving_status in ('not_received', False):
_logger.warning(
'MO %s: parts not yet received for SO %s (receiving status: %s). '
'Proceeding with confirmation.',
production.name, so.name, so.x_fc_receiving_status,
)
production.message_post(
body=_(
'Warning: Parts not yet received for sale order '
'<a href="/odoo/sale-order/%s">%s</a>. '
'Manufacturing confirmed without receiving verification.'
) % (so.id, so.name),
)
return super().action_confirm()
def _get_source_sale_order(self):
"""Find the sale order linked to this MO via origin field."""
self.ensure_one()
if not self.origin:
return False
# origin may contain SO name like "S00001" or configurator ref "CFG-00001"
so = self.env['sale.order'].search(
[('name', '=', self.origin)], limit=1,
)
if not so:
# Try matching by origin containing the SO name
so = self.env['sale.order'].search(
[('name', 'ilike', self.origin)], limit=1,
)
return so or False

View File

@@ -0,0 +1,63 @@
# -*- 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 SaleOrder(models.Model):
_inherit = 'sale.order'
x_fc_receiving_ids = fields.One2many(
'fp.receiving', 'sale_order_id', string='Receiving Records',
)
x_fc_receiving_count = fields.Integer(
string='Receiving Count', compute='_compute_receiving_count',
)
@api.depends('x_fc_receiving_ids')
def _compute_receiving_count(self):
for rec in self:
rec.x_fc_receiving_count = len(rec.x_fc_receiving_ids)
def action_confirm(self):
"""Override to auto-create receiving record on SO confirmation."""
res = super().action_confirm()
for order in self:
# Only create if no receiving record exists yet
if not order.x_fc_receiving_ids:
total_qty = sum(order.order_line.mapped('product_uom_qty'))
receiving_vals = {
'sale_order_id': order.id,
'expected_qty': int(total_qty),
'line_ids': [],
}
# Auto-create lines from SO lines
for line in order.order_line:
receiving_vals['line_ids'].append((0, 0, {
'part_number': order.x_fc_part_catalog_id.part_number if order.x_fc_part_catalog_id else '',
'description': line.name or '',
'expected_qty': int(line.product_uom_qty),
}))
self.env['fp.receiving'].create(receiving_vals)
return res
def action_view_receiving(self):
"""Smart button action to view receiving records."""
self.ensure_one()
if self.x_fc_receiving_count == 1:
return {
'type': 'ir.actions.act_window',
'res_model': 'fp.receiving',
'res_id': self.x_fc_receiving_ids[0].id,
'view_mode': 'form',
'target': 'current',
}
return {
'type': 'ir.actions.act_window',
'res_model': 'fp.receiving',
'view_mode': 'list,form',
'domain': [('sale_order_id', '=', self.id)],
'target': 'current',
}

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Plating product family.
-->
<odoo>
<record id="group_fp_receiving" model="res.groups">
<field name="name">Receiving</field>
<field name="sequence">55</field>
<field name="privilege_id" ref="fusion_plating.res_groups_privilege_fusion_plating"/>
<field name="implied_ids" eval="[(4, ref('fusion_plating.group_fusion_plating_operator'))]"/>
<field name="user_ids" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>
</odoo>

View File

@@ -0,0 +1,10 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_fp_receiving_operator,fp.receiving.operator,model_fp_receiving,fusion_plating.group_fusion_plating_operator,1,0,0,0
access_fp_receiving_receiver,fp.receiving.receiver,model_fp_receiving,group_fp_receiving,1,1,1,0
access_fp_receiving_manager,fp.receiving.manager,model_fp_receiving,fusion_plating.group_fusion_plating_manager,1,1,1,1
access_fp_receiving_line_operator,fp.receiving.line.operator,model_fp_receiving_line,fusion_plating.group_fusion_plating_operator,1,0,0,0
access_fp_receiving_line_receiver,fp.receiving.line.receiver,model_fp_receiving_line,group_fp_receiving,1,1,1,0
access_fp_receiving_line_manager,fp.receiving.line.manager,model_fp_receiving_line,fusion_plating.group_fusion_plating_manager,1,1,1,1
access_fp_receiving_damage_operator,fp.receiving.damage.operator,model_fp_receiving_damage,fusion_plating.group_fusion_plating_operator,1,0,0,0
access_fp_receiving_damage_receiver,fp.receiving.damage.receiver,model_fp_receiving_damage,group_fp_receiving,1,1,1,0
access_fp_receiving_damage_manager,fp.receiving.damage.manager,model_fp_receiving_damage,fusion_plating.group_fusion_plating_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_fp_receiving_operator fp.receiving.operator model_fp_receiving fusion_plating.group_fusion_plating_operator 1 0 0 0
3 access_fp_receiving_receiver fp.receiving.receiver model_fp_receiving group_fp_receiving 1 1 1 0
4 access_fp_receiving_manager fp.receiving.manager model_fp_receiving fusion_plating.group_fusion_plating_manager 1 1 1 1
5 access_fp_receiving_line_operator fp.receiving.line.operator model_fp_receiving_line fusion_plating.group_fusion_plating_operator 1 0 0 0
6 access_fp_receiving_line_receiver fp.receiving.line.receiver model_fp_receiving_line group_fp_receiving 1 1 1 0
7 access_fp_receiving_line_manager fp.receiving.line.manager model_fp_receiving_line fusion_plating.group_fusion_plating_manager 1 1 1 1
8 access_fp_receiving_damage_operator fp.receiving.damage.operator model_fp_receiving_damage fusion_plating.group_fusion_plating_operator 1 0 0 0
9 access_fp_receiving_damage_receiver fp.receiving.damage.receiver model_fp_receiving_damage group_fp_receiving 1 1 1 0
10 access_fp_receiving_damage_manager fp.receiving.damage.manager model_fp_receiving_damage fusion_plating.group_fusion_plating_manager 1 1 1 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Plating product family.
-->
<odoo>
<!-- ===== Window actions (defined BEFORE menus) ===== -->
<record id="action_fp_receiving_pending" model="ir.actions.act_window">
<field name="name">Pending Inspection</field>
<field name="res_model">fp.receiving</field>
<field name="view_mode">list,form</field>
<field name="domain">[('state', '=', 'draft')]</field>
</record>
<record id="action_fp_receiving_discrepancy" model="ir.actions.act_window">
<field name="name">Discrepancies</field>
<field name="res_model">fp.receiving</field>
<field name="view_mode">list,form</field>
<field name="domain">[('state', '=', 'discrepancy')]</field>
</record>
<!-- ===== RECEIVING & INSPECTION submenu ===== -->
<menuitem id="menu_fp_receiving_root"
name="Receiving &amp; Inspection"
parent="fusion_plating.menu_fp_root"
sequence="5"
groups="group_fp_receiving"/>
<menuitem id="menu_fp_receiving_all"
name="All Receiving"
parent="menu_fp_receiving_root"
action="action_fp_receiving"
sequence="10"/>
<menuitem id="menu_fp_receiving_pending"
name="Pending Inspection"
parent="menu_fp_receiving_root"
action="action_fp_receiving_pending"
sequence="20"/>
<menuitem id="menu_fp_receiving_discrepancy"
name="Discrepancies"
parent="menu_fp_receiving_root"
action="action_fp_receiving_discrepancy"
sequence="30"/>
</odoo>

View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Plating product family.
-->
<odoo>
<!-- ===== Receiving List View ===== -->
<record id="view_fp_receiving_list" model="ir.ui.view">
<field name="name">fp.receiving.list</field>
<field name="model">fp.receiving</field>
<field name="arch" type="xml">
<list string="Receiving"
decoration-warning="state == 'discrepancy'"
decoration-success="state == 'accepted'"
decoration-muted="state == 'resolved'"
default_order="received_date desc">
<field name="received_date"/>
<field name="name"/>
<field name="sale_order_id"/>
<field name="partner_id"/>
<field name="po_number"/>
<field name="expected_qty"/>
<field name="received_qty"/>
<field name="qty_match" widget="boolean"/>
<field name="state" widget="badge"
decoration-info="state == 'draft'"
decoration-warning="state in ('inspecting', 'discrepancy')"
decoration-success="state == 'accepted'"
decoration-muted="state == 'resolved'"/>
</list>
</field>
</record>
<!-- ===== Receiving Form View ===== -->
<record id="view_fp_receiving_form" model="ir.ui.view">
<field name="name">fp.receiving.form</field>
<field name="model">fp.receiving</field>
<field name="arch" type="xml">
<form string="Receiving">
<header>
<button name="action_start_inspection"
string="Start Inspection"
type="object"
invisible="state != 'draft'"/>
<button name="action_accept"
string="Accept"
type="object"
class="btn-primary"
invisible="state not in ('inspecting', 'resolved')"/>
<button name="action_flag_discrepancy"
string="Flag Discrepancy"
type="object"
class="btn-danger"
invisible="state != 'inspecting'"/>
<button name="action_resolve"
string="Resolve"
type="object"
invisible="state != 'discrepancy'"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,inspecting,accepted"/>
</header>
<sheet>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="sale_order_id"/>
<field name="partner_id"/>
<field name="po_number"/>
</group>
</group>
<group>
<group string="Reception">
<field name="received_by_id"/>
<field name="received_date"/>
<field name="carrier_name"/>
<field name="carrier_tracking"/>
</group>
<group string="Quantities">
<field name="expected_qty"/>
<field name="received_qty"/>
<field name="qty_match" widget="boolean_toggle" readonly="1"/>
</group>
</group>
<notebook>
<page string="Receiving Lines" name="lines">
<field name="line_ids">
<list editable="bottom">
<field name="part_number"/>
<field name="description"/>
<field name="expected_qty"/>
<field name="received_qty"/>
<field name="condition"/>
<field name="notes"/>
</list>
</field>
</page>
<page string="Damage Log" name="damage">
<field name="damage_ids">
<list editable="bottom">
<field name="description"/>
<field name="severity" widget="badge"
decoration-info="severity == 'cosmetic'"
decoration-warning="severity == 'functional'"
decoration-danger="severity == 'rejected'"/>
<field name="action_required"/>
<field name="customer_notified"/>
<field name="resolved"/>
</list>
</field>
</page>
<page string="Photos" name="photos">
<field name="attachment_ids" widget="many2many_binary"/>
</page>
<page string="Notes" name="notes">
<field name="notes"
placeholder="Internal notes about this receiving..."/>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
<!-- ===== Receiving Search View ===== -->
<record id="view_fp_receiving_search" model="ir.ui.view">
<field name="name">fp.receiving.search</field>
<field name="model">fp.receiving</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="sale_order_id"/>
<field name="partner_id"/>
<field name="po_number"/>
<separator/>
<filter string="Awaiting Parts" name="draft" domain="[('state', '=', 'draft')]"/>
<filter string="Inspecting" name="inspecting" domain="[('state', '=', 'inspecting')]"/>
<filter string="Discrepancy" name="discrepancy" domain="[('state', '=', 'discrepancy')]"/>
<filter string="Accepted" name="accepted" domain="[('state', '=', 'accepted')]"/>
<group>
<filter string="Customer" name="group_customer" context="{'group_by': 'partner_id'}"/>
<filter string="Status" name="group_state" context="{'group_by': 'state'}"/>
<filter string="Received Date" name="group_received_date" context="{'group_by': 'received_date:month'}"/>
</group>
</search>
</field>
</record>
<!-- ===== Window Action ===== -->
<record id="action_fp_receiving" model="ir.actions.act_window">
<field name="name">Receiving</field>
<field name="res_model">fp.receiving</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="view_fp_receiving_search"/>
<field name="context">{'search_default_draft': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No receiving records yet
</p>
<p>
Receiving records are created automatically when a sale order is
confirmed. They track quantity verification, condition inspection,
and damage logging for customer parts arriving at the shop.
</p>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Plating product family.
-->
<odoo>
<!-- ===== Smart button: Receiving on SO form ===== -->
<record id="view_sale_order_form_receiving" model="ir.ui.view">
<field name="name">sale.order.form.fp.receiving</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button name="action_view_receiving" type="object"
class="oe_stat_button" icon="fa-truck"
invisible="x_fc_receiving_count == 0">
<field name="x_fc_receiving_count" widget="statinfo" string="Receiving"/>
</button>
</xpath>
</field>
</record>
</odoo>