Replaced the picking-type default reference (BR-WA/RO/00010) with a date-based monthly-resetting sequence: RO-202605-01, RO-202605-02, ... where YYYY is the year and MM is the zero-padded month. The counter resets to 01 every time the month rolls over. Implementation: - New ir.sequence 'fusion.repair.order.monthly' with prefix 'RO-%(year)s%(month)s-', padding=2, use_date_range=True (Odoo creates one ir.sequence.date_range per month, each with its own number_next) - repair.order.create() override pre-fills vals['name'] with the new sequence BEFORE super(), so Odoo's native picking-type sequence assignment (which only fires when name is empty / 'New') is bypassed Verified on local westin-v19: three back-to-back creates produced RO-202605-01 / -02 / -03. Existing records (pre-upgrade) keep their old BR-WA/RO/##### references - this only affects repairs created from this version onward. Bumped to 19.0.1.0.4. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
2.1 KiB
XML
44 lines
2.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<data noupdate="1">
|
|
<!-- Intake session reference. -->
|
|
<!-- Groups multiple repair.order records created from the same call. -->
|
|
<record id="seq_repair_intake_session" model="ir.sequence">
|
|
<field name="name">Repair Intake Session</field>
|
|
<field name="code">fusion.repair.intake.session</field>
|
|
<field name="prefix">RIS</field>
|
|
<field name="padding">6</field>
|
|
<field name="number_next">1</field>
|
|
<field name="number_increment">1</field>
|
|
<field name="company_id" eval="False"/>
|
|
</record>
|
|
|
|
<!-- Maintenance contract reference -->
|
|
<record id="seq_repair_maintenance_contract" model="ir.sequence">
|
|
<field name="name">Repair Maintenance Contract</field>
|
|
<field name="code">fusion.repair.maintenance.contract</field>
|
|
<field name="prefix">MC/</field>
|
|
<field name="padding">5</field>
|
|
<field name="number_next">1</field>
|
|
<field name="number_increment">1</field>
|
|
<field name="company_id" eval="False"/>
|
|
</record>
|
|
|
|
<!-- Date-based repair.order reference: RO-YYYYMM-NN, counter resets monthly.
|
|
use_date_range=True so Odoo creates an ir.sequence.date_range record
|
|
per month with its own number_next, giving each month a fresh -01.
|
|
%(year)s -> 4-digit year, %(month)s -> zero-padded month (per strftime %m). -->
|
|
<record id="seq_repair_order_monthly" model="ir.sequence">
|
|
<field name="name">Repair Order (RO-YYYYMM-NN)</field>
|
|
<field name="code">fusion.repair.order.monthly</field>
|
|
<field name="prefix">RO-%(year)s%(month)s-</field>
|
|
<field name="suffix"/>
|
|
<field name="padding">2</field>
|
|
<field name="number_next">1</field>
|
|
<field name="number_increment">1</field>
|
|
<field name="use_date_range" eval="True"/>
|
|
<field name="company_id" eval="False"/>
|
|
</record>
|
|
</data>
|
|
</odoo>
|