diff --git a/__manifest__.py b/__manifest__.py index f5f616f9796444f1113105a95388a389e46d6fff..9063489719fa86ed4b9fa2abbf121156f31302e6 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -19,6 +19,7 @@ "security/ir.model.access.csv", "views/account_invoice.xml", "views/account_payment_term.xml", + "views/account_payment_order.xml", "views/res_config_settings.xml", "views/scop_cotisation_task.xml", ], diff --git a/models/__init__.py b/models/__init__.py index 4db72cbc69a18ad27a782f2a8d50aa64f834eb44..796e1a90e000ad97359e122f24ed12b32c2a0aa0 100755 --- a/models/__init__.py +++ b/models/__init__.py @@ -2,6 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import account_invoice +from . import account_payment_order from . import account_payment_term from . import chart_template from . import res_company diff --git a/models/account_payment_order.py b/models/account_payment_order.py new file mode 100644 index 0000000000000000000000000000000000000000..7b8b4013da03a85f046c21e2aaaa295d7e3bf381 --- /dev/null +++ b/models/account_payment_order.py @@ -0,0 +1,22 @@ +# Copyright 2020 Le Filament +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models, api + + +class ModelName(models.Model): + _inherit = 'account.payment.order' + + attachment_ids = fields.One2many( + comodel_name='ir.attachment', + compute='_compute_attachment_ids' + ) + + @api.multi + def _compute_attachment_ids(self): + Attachment = self.env['ir.attachment'] + for po in self: + po.attachment_ids = Attachment.search([ + ('res_model', '=', 'account.payment.order'), + ('res_id', '=', po.id) + ]) diff --git a/views/account_payment_order.xml b/views/account_payment_order.xml new file mode 100644 index 0000000000000000000000000000000000000000..c04eb59d34b6d6aaaefeacd01f2cbaad23b35cfb --- /dev/null +++ b/views/account_payment_order.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Copyright 2020 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> + <data> + + <record id="account_payment_order_form" model="ir.ui.view"> + <field name="name">account.payment.order.form</field> + <field name="model">account.payment.order</field> + <field name="inherit_id" ref="account_payment_order.account_payment_order_form"/> + <field name="arch" type="xml"> + <xpath expr="//notebook" position="inside"> + <page name="attachments" string="Fichiers de prélèvements"> + <field name="attachment_ids"> + <tree> + <field name="create_date"/> + <field name="name"/> + <field name="type"/> + <field name="datas" filename="datas_fname"/> + <field name="create_uid"/> + </tree> + <form> + <h1><field name="name"/></h1> + <group> + <group> + <field name="datas" filename="datas_fname" attrs="{'invisible':[('type','=','url')]}" string="Télécharger le fichier"/> + <field name="datas_fname" invisible="1" attrs="{'invisible':[('type','=','url')]}" class="oe_inline oe_right"/> + <field name="url" widget="url" attrs="{'invisible':[('type','=','binary')]}"/> + <field name="mimetype" groups="base.group_no_one"/> + <field name="type"/> + </group> + <group> + <field name="create_uid"/> + <field name="create_date"/> + </group> + </group> + </form> + </field> + </page> + </xpath> + </field> + </record> + </data> +</odoo> \ No newline at end of file