Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
serCliff committed Mar 26, 2018
0 parents commit 41dfa6b
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# account_internal_moves
3 changes: 3 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from . import models
35 changes: 35 additions & 0 deletions __manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
{
'name': "Account Internal Moves",

'summary': """
New Menu to manage internal moves on you companies""",

'description': """
- Added a improved view with a new field that ease the internal money operations
- Added a new menu on Account/Adviser/Internal transfers
STILL MISSING
- Not transated
- Without seccurity groups
git:
""",


'author': "Sergio Del Castillo Baranda",
'website': "http://www.sergiodelcastillo.com",

'category': 'account',
'version': '0.1',

# any module necessary for this one to work correctly
'depends': ['account'],

# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/account_payment_views.xml',
'views/account_move.xml',
],
}
3 changes: 3 additions & 0 deletions models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from . import account_internal_moves
Binary file added models/__init__.pyc
Binary file not shown.
34 changes: 34 additions & 0 deletions models/account_internal_moves.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-

from odoo import models, fields, api

class AccountInternalMoves(models.Model):
_inherit = "account.payment"


vap_type = fields.Selection([
('draft', 'Otros'),
('c2b', 'Caja a Bancos'),
('b2c', 'Bancos a Caja')],
required=True, default='draft', copy=False, string="Tipo de transferencia")


concept_related = fields.Char(related="communication")


@api.onchange('vap_type')
def _accounts_needed(self):
source_type = ""
destination_type = ""
if self.vap_type == 'b2c':
source_type = "bank"
destination_type = "cash"
elif self.vap_type == 'c2b':
source_type = "cash"
destination_type = "bank"

if self.vap_type != 'draft':
origin_id = self.env['account.journal'].search(['&', ('journal_user', '=', True), ('type', '=', source_type), ('company_id','=',self.company_id)])
destination_id = self.env['account.journal'].search(['&', ('journal_user', '=', True), ('type', '=', destination_type), ('company_id','=',self.company_id)])
self.journal_id = origin_id.id
self.destination_id = destination_id.id
Binary file added models/models.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_vap_account_move_vap_account_move,vap_account_move.vap_account_move,model_vap_account_move_vap_account_move,,1,0,0,0
24 changes: 24 additions & 0 deletions views/account_move.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!-- <record model="ir.ui.view" id="vap_acc_move_tree">
<field name="name">account.payment.vap</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_move_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree" position="inside">
<field name="vap_type" placeholder="Concepto"/>
</xpath>
</field>
</record> -->

<!-- <menuitem
name="Movimientos"
action="action_move_journal_line"
id="menu_action_move_journal_line_form"
parent="account.menu_finance_entries"
groups="group_account_user"
sequence="2"/> -->

</data>
</odoo>
81 changes: 81 additions & 0 deletions views/account_payment_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>

<record model="ir.ui.view" id="vap_a_p_imp">
<field name="name">account.payment.vap</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="arch" type="xml">

<xpath expr="//div[@name='button_box']" position="before">
<div class="oe_title">
<h1>
<field name="concept_related" placeholder="Concepto"/>
</h1>
</div>
</xpath>
<xpath expr="//field[@name='payment_type']" position="after">
<field name="vap_type" attrs="{'readonly': [('state', '!=', 'draft')]}" />
</xpath>

<!-- HIDE FIELDS -->
<xpath expr="//field[@name='communication']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>

<xpath expr="//field[@name='payment_type']" position="attributes">
<attribute name="invisible">[('payment_type', '=', 'transfer')]</attribute>
</xpath>

<!-- <xpath expr="//field[@name='payment_transaction_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath> -->

</field>
</record>

<record id="view_account_internal_payment_tree" model="ir.ui.view">
<field name="name">account.supplier.payment.tree</field>
<field name="model">account.payment</field>
<field name="arch" type="xml">
<tree decoration-info="state=='draft'" decoration-muted="state=='reconciled'" edit="false">
<field name="payment_date"/>
<field name="name"/>
<field name="communication"/>
<field name="vap_type"/>
<field name="journal_id"/>
<field name="destination_journal_id"/>
<field name="amount" sum="Amount"/>
<field name="payment_method_id"/>
<field name="partner_id" string="Customer"/>
<field name="state"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="currency_id" invisible="1"/>
<field name="partner_type" invisible="1"/>
</tree>
</field>
</record>

<record id="action_account_internal_transfers" model="ir.actions.act_window">
<field name="name">Transferencias Internas</field>
<field name="res_model">account.payment</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'default_payment_type': 'transfer', 'default_vap_type': 'c2b', 'default_partner_type': ''}</field>
<field name="domain">[('payment_type', '=', 'transfer')]</field>
<field name="view_id" ref="view_account_internal_payment_tree"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click para realizar un pago interno
</p><p>
Los pagos se utilizan para registrar movimientos de líquido (enviar, recibir o transferir dinero). Puede procesar esos pagos por sus propios medios o utilizando los servicios instalados.
</p>
</field>
</record>

<menuitem action="action_account_internal_transfers" id="account_internal_transfers_menu" name="Transferencias Internas" parent="account.menu_finance_entries" sequence="0" groups="account.group_account_user"/>


</data>
</odoo>

0 comments on commit 41dfa6b

Please sign in to comment.