changes
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
{
|
||||
'name': 'Fusion Plating — Receiving & Inspection',
|
||||
'version': '19.0.3.25.0',
|
||||
'version': '19.0.3.27.0',
|
||||
'category': 'Manufacturing/Plating',
|
||||
'summary': 'Parts receiving, inspection, damage logging, and manufacturing gate.',
|
||||
'description': """
|
||||
|
||||
@@ -160,14 +160,14 @@ class FusionShipment(models.Model):
|
||||
vals['packing_list_attachment_id'] = (
|
||||
delivery.packing_list_attachment_id.id
|
||||
)
|
||||
# Once a tracking number exists, the parts have been picked
|
||||
# by the carrier (or are about to be) — advance the portal
|
||||
# state to 'shipped' so the customer sees their order is
|
||||
# on its way. The 'delivered' status flips when FedEx
|
||||
# tracking reports the delivery.
|
||||
if self.tracking_number and portal.state in (
|
||||
'received', 'in_progress', 'ready_to_ship',
|
||||
):
|
||||
vals['state'] = 'shipped'
|
||||
if vals:
|
||||
portal.sudo().write(vals)
|
||||
# State is now derived centrally — see
|
||||
# fusion.plating.portal.job._fp_recompute_portal_state. It
|
||||
# only promotes to 'shipped' when every linked WO is done
|
||||
# AND the shipment.status is 'shipped' or 'delivered'. A
|
||||
# FedEx label booked early (tracking number without the
|
||||
# carrier actually picking up) no longer leapfrogs the
|
||||
# shop floor.
|
||||
if hasattr(portal, '_fp_recompute_portal_state'):
|
||||
portal.sudo()._fp_recompute_portal_state()
|
||||
|
||||
@@ -15,12 +15,29 @@ class SaleOrder(models.Model):
|
||||
x_fc_receiving_count = fields.Integer(
|
||||
string='Receiving Count', compute='_compute_receiving_count',
|
||||
)
|
||||
x_fc_show_receive_parts_btn = fields.Boolean(
|
||||
string='Show Receive Parts Button',
|
||||
compute='_compute_show_receive_parts_btn',
|
||||
help='True once the SO is confirmed and there is still at least '
|
||||
'one receiving record that is not yet closed. Hidden again '
|
||||
'when every receiving record has been closed.',
|
||||
)
|
||||
|
||||
@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)
|
||||
|
||||
@api.depends('state', 'x_fc_receiving_ids.state')
|
||||
def _compute_show_receive_parts_btn(self):
|
||||
for rec in self:
|
||||
if rec.state not in ('sale', 'done'):
|
||||
rec.x_fc_show_receive_parts_btn = False
|
||||
continue
|
||||
rec.x_fc_show_receive_parts_btn = any(
|
||||
r.state != 'closed' for r in rec.x_fc_receiving_ids
|
||||
)
|
||||
|
||||
def action_confirm(self):
|
||||
"""Override to auto-create receiving record on SO confirmation.
|
||||
|
||||
|
||||
@@ -76,3 +76,25 @@ $fp-quote-muted : var(--fp-quote-muted, $_fp-quote-muted-hex);
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Receive Parts header button — dark yellow / goldenrod
|
||||
// Applied to the SO-form header action that opens the receiving record(s).
|
||||
// Uses !important to defeat the .o_form_statusbar .btn cascades in both
|
||||
// the light and dark Odoo bundles.
|
||||
// =============================================================================
|
||||
.o_fp_receive_parts_btn,
|
||||
.o_form_statusbar .o_statusbar_buttons .o_fp_receive_parts_btn,
|
||||
button.o_fp_receive_parts_btn {
|
||||
background-color: #b8860b !important;
|
||||
border-color: #9e7700 !important;
|
||||
color: #ffffff !important;
|
||||
|
||||
&:hover, &:focus {
|
||||
background-color: #9e7700 !important;
|
||||
border-color: #7a5b00 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.fa { color: #ffffff !important; }
|
||||
}
|
||||
|
||||
@@ -21,6 +21,21 @@
|
||||
<field name="x_fc_receiving_count" widget="statinfo" string="Receiving"/>
|
||||
</button>
|
||||
</xpath>
|
||||
|
||||
<!-- Receive Parts header action — appears after SO confirmation
|
||||
while at least one receiving record is still open, and
|
||||
disappears once every receiving record is closed. Reuses
|
||||
the existing action_view_receiving method so a single
|
||||
receiving opens directly while multiples land on the list. -->
|
||||
<xpath expr="//header" position="inside">
|
||||
<field name="x_fc_show_receive_parts_btn" invisible="1"/>
|
||||
<button name="action_view_receiving"
|
||||
string="Receive Parts" type="object"
|
||||
class="btn o_fp_receive_parts_btn"
|
||||
icon="fa-archive"
|
||||
invisible="not x_fc_show_receive_parts_btn"
|
||||
help="Open the receiving record(s) for this order. Hidden automatically once all receiving records are closed."/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user