This commit is contained in:
gsinghpal
2026-05-22 18:01:31 -04:00
parent d127e19b45
commit f661724c72
34 changed files with 1011 additions and 59 deletions

View File

@@ -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.