[ADD]membership_invoice_payment_mode: add payment mode in membership invoice wizard

This commit is contained in:
2024-03-06 15:55:01 +01:00
parent ef4ee0d880
commit 78e84abfa3
7 changed files with 116 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
*.*~
*pyc

View File

@@ -0,0 +1,44 @@
===========
membership_invoice_payment_mode
===========
This module add the payment mode to the membership invoice wizard.
The payment mode is added to the created invoice
Installation
============
Just install membership_invoice_payment_mode, all dependencies will be installed by default.
Known issues / Roadmap
======================
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<//https://github.com/elabore-coop/member-tools/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
------
Contributors
------------
* Élabore Teams
Funders
-------
The development of this module has been financially supported by:
* Élabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Élabore.

View File

@@ -0,0 +1 @@
from . import wizard

View File

@@ -0,0 +1,32 @@
# Copyright 2020 Lokavaluto ()
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "membersip_invoice_payment_mode",
"version": "12.0.1.0.0",
"author": "Élabore",
"maintainer": "False",
"website": "elabore.coop",
"license": "",
"category": "",
"summary": "Add payment mode in merbership invoice wizard",
# any module necessary for this one to work correctly
"depends": [
"account_payment_mode",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"wizard/membership_invoice_views.xml",
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"qweb": [],
"installable": True,
"auto_install": False,
"application": False,
}

View File

@@ -0,0 +1 @@
from . import membership_invoice

View File

@@ -0,0 +1,22 @@
from odoo import fields, models
class MembershipInvoice(models.TransientModel):
_inherit = "membership.invoice"
payment_mode_id = fields.Many2one(
comodel_name='account.payment.mode', string="Payment Mode",
domain=[("payment_type", "=", 'inbound')],
)
def membership_invoice(self):
res = super(MembershipInvoice, self).membership_invoice()
invoice_ids = None
for d in res['domain']:
if d[0] == 'id' and d[1] == 'in':
invoice_ids = d[2]
if invoice_ids:
self.env['account.invoice'].browse(invoice_ids).write({
'payment_mode_id':self.payment_mode_id.id,
})
return res

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_membership_invoice_team_idview" model="ir.ui.view">
<field name="name">membership.invoice.team_idview.form</field>
<field name="model">membership.invoice</field>
<field name="inherit_id" ref="membership.view_membership_invoice_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='member_price']" position="after">
<field name="payment_mode_id" options="{'no_create_edit': True, 'no_open': True}" />
</xpath>
</field>
</record>
</odoo>