Commit 8585ba1e authored by Juan Carlos Funes's avatar Juan Carlos Funes
Browse files

[ADD][account_move_line_ext_mejorado]Was optimized, improved code

parent d7912d1c
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits######################################################
# Coded by: Luis Escobar
# Audited by: Vauxoo C.A.
# Modified by: Juan Carlos Funes(juan@vauxoo.com)
#############################################################################
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
################################################################################
import account_move_line
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits######################################################
# Coded by: Luis Escobar <luis@vauxoo.com>
# Planified by: Nhomar Hernandez
# Audited by: Vauxoo C.A.
# Modified by: Juan Carlos Funes(juan@vauxoo.com)
#############################################################################
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
################################################################################
{
"name" : "Account move line extended",
"version" : "0.1",
"author" : "Vauxoo",
"website" : "http://vauxoo.com",
"category": 'Generic Modules/Accounting',
"description": """- Add a new field to be use as a reference in account move line
""",
'init_xml': [],
"depends" : ["account"],
'update_xml': [
'account_view.xml',
],
'demo_xml': [],
'test': [],
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits######################################################
# Coded by: Vauxoo C.A.
# Planified by: Nhomar Hernandez
# Audited by: Vauxoo C.A.
# Modified by: Juan Carlos Funes(juan@vauxoo.com)
#############################################################################
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
################################################################################
from osv import fields, osv, orm
from tools.translate import _
from operator import itemgetter
from lxml import etree
class account_move_line(osv.osv):
_inherit = 'account.move.line'
_columns = {
'ref2': fields.char('Second Reference', size=64, required=False, help="Account entry reference"),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
result = super(account_move_line, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
#fields_get = self.fields_get(cr, uid, ['stock_move_id'], context)
xml_form = etree.fromstring(result['arch'])
placeholder = xml_form.xpath("//field[@name='period_id']")
placeholder[0].addnext(etree.Element('field', {'name': 'ref2'}))
result['arch'] = etree.tostring(xml_form)
result['fields'].update({
'ref2':{'domain': [], 'string': u'Second Reference', 'readonly': False, 'context': {}, 'selectable': True, 'type': 'char', 'help':'Account entry reference','select': 2}})
return result
account_move_line()
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_move_form_iva" model="ir.ui.view">
<field name="name">account.move.form.iva</field>
<field name="model">account.move</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr='/form/notebook/page[@string="Journal Items"]/field[@name="line_id"]/form[@string="Journal Item"]/group/field[@name="ref"]' position="after">
<field name='ref2'/>
</xpath>
<xpath expr='/form/notebook/page[@string="Journal Items"]/field[@name="line_id"]/tree[@string="Journal Items"]/field[@name="ref"]' position="after">
<field name='ref2'/>
</xpath>
</field>
</record>
<record id="view_move_line_tree_ref2" model="ir.ui.view">
<field name="name">account.move.line.tree.ref2</field>
<field name="model">account.move.line</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_move_line_tree"/>
<field name="arch" type="xml">
<xpath expr='/tree/field[@name="period_id"]' position="before">
<field name='ref2'/>
</xpath>
</field>
</record>
</data>
</openerp>
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_mov_line_ext
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-05-22 22:13+0000\n"
"PO-Revision-Date: 2012-05-22 22:13+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_mov_line_ext
#: field:account.move.line,ref2:0
msgid "Second Reference"
msgstr "Segunda Referencia"
#. module: account_mov_line_ext
#: help:account.move.line,ref2:0
msgid "Account entry reference"
msgstr "Referencia del apunte contable"
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_mov_line_ext
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-05-22 22:13+0000\n"
"PO-Revision-Date: 2012-05-22 22:13+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_mov_line_ext
#: field:account.move.line,ref2:0
msgid "Second Reference"
msgstr "Segunda Referencia"
#. module: account_mov_line_ext
#: help:account.move.line,ref2:0
msgid "Account entry reference"
msgstr "Referencia del apunte contable"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment