Skip to content

Commit

Permalink
Merge 814d393 into fda9196
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkopen-pt committed Oct 12, 2016
2 parents fda9196 + 814d393 commit 4bab08e
Show file tree
Hide file tree
Showing 48 changed files with 7,017 additions and 661 deletions.
661 changes: 0 additions & 661 deletions LICENSE

This file was deleted.

72 changes: 72 additions & 0 deletions l10n_pt_account/README.rst
@@ -0,0 +1,72 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

===============
l10n_pt_account
===============

Customization of Accounting for Portugal.
This module implements several Portuguese specific accounting documents:
Documents:
- Debit Notes;
- Credit Notes;
- Supplier Debit Notes;
- All Waybill Types.

Allows you to import products, clients and invoices to saft
NOTE: This documents to be valid, need a certification from
Portuguese Treasury, for that you must install and configure the
tko_ics2_pt module, provided by Thinkopen Solutions.

Installation
============

Configuration
=============

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/171/9.0

Known issues / Roadmap
======================

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/l10n-portugal/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
=======

* `ThinkOpen Solutions <http://thinkopen.solutions>`

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
13 changes: 13 additions & 0 deletions l10n_pt_account/__init__.py
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2010-2016 ThinkOpen Solutions
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)./
from . import account_invoice
from . import account_pt
from . import guia
from . import sale
from . import product
from . import wizard
from . import report
from . import stock
from . import account_config
from . import account_payment
45 changes: 45 additions & 0 deletions l10n_pt_account/__openerp__.py
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# Copyright 2010-2016 ThinkOpen Solutions
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)./
{
'name': 'Contabilidade PT',
'version': '9.0.1.0.122',
'author': 'ThinkOpen Solutions,Odoo Community Association (OCA)',
'category': 'Accounting & Finance',
'sequence': 1,
'license': 'LGPL-3',
'website': 'http://www.thinkopen.solutions/',
'depends': ['base',
'account',
'account_cancel',
'purchase',
'sale',
'stock',
'stock_account',
'l10n_pt'
],
'data': ['security/account_security.xml',
'security/ir.model.access.csv',
'account_invoice_view.xml',
'account_view.xml',
'base_vat_view.xml',
'guia_view.xml',
'product_view.xml',
'data/account_data2.xml',
'data/simplified_invoice_client.xml',
'in_debit_note_sequence.xml',
'account_workflow.xml',
'wizard/stock_create_waybill.xml',
'wizard/waybill_invoice_view.xml',
'stock_view.xml',
'simplified_invoice_view.xml',
'sale_view.xml',
'account_config_view.xml',
'res_config_view.xml',
'wizard/sale_make_invoice_advance.xml',
'report/account_payment_report.xml',
'report/account_invoice_report_view.xml'
],
'installable': True,
'application': True,
}
111 changes: 111 additions & 0 deletions l10n_pt_account/account_config.py
@@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-
# Copyright 2010-2016 ThinkOpen Solutions
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)./
from openerp import models, fields, api


class ResCompany(models.Model):
_inherit = "res.company"

income_move_account_id = fields.Many2one(
'account.account', string="Gain Account",
help="Account to register the differences "
"of values in invoices in gain (credit)")
expense_move_account_id = fields.Many2one(
'account.account', string="Loss Account",
help="Account to register the differences "
"of values in invoices in loss (debit)")


class AccountPtConfig(models.TransientModel):
_inherit = 'account.config.settings'

debit_sup_seq_id = fields.Many2one(
'ir.sequence', 'Supplier Debit Note Sequence')
debit_sup_seq_prefix = fields.Char(
string='Supplier debit note sequence')
debit_sup_seq_next = fields.Integer(
string='Supplier debit note next number')
debit_journal_id = fields.Many2one(
'account.journal', 'Debit Note journal')
debit_seq_prefix = fields.Char(
string='Debit note sequence')
waybill_rem_seq = fields.Many2one(
'ir.sequence', 'Waybill Remittance Sequence')
waybill_rem_seq_prefix = fields.Char(
string='Waybill remittance sequence')
waybill_trsp_seq = fields.Many2one(
'ir.sequence', 'Waybill Transport Sequence')
waybill_trsp_seq_prefix = fields.Char(
string='Waybill transport sequence')
waybill_dev_seq = fields.Many2one(
'ir.sequence', 'Waybill Return Sequence')
waybill_dev_seq_prefix = fields.Char(
string='Waybill return sequence')
module_tko_account_pt_partner_reports = fields.Boolean(
'Allows to download partner PT reports.',
help='Adds several reports. This installs the '
'module tko_account_pt_partner_reports.')
module_tko_account_pt_account_reports = fields.Boolean(
'Overwrites accounting reports to add acumulated amounts.',
help='Overwrites the Balance, General Ledger and adds '
'a summary extracts report. This installs the '
'module tko_account_pt_account_reports.')
expense_move_account_id = fields.Many2one(
'account.account', related='company_id.expense_move_account_id',
string='Loss Differences Account',
help="Account to register the differences of "
"values in invoices in loss (debit)")
income_move_account_id = fields.Many2one(
'account.account', related='company_id.income_move_account_id',
string='Gain Differences Account',
help="Account to register the differences of "
"values in invoices in gain (credit)")

@api.model
def get_default_fields(self, fields):
res = {}
journal_obj = self.env['account.journal']
sequence_obj = self.env['ir.sequence']
debit_note = journal_obj.search(
[('code', '=', 'MISC'), ('type', '=', 'general')],
limit=1)
sup_debit_note = sequence_obj.search(
[('code', '=', 'account.invoice.in_debit_note')], limit=1)
waybill_rem = sequence_obj.search(
[('code', '=', 'account.guia.remessa.sequence')], limit=1)
waybill_trsp = sequence_obj.search(
[('code', '=', 'account.guia.transporte.sequence')],
limit=1)
waybill_dev = sequence_obj.search(
[('code', '=', 'account.guia.devolucao.sequence')],
limit=1)
if debit_note:
res['debit_journal_id'] = debit_note.id
res['debit_seq_prefix'] = debit_note.sequence_id.prefix
if sup_debit_note:
res['debit_sup_seq_id'] = sup_debit_note.id
res['debit_sup_seq_prefix'] = sup_debit_note.prefix
res['debit_sup_seq_next'] = sup_debit_note.number_next
if waybill_rem:
res['waybill_rem_seq'] = waybill_rem.id
res['waybill_rem_seq_prefix'] = waybill_rem.prefix
if waybill_trsp:
res['waybill_trsp_seq'] = waybill_trsp.id
res['waybill_trsp_seq_prefix'] = waybill_trsp.prefix
if waybill_dev:
res['waybill_dev_seq'] = waybill_dev.id
res['waybill_dev_seq_prefix'] = waybill_dev.prefix
return res

@api.multi
@api.onchange('company_id')
def onchange_company_id(self):
""" Update income/expense move account """
if self.company_id:
if self.company_id.income_move_account_id:
self.income_move_account_id = \
self.company_id.income_move_account_id.id
if self.company_id.expense_move_account_id:
self.expense_move_account_id = \
self.company_id.expense_move_account_id.id
85 changes: 85 additions & 0 deletions l10n_pt_account/account_config_view.xml
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record model="ir.ui.view" id="view_company_inherit_form">
<field name="name">res.company.form.inherit</field>
<field name="inherit_id" ref="account.view_company_inherit_form"/>
<field name="model">res.company</field>
<field name="arch" type="xml">
<field name="accounts_code_digits" position="after">
<field name="income_move_account_id" />
<field name="expense_move_account_id" />
</field>
</field>
</record>

<record id="view_l10n_pt_account_config_settings" model="ir.ui.view">
<field name="name">tko account pt settings</field>
<field name="model">account.config.settings</field>
<field name="inherit_id" ref="account.view_account_config_settings"/>
<field name="arch" type="xml">
<div name="customer_payments" position='inside'>
<div>
<label for="income_move_account_id" />
<field name="income_move_account_id" class="oe_inline"/>
</div>
<div>
<label for="expense_move_account_id" />
<field name="expense_move_account_id" class="oe_inline" />
</div>
<div>
<label for="debit_seq_prefix"/>
<field name="debit_seq_prefix"
class="oe_inline"
help='This sequence only accept letters and numbers.Example: "2013/". The ICS service will put the pre-prefix sequence.(ND).'/>
</div>
<div>
<label for="waybill_rem_seq_prefix"/>
<field name="waybill_rem_seq_prefix"
class="oe_inline"
help='This sequence only accept letters and numbers.Example: "2013/". The ICS service will put the pre-prefix sequence.(GR).'/>
</div>
<div>
<label for="waybill_trsp_seq_prefix"/>
<field name="waybill_trsp_seq_prefix"
class="oe_inline"
help='This sequence only accept letters and numbers.Example: "2013/". The ICS service will put the pre-prefix sequence.(GT).'/>
</div>
<div>
<label for="waybill_dev_seq_prefix"/>
<field name="waybill_dev_seq_prefix"
class="oe_inline"
help='This sequence only accept letters and numbers.Example: "2013/". The ICS service will put the pre-prefix sequence.(GD).'/>
</div>
<div>
<label for="debit_sup_seq_next"/>
<field name="debit_sup_seq_prefix"
class="oe_inline"
help='If you put "%%(year)s" in the prefix, it will be replaced by the current year.'/>
<field name="debit_sup_seq_next"
class="oe_inline"
/>
</div>
</div>
<group name="bank_cash" position="after">
<separator string="Accounting PT" />
<group>
<label for="id" string="Configs"/>
<div>
<div>
<field name="module_tko_account_pt_partner_reports" class="oe_inline"/>
<label for="module_tko_account_pt_partner_reports"/>
</div>
<div>
<field name="module_tko_account_pt_account_reports" class="oe_inline"/>
<label for="module_tko_account_pt_account_reports"/>
</div>
</div>
</group>
</group>
</field>
</record>

</data>
</openerp>

0 comments on commit 4bab08e

Please sign in to comment.