Replaces Enterprise's documents_account with a Fusion-native bridge. When a PDF/image lands in the Documents app, users can convert it into a draft vendor bill via a wizard that copies the document's binary onto the new account.move and posts a chatter note linking back to the source document. Adds: - documents.document.move_id (Many2one to the linked invoice) - documents.document.is_invoice_candidate (computed; True for unlinked PDF/image binaries) - documents.document.action_create_invoice() opens the wizard - account.move.source_document_ids reverse linkage + statinfo button - fusion.create.invoice.from.document.wizard (TransientModel + form) - ir.actions.server bound to documents.document so the workflow appears in the kanban/list Actions menu (the Documents app has no regular form view to inherit from in v19) The wizard: - defaults to the company's first purchase journal - supports vendor bill or vendor credit note - copies the source attachment onto the new move - posts a chatter note linking back - marks the document linked so it stops appearing as a candidate Auto-installs when documents + fusion_accounting_core are both present. 8 unit tests cover the candidate flag, wizard happy path, attachment copy, reverse linkage, already-linked guard, non-PDF guard, and credit-note creation. Made-with: Cursor
38 lines
1.6 KiB
XML
38 lines
1.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<record id="view_create_invoice_from_document_wizard_form" model="ir.ui.view">
|
|
<field name="name">fusion.create.invoice.from.document.wizard.form</field>
|
|
<field name="model">fusion.create.invoice.from.document.wizard</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Create Invoice from Document">
|
|
<sheet>
|
|
<group>
|
|
<field name="document_id" invisible="1"/>
|
|
<field name="document_name" readonly="1"/>
|
|
<field name="document_mimetype" readonly="1"/>
|
|
</group>
|
|
<group>
|
|
<field name="move_type"/>
|
|
<field name="partner_id" options="{'no_create': True}"/>
|
|
<field name="company_id"
|
|
groups="base.group_multi_company"
|
|
options="{'no_create': True}"/>
|
|
<field name="journal_id" options="{'no_create': True}"/>
|
|
</group>
|
|
</sheet>
|
|
<footer>
|
|
<button name="action_create_invoice"
|
|
string="Create Invoice"
|
|
type="object"
|
|
class="btn-primary"
|
|
data-hotkey="q"/>
|
|
<button string="Cancel"
|
|
class="btn-secondary"
|
|
special="cancel"
|
|
data-hotkey="x"/>
|
|
</footer>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
</odoo>
|