[NEW] Addons account_mooncard_receipt_lost_transfer creation

This commit is contained in:
Stéphan Sainléger
2022-03-31 01:00:03 +02:00
parent 6760aae6b2
commit e624c42a5d
6 changed files with 140 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

View File

@@ -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 <https://github.com/akretion/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
<https://github.com/elabore-coop/.../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 <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Stéphan Sainléger <https://github.com/stephansainleger>
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": [],
}

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import account_move
from . import newgen_payment_card_transaction

View File

@@ -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)

View File

@@ -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

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_move_form_recipt_lost" model="ir.ui.view">
<field name="name">view.move.form.receipt.lost</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<div name="journal_div" position="after">
<field name="mooncard_record" invisible="1" />
<field name="receipt_lost" attrs="{'invisible': [('mooncard_record','=',False)]}" />
</div>
</field>
</record>
<record id="view_move_line_form_recipt_lost" model="ir.ui.view">
<field name="name">view.move.line.form.recipt.lost</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form" />
<field name="arch" type="xml">
<field name="blocked" position="after">
<field name="mooncard_record" invisible="1" />
<field name="receipt_lost" attrs="{'invisible': [('mooncard_record','=',False)]}" />
</field>
</field>
</record>
</odoo>