From e624c42a5d0d4fe364f8c16ee9673aff5d4e56a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Sainl=C3=A9ger?= Date: Thu, 31 Mar 2022 01:00:03 +0200 Subject: [PATCH] [NEW] Addons account_mooncard_receipt_lost_transfer creation --- .../__init__.py | 3 + .../__manifest__.py | 63 +++++++++++++++++++ .../models/__init__.py | 4 ++ .../models/account_move.py | 15 +++++ .../models/newgen_payment_card_transaction.py | 29 +++++++++ .../views/account_move_views.xml | 26 ++++++++ 6 files changed, 140 insertions(+) create mode 100644 account_mooncard_receipt_lost_transfer/__init__.py create mode 100644 account_mooncard_receipt_lost_transfer/__manifest__.py create mode 100644 account_mooncard_receipt_lost_transfer/models/__init__.py create mode 100644 account_mooncard_receipt_lost_transfer/models/account_move.py create mode 100644 account_mooncard_receipt_lost_transfer/models/newgen_payment_card_transaction.py create mode 100644 account_mooncard_receipt_lost_transfer/views/account_move_views.xml diff --git a/account_mooncard_receipt_lost_transfer/__init__.py b/account_mooncard_receipt_lost_transfer/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/account_mooncard_receipt_lost_transfer/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/account_mooncard_receipt_lost_transfer/__manifest__.py b/account_mooncard_receipt_lost_transfer/__manifest__.py new file mode 100644 index 0000000..70a4c5e --- /dev/null +++ b/account_mooncard_receipt_lost_transfer/__manifest__.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +{ + "name": "Account Mooncard Receipt Lost Transfer", + "category": "Account", + "version": "14.0.1.0", + "summary": "Transfer the Receipt Lost value in invoices and account move lines", + "author": "Elabore", + "website": "https://elabore.coop/", + "installable": True, + "application": False, + "auto_install": False, + "description": """ +====================================== +Account Mooncard Receipt Lost Transfer +====================================== +This module allows the transfer of the Receipt Lost field value from model newgen.payment.card.transaction in invoices and account.move.line + +Installation +============ +Before the installation, please ensure that the addons of the repository `Odoo Mooncard Connector ` are available in your Odoo +Just install account_mooncard_receipt_lost_transfer, all dependencies will be installed by default. + +Known issues / Roadmap +====================== + +Bug Tracker +=========== +Bugs are tracked on `GitHub 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 `_. + +Contributors +------------ +* Stéphan Sainléger + +Funders +------- +The development of this module has been financially supported by: +* Elabore (https://elabore.coop) + +Maintainer +---------- +This module is maintained by ELABORE. + +""", + "depends": [ + "base", + "account", + "base_newgen_payment_card", + ], + "data": [ + "views/account_move_views.xml", + ], + "qweb": [], +} diff --git a/account_mooncard_receipt_lost_transfer/models/__init__.py b/account_mooncard_receipt_lost_transfer/models/__init__.py new file mode 100644 index 0000000..77e033c --- /dev/null +++ b/account_mooncard_receipt_lost_transfer/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from . import account_move +from . import newgen_payment_card_transaction diff --git a/account_mooncard_receipt_lost_transfer/models/account_move.py b/account_mooncard_receipt_lost_transfer/models/account_move.py new file mode 100644 index 0000000..5b46503 --- /dev/null +++ b/account_mooncard_receipt_lost_transfer/models/account_move.py @@ -0,0 +1,15 @@ +from odoo import fields, models, _ + + +class AccountMove(models.Model): + _inherit = "account.move" + + receipt_lost = fields.Boolean(string=_("Receipt lost"), store=True) + mooncard_record = fields.Boolean(store=True) + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + receipt_lost = fields.Boolean(string=_("Receipt lost"), store=True) + mooncard_record = fields.Boolean(store=True) diff --git a/account_mooncard_receipt_lost_transfer/models/newgen_payment_card_transaction.py b/account_mooncard_receipt_lost_transfer/models/newgen_payment_card_transaction.py new file mode 100644 index 0000000..0252166 --- /dev/null +++ b/account_mooncard_receipt_lost_transfer/models/newgen_payment_card_transaction.py @@ -0,0 +1,29 @@ +from odoo import models + + +class NewgenPaymentCardTransaction(models.Model): + _inherit = "newgen.payment.card.transaction" + + def process_line(self): + res = super(NewgenPaymentCardTransaction, self).process_line() + if res: + for line in self: + if line.invoice_id: + line.invoice_id.receipt_lost = line.receipt_lost + line.invoice_id.mooncard_record = True + move_lines = line.invoice_id.line_ids + for move_line in move_lines: + move_line.receipt_lost = line.receipt_lost + move_line.mooncard_record = True + + return res + + def generate_bank_journal_move(self): + bank_move = super( + NewgenPaymentCardTransaction, self + ).generate_bank_journal_move() + if bank_move: + for line in bank_move.line_ids: + line.receipt_lost = self.receipt_lost + line.mooncard_record = True + return bank_move diff --git a/account_mooncard_receipt_lost_transfer/views/account_move_views.xml b/account_mooncard_receipt_lost_transfer/views/account_move_views.xml new file mode 100644 index 0000000..6846f75 --- /dev/null +++ b/account_mooncard_receipt_lost_transfer/views/account_move_views.xml @@ -0,0 +1,26 @@ + + + + view.move.form.receipt.lost + account.move + + +
+ + +
+
+
+ + + view.move.line.form.recipt.lost + account.move.line + + + + + + + + +
\ No newline at end of file