[MIG] membership_invoice_payment_mode: Migration to 16.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "membersip_invoice_payment_mode",
|
||||
"version": "12.0.2.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"author": "Élabore",
|
||||
"maintainer": "False",
|
||||
"website": "elabore.coop",
|
||||
|
@@ -5,21 +5,24 @@ class MembershipInvoice(models.TransientModel):
|
||||
_inherit = "membership.invoice"
|
||||
|
||||
payment_mode_id = fields.Many2one(
|
||||
comodel_name='account.payment.mode', string="Payment Mode",
|
||||
domain=[("payment_type", "=", 'inbound')],
|
||||
comodel_name="account.payment.mode",
|
||||
string="Payment Mode",
|
||||
domain=[("payment_type", "=", "inbound")],
|
||||
)
|
||||
|
||||
date_invoice = fields.Date(string='Invoice Date')
|
||||
date_invoice = fields.Date(string="Invoice Date")
|
||||
|
||||
def membership_invoice(self):
|
||||
res = super(MembershipInvoice, self).membership_invoice()
|
||||
res = super().membership_invoice()
|
||||
invoice_ids = None
|
||||
for d in res['domain']:
|
||||
if d[0] == 'id' and d[1] == 'in':
|
||||
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,
|
||||
'date_invoice':self.date_invoice,
|
||||
})
|
||||
self.env["account.move"].browse(invoice_ids).write(
|
||||
{
|
||||
"payment_mode_id": self.payment_mode_id.id,
|
||||
"invoice_date": self.date_invoice,
|
||||
},
|
||||
)
|
||||
return res
|
||||
|
Reference in New Issue
Block a user