Files
Odoo-Modules/fusion_plating/fusion_plating_quality/scripts/bt_s12_verify.py
gsinghpal 8c76a16366 chore(plating): de-dash shipped code + intake-neutral customer emails
Replace em-dashes and en-dashes with hyphens across 789 shipped source
files (py/xml/js/scss) so the delivered module reads as human-written;
em-dashes had become a recognizable AI-generated tell. Internal .md dev
notes are excluded. The WO-sticker mojibake strippers keep their dash
search targets (now written — / –). No logic changes: comments
and display strings only; validated with py_compile + lxml parse.

Rewrite the 7 customer notification emails to be intake-neutral
(ship-in / drop-off / pickup) and repair-aware, and fix the Shipped
email documents line (packing slip vs bill of lading; certificate only
when issued). Subjects use a hyphen separator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 00:16:19 -04:00

60 lines
2.1 KiB
Python

# Verify mid-job qty change posts chatter + sync action works.
from odoo import fields
W = env['fp.direct.order.wizard']
Line = env['fp.direct.order.line']
P = env['res.partner']
Part = env['fp.part.catalog']
target = P.browse(2529)
part = Part.search([('x_fc_default_coating_config_id', '!=', False)], limit=1)
w = W.create({
'partner_id': target.id, 'po_pending': True,
'po_number': 'PO-S12V-' + fields.Datetime.now().strftime('%H%M%S'),
'invoice_strategy': 'net_terms',
})
w._onchange_partner_id()
Line.create({
'wizard_id': w.id, 'part_catalog_id': part.id,
'coating_config_id': part.x_fc_default_coating_config_id.id,
'quantity': 5, 'unit_price': 20.0,
})
r = w.action_create_order()
so = env['sale.order'].browse(r['res_id'])
so.action_confirm()
job = env['fp.job'].search([('sale_order_id', '=', so.id)], limit=1)
sol = so.order_line[:1]
job.step_ids.sorted('sequence')[0].button_start()
print(f' Initial: SO={sol.product_uom_qty}, job.qty={job.qty}')
before_msgs = len(job.message_ids)
print()
print(f' Sarah edits SO line qty 5 → 8 mid-job')
sol.product_uom_qty = 8
job.invalidate_recordset()
after_msgs = len(job.message_ids)
print(f' Job chatter: {before_msgs}{after_msgs} (delta {after_msgs - before_msgs})')
warn = job.message_ids.filtered(lambda m: 'qty changed mid-job' in (m.body or ''))
print(f' Warning messages on job: {len(warn)}')
if warn:
print(f' ✓ Chatter warning posted')
print(f' Job.qty still: {job.qty} (unchanged - supervisor must explicitly sync)')
print()
print(f' Bob clicks "Sync qty from SO" on the job')
job.action_sync_qty_from_so()
print(f' Job.qty after sync: {job.qty} (expect 8)')
sync_msgs = job.message_ids.filtered(lambda m: 'synced from SO' in (m.body or ''))
print(f' Sync chatter messages: {len(sync_msgs)}')
print()
# Now what about LOWER qty
print(f' Customer reduces to 3...')
sol.product_uom_qty = 3
job.invalidate_recordset()
warn2 = len(job.message_ids.filtered(lambda m: 'qty changed mid-job' in (m.body or '')))
print(f' Warnings now: {warn2}')
job.action_sync_qty_from_so()
print(f' After sync: job.qty={job.qty}')
env.cr.commit()