Skip to content
Extraits de code Groupes Projets
Valider 86d7b951 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[add] total payment and bank lines on payment order + action to modify payment lines

parent c2189b8e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"views/account_invoice.xml", "views/account_invoice.xml",
"views/account_payment_term.xml", "views/account_payment_term.xml",
"views/account_payment_order.xml", "views/account_payment_order.xml",
"views/account_payment_line.xml",
"views/res_config_settings.xml", "views/res_config_settings.xml",
"views/res_partner.xml", "views/res_partner.xml",
"views/scop_cotisation_task.xml", "views/scop_cotisation_task.xml",
......
...@@ -7,11 +7,36 @@ from odoo import fields, models, api ...@@ -7,11 +7,36 @@ from odoo import fields, models, api
class ModelName(models.Model): class ModelName(models.Model):
_inherit = 'account.payment.order' _inherit = 'account.payment.order'
payment_line_amount = fields.Float(
string='Total Transactions',
compute='_compute_payment_line_amount'
)
bank_line_amount = fields.Float(
string='Total Lignes de paiement',
compute='_compute_bank_line_amount'
)
attachment_ids = fields.One2many( attachment_ids = fields.One2many(
comodel_name='ir.attachment', comodel_name='ir.attachment',
compute='_compute_attachment_ids' compute='_compute_attachment_ids'
) )
# ------------------------------------------------------
# Compute fields
# ------------------------------------------------------
@api.multi
def _compute_payment_line_amount(self):
for po in self:
po.payment_line_amount = sum(
po.payment_line_ids.mapped('amount_currency')
)
@api.multi
def _compute_bank_line_amount(self):
for po in self:
po.bank_line_amount = sum(
po.bank_line_ids.mapped('amount_currency')
)
@api.multi @api.multi
def _compute_attachment_ids(self): def _compute_attachment_ids(self):
Attachment = self.env['ir.attachment'] Attachment = self.env['ir.attachment']
...@@ -20,3 +45,20 @@ class ModelName(models.Model): ...@@ -20,3 +45,20 @@ class ModelName(models.Model):
('res_model', '=', 'account.payment.order'), ('res_model', '=', 'account.payment.order'),
('res_id', '=', po.id) ('res_id', '=', po.id)
]) ])
# ------------------------------------------------------
# Button function
# ------------------------------------------------------
def view_payment_line(self):
tree_id = self.env.ref(
'cgscop_cotisation.scop_account_payment_line_tree').id
search_id = self.env.ref(
'cgscop_cotisation.scop_account_payment_line_search').id
return {
'type': 'ir.actions.act_window',
'name': 'Lignes dde transaction',
'res_model': 'account.payment.line',
'views': [[tree_id, 'tree']],
'search_view_id': [search_id, 'search'],
'domain': [['order_id', '=', self.id]],
}
\ No newline at end of file
<?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>
<!-- Tree View -->
<record id="scop_account_payment_line_tree" model="ir.ui.view">
<field name="name">scop.account.payment.line.tree</field>
<field name="model">account.payment.line</field>
<field name="arch" type="xml">
<tree string="Payment Lines" editable="top" create="0">
<field name="partner_id"/>
<field name="communication"/>
<field name="partner_bank_id"/>
<field name="mandate_id"/>
<field name="move_line_id" invisible="1"/>
<field name="ml_maturity_date"/>
<field name="date"/>
<field name="amount_currency" string="Montant"/>
<field name="name"/>
<field name="amount_company_currency" sum="Total in Company Currency" invisible="1"/>
<field name="payment_type" invisible="1"/>
</tree>
</field>
</record>
<!-- Search View -->
<record id="scop_account_payment_line_search" model="ir.ui.view">
<field name="name">scop.account.payment.line.search</field>
<field name="model">account.payment.line</field>
<field name="arch" type="xml">
<search string="Lignes de paiement">
<field name="partner_id" string="Adhérent"/>
<field name="communication" string="N° Facture"/>
<field name="mandate_id" string="Mandat de prélèvement"/>
<field name="partner_bank_id" string="Compte bancaire"/>
</search>
</field>
</record>
</data>
</odoo>
\ No newline at end of file
...@@ -9,6 +9,14 @@ ...@@ -9,6 +9,14 @@
<field name="model">account.payment.order</field> <field name="model">account.payment.order</field>
<field name="inherit_id" ref="account_payment_order.account_payment_order_form"/> <field name="inherit_id" ref="account_payment_order.account_payment_order_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='bank_line_count']" position="after">
<field name="payment_line_amount"/>
<field name="bank_line_amount"/>
<button name="view_payment_line"
type="object"
string="Modifier les lignes de paiement"
attrs="{'invisible': [('state', '!=', 'draft')]}"/>
</xpath>
<xpath expr="//notebook" position="inside"> <xpath expr="//notebook" position="inside">
<page name="attachments" string="Fichiers de prélèvements"> <page name="attachments" string="Fichiers de prélèvements">
<field name="attachment_ids"> <field name="attachment_ids">
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter