[NEW] invoice_sale_order_note

This commit is contained in:
clementthomas
2024-09-26 13:30:01 +02:00
parent e5c26a7ebd
commit a66e6a2427
9 changed files with 154 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

View File

@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-
{
"name": "Invoice and sale order note",
"category": "Account",
"version": "16.0.1.0",
"summary": "Add note in sale orders and invoices document",
"author": "Elabore",
"website": "https://elabore.coop/",
"installable": True,
"application": False,
"auto_install": False,
"description": """
==========================================
Invoice and sale order note
==========================================
Add note field in invoices and sale order
Display this field in generated documents
Copy note field when invoice created from sale order
Installation
============
Just install invoice_sale_order_note, all dependencies will be installed by default.
Known issues / Roadmap
======================
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/elabore-coop/.../issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
* Coopérative Tiers-Lieux
Maintainer
----------
This module is maintained by ELABORE.
""",
"depends": [
"base",
"account",
"sale",
],
"data": [
"views/sale_views.xml",
"views/account_move_views.xml",
"views/account_invoice_report.xml",
"views/sale_order_report.xml",
],
"qweb": [],
}

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import account_move
from . import sale

View File

@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class AccountMove(models.Model):
_inherit = 'account.move'
report_note = fields.Html("Note")

View File

@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
from odoo.addons.sale.models.sale_order import LOCKED_FIELD_STATES
class SaleOrder(models.Model):
_inherit = "sale.order"
report_note = fields.Html("Note", states=LOCKED_FIELD_STATES,)
def _prepare_invoice(self):
res = super(SaleOrder, self)._prepare_invoice()
res["report_note"] = self.report_note
return res

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//table[@name='invoice_line_table']" position="before">
<div t-field="o.report_note"></div>
</xpath>
</template>
</odoo>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_move_form_invoice_sale_order_note" model="ir.ui.view">
<field name="name">account.move.form.invoice.sale.order.note</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page name="note" string="Notes">
<field name="report_note" nolabel="1" colspan="2" attrs="{'readonly': [('state', '!=', 'draft')]}" />
</page>
</notebook>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_saleorder_document" inherit_id="sale.report_saleorder_document">
<xpath expr="//tbody" position="before">
<div t-field="o.report_note"></div>
</xpath>
</template>
</odoo>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_order_form_invoice_sale_order_note" model="ir.ui.view">
<field name="name">view.order.form.invoice0sale.order.note</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<notebook position="inside">
<page name="note" string="Notes">
<field name="report_note" nolabel="1" colspan="2" />
</page>
</notebook>
</field>
</record>
</odoo>