-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
svazquezco
committed
Mar 6, 2019
1 parent
4653afe
commit 4a3a85a
Showing
21 changed files
with
3,758 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
language: python | ||
|
||
python: | ||
- 3.5 | ||
|
||
cache: pip | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- expect-dev | ||
- python-lxml | ||
|
||
env: | ||
- VERSION="11.0" LINT_CHECK="1" | ||
- VERSION="11.0" ODOO_REPO="odoo/odoo" LINT_CHECK="0" | ||
|
||
install: | ||
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools | ||
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} | ||
- pip install -r requirements.txt | ||
- travis_install_nightly | ||
|
||
script: | ||
- travis_run_tests | ||
|
||
after_success: | ||
- travis_after_tests_success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright <2018> <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
|
@@ -18,6 +17,8 @@ | |
|
||
], | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
'data/account_tax_group_data.xml', | ||
'views/account_invoice.xml', | ||
'views/account_journal.xml', | ||
'views/l10n_co_dian_resolution.xml', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data noupdate="1"> | ||
|
||
<record id="tax_group_iva" model="account.tax.group"> | ||
<field name="name">IVA</field> | ||
<field name="l10n_co_dian_code">01</field> | ||
</record> | ||
|
||
<record id="tax_group_ic" model="account.tax.group"> | ||
<field name="name">IC</field> | ||
<field name="l10n_co_dian_code">02</field> | ||
</record> | ||
|
||
<record id="tax_group_ica" model="account.tax.group"> | ||
<field name="name">ICA</field> | ||
<field name="l10n_co_dian_code">03</field> | ||
</record> | ||
|
||
<record id="tax_group_inc" model="account.tax.group"> | ||
<field name="name">INC</field> | ||
<field name="l10n_co_dian_code">04</field> | ||
</record> | ||
|
||
<record id="tax_group_iva_ret" model="account.tax.group"> | ||
<field name="name">ReteIva</field> | ||
<field name="l10n_co_dian_code">05</field> | ||
</record> | ||
|
||
<record id="tax_group_rf_ret" model="account.tax.group"> | ||
<field name="name">ReteFuente</field> | ||
<field name="l10n_co_dian_code">06</field> | ||
</record> | ||
|
||
<record id="tax_group_ica_ret" model="account.tax.group"> | ||
<field name="name">ReteICA</field> | ||
<field name="l10n_co_dian_code">06</field> | ||
</record> | ||
|
||
<record id="tax_group_cree_ret" model="account.tax.group"> | ||
<field name="name">ReteCREE</field> | ||
<field name="l10n_co_dian_code">07</field> | ||
</record> | ||
|
||
<record id="tax_group_fto_horti_cult" model="account.tax.group"> | ||
<field name="name">FtoHorticultura</field> | ||
<field name="l10n_co_dian_code">08</field> | ||
</record> | ||
|
||
<record id="tax_group_timbre" model="account.tax.group"> | ||
<field name="name">Timbre</field> | ||
<field name="l10n_co_dian_code">20</field> | ||
</record> | ||
|
||
<record id="tax_group_bolsas" model="account.tax.group"> | ||
<field name="name">Bolsas</field> | ||
<field name="l10n_co_dian_cod">22</field> | ||
</record> | ||
|
||
</data> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
# © 2018 Susana Vázquez <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class AccountInvoice(models.Model): | ||
|
@@ -9,3 +13,34 @@ class AccountInvoice(models.Model): | |
'invoice_id', | ||
'Electronic invoice' | ||
) | ||
|
||
def _prepare_einvoice_vals(self): | ||
return { | ||
'invoice_id': self.id, | ||
'company_id': self.company_id.id, | ||
} | ||
|
||
@api.multi | ||
def invoice_validate(self): | ||
res = super(AccountInvoice, self).invoice_validate() | ||
for inv in self.filtered(lambda x: x.company_id.l10n_co_dian_enabled): | ||
einv_vals = self._prepare_einvoice_vals() | ||
einv = self.env['l10n.co.electronic.invoice'].create(einv_vals) | ||
einv.validate_invoice() | ||
einv.action_post_validate() | ||
|
||
return res | ||
|
||
@api.multi | ||
def action_cancel(self): | ||
res = super(AccountInvoice, self).action_cancel() | ||
for inv in self.filtered(lambda x: x.l10n_co_dian_enabled): | ||
invoice_sent_dian = inv.filtered( | ||
lambda x: x.l10n_co_invoice_electronic_ids.state == 'done') | ||
|
||
if invoice_sent_dian: | ||
raise UserError('Can\'t cancel invoice sent to DIAN') | ||
|
||
return res | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class AccountTaxGroup(models.Model): | ||
_inherit = 'account.tax.group' | ||
|
||
l10n_co_dian_code = fields.Integer( | ||
'Dian Code' | ||
) |
Oops, something went wrong.