fusion.billing.import.wizard backfills NexaCloud into Odoo: read-only psycopg2 reader (_read_nexacloud_rows, DSN from ir.config_parameter) split from pure-Odoo writes (_import_rows/_do_import) so the logic is unit-tested headless. Maps users→partners+links (reusing _resolve_or_create_partner, stashing stripe_customer_id), plans→a cpu_seconds charge catalog (included_quota=cpu_seconds_quota, unit_batch=3600, $0.0075/core-hour, plan_id NULL), and deployments→one DRAFT shadow sale.order per deployment with the flat price set explicitly. Shadow-safe by construction: draft + no payment token + charge plan_id NULL (rating cron is a no-op). Idempotent re-runs; per-row savepoints isolate bad rows; dry-run rolls back. 11 tests, 50/50 green on odoo-trial.
37 lines
1.6 KiB
XML
37 lines
1.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<record id="view_fusion_billing_import_wizard_form" model="ir.ui.view">
|
|
<field name="name">fusion.billing.import.wizard.form</field>
|
|
<field name="model">fusion.billing.import.wizard</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Import from NexaCloud">
|
|
<group>
|
|
<field name="dry_run"/>
|
|
</group>
|
|
<group string="Result" invisible="not result_summary">
|
|
<field name="result_summary" nolabel="1" widget="text"/>
|
|
</group>
|
|
<footer>
|
|
<button name="action_run_import" type="object" string="Run Import"
|
|
class="btn-primary"/>
|
|
<button string="Close" class="btn-secondary" special="cancel"/>
|
|
</footer>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="action_fusion_billing_import_wizard" model="ir.actions.act_window">
|
|
<field name="name">Import from NexaCloud</field>
|
|
<field name="res_model">fusion.billing.import.wizard</field>
|
|
<field name="view_mode">form</field>
|
|
<field name="target">new</field>
|
|
</record>
|
|
|
|
<menuitem id="menu_fusion_billing_root" name="Fusion Billing"
|
|
parent="account.menu_finance" sequence="90"/>
|
|
<menuitem id="menu_fusion_billing_import" name="Import from NexaCloud"
|
|
parent="menu_fusion_billing_root"
|
|
action="action_fusion_billing_import_wizard" sequence="10"
|
|
groups="base.group_system"/>
|
|
</odoo>
|