Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ __pycache__/
*.py[cod]
*$py.class

# OSX Files
.DS_Store

# C extensions
*.so

Expand Down
29 changes: 29 additions & 0 deletions l10n_do_accounting/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from . import models

import logging

_logger = logging.getLogger(__name__)


def post_init_hook(cr, registry):
cr.execute(
"UPDATE account_invoice SET l10n_do_fiscal_number = dgii_document_number;"
)
cr.execute(
"UPDATE account_invoice SET l10n_do_origin_ncf = origin_out;"
)
cr.execute(
"UPDATE account_journal SET l10n_latam_use_documents = use_documents;"
)
cr.execute(
"UPDATE account_journal SET l10n_do_payment_form = payment_form;"
)
cr.execute(
"UPDATE account_invoice SET l10n_do_expense_type = expense_type;"
)
cr.execute(
"UPDATE account_invoice SET l10n_do_cancellation_type = anulation_type;"
)
cr.execute(
"UPDATE account_invoice SET l10n_do_income_type = income_type;"
)
12 changes: 12 additions & 0 deletions l10n_do_accounting/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Fiscal Accounting (Rep. Dominicana)",
"summary": "",
"author": "iterativo LLC, " "Indexa",
"category": "Localization",
"license": "LGPL-3",
"version": "12.0.1.0.0",
"depends": ["l10n_do"],
"installable": True,
"auto_install": True,
"post_init_hook": "post_init_hook",
}
2 changes: 2 additions & 0 deletions l10n_do_accounting/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_invoice
from . import account_journal
81 changes: 81 additions & 0 deletions l10n_do_accounting/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from odoo import models, fields, api, _


class AccountInvoice(models.Model):
_inherit = "account.invoice"

def _get_l10n_do_cancellation_type(self):
""" Return the list of cancellation types required by DGII. """
return [
("01", _("01 - Pre-printed Invoice Impairment")),
("02", _("02 - Printing Errors (Pre-printed Invoice)")),
("03", _("03 - Defective Printing")),
("04", _("04 - Correction of Product Information")),
("05", _("05 - Product Change")),
("06", _("06 - Product Return")),
("07", _("07 - Product Omission")),
("08", _("08 - NCF Sequence Errors")),
("09", _("09 - For Cessation of Operations")),
("10", _("10 - Lossing or Hurting Of Counterfoil")),
]

def _get_l10n_do_ecf_modification_code(self):
""" Return the list of e-CF modification codes required by DGII. """
return [
("1", _("01 - Total Cancellation")),
("2", _("02 - Text Correction")),
("3", _("03 - Amount correction")),
("4", _("04 - NCF replacement issued in contingency")),
("5", _("05 - Reference Electronic Consumer Invoice")),
]

def _get_l10n_do_income_type(self):
""" Return the list of income types required by DGII. """
return [
("01", _("01 - Operational Incomes")),
("02", _("02 - Financial Incomes")),
("03", _("03 - Extraordinary Incomes")),
("04", _("04 - Leasing Incomes")),
("05", _("05 - Income for Selling Depreciable Assets")),
("06", _("06 - Other Incomes")),
]

def _get_l10n_do_expense_type(self):
"""Return the list of expenses needed in invoices to clasify accordingly to
DGII requirements."""
return [
("01", _("01 - Personal")),
("02", _("02 - Work, Supplies and Services")),
("03", _("03 - Leasing")),
("04", _("04 - Fixed Assets")),
("05", _("05 - Representation")),
("06", _("06 - Admitted Deductions")),
("07", _("07 - Financial Expenses")),
("08", _("08 - Extraordinary Expenses")),
("09", _("09 - Cost & Expenses part of Sales")),
("10", _("10 - Assets Acquisitions")),
("11", _("11 - Insurance Expenses")),
]

l10n_do_fiscal_number = fields.Char(
"Fiscal Number",
)
l10n_do_origin_ncf = fields.Char(
string="Modifies",
)
l10n_do_expense_type = fields.Selection(
selection="_get_l10n_do_expense_type",
string="Cost & Expense Type",
)
l10n_do_cancellation_type = fields.Selection(
selection="_get_l10n_do_cancellation_type",
string="Cancellation Type",
)
l10n_do_income_type = fields.Selection(
selection="_get_l10n_do_income_type",
string="Income Type",
)
l10n_do_ecf_modification_code = fields.Selection(
selection="_get_l10n_do_ecf_modification_code",
string="e-CF Modification Code",
)
23 changes: 23 additions & 0 deletions l10n_do_accounting/models/account_journal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from odoo import models, fields, api


class AccountJournal(models.Model):
_inherit = "account.journal"

l10n_latam_use_documents = fields.Boolean(
'Use Documents?', help="If active: will be using for legal invoicing (invoices, debit/credit notes)."
" If not set means that will be used to register accounting entries not related to invoicing legal documents."
" For Example: Receipts, Tax Payments, Register journal entries")

l10n_do_payment_form = fields.Selection(
[
("cash", "Efectivo"),
("bank", u"Cheque / Transferencia / Depósito"),
("card", u"Tarjeta Crédito / Débito"),
("credit", u"A Crédito"),
("swap", "Permuta"),
("bond", "Bonos o Certificados de Regalo"),
("others", "Otras Formas de Venta"),
],
string="Payment Form",
)
38 changes: 38 additions & 0 deletions l10n_do_ecf_invoicing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from . import models

import logging

_logger = logging.getLogger(__name__)


def post_init_hook(cr, registry):
cr.execute(
"UPDATE account_invoice SET is_ecf_invoice = is_ecf;"
)
cr.execute(
"UPDATE account_invoice SET l10n_do_ncf_expiration_date = ncf_expiration_date;"
)
cr.execute(
"""UPDATE account_invoice ai
SET l10n_do_ecf_security_code = ed.e_security_code
FROM ecf_document ed
WHERE ai.ecf_document = ed.id
AND ai.l10n_do_ecf_security_code IS NULL
AND ed.e_security_code IS NOT NULL;"""
)
cr.execute(
"""UPDATE account_invoice ai
SET l10n_do_ecf_sign_date = ed.signature_date
FROM ecf_document ed
WHERE ai.ecf_document = ed.id
AND ai.l10n_do_ecf_sign_date IS NULL
AND ed.signature_date IS NOT NULL;"""
)
cr.execute(
"""UPDATE account_invoice ai
SET l10n_do_electronic_stamp = ed.ecf_stamp
FROM ecf_document ed
WHERE ai.ecf_document = ed.id
AND ai.l10n_do_electronic_stamp IS NULL
AND ed.ecf_stamp IS NOT NULL;"""
)
12 changes: 12 additions & 0 deletions l10n_do_ecf_invoicing/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Dominican Republic EDI Invoicing",
"summary": "",
"author": "iterativo LLC, " "Indexa",
"category": "Localization",
"license": "LGPL-3",
"version": "12.0.1.0.1",
"depends": ["l10n_do_accounting"],
"installable": True,
"auto_install": True,
"post_init_hook": "post_init_hook",
}
1 change: 1 addition & 0 deletions l10n_do_ecf_invoicing/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_invoice
18 changes: 18 additions & 0 deletions l10n_do_ecf_invoicing/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from odoo import models, fields, api, _


class AccountInvoice(models.Model):
_inherit = "account.invoice"

is_ecf_invoice = fields.Boolean(
store=True,
)
l10n_do_ecf_security_code = fields.Char(string="e-CF Security Code", copy=False)
l10n_do_ecf_sign_date = fields.Datetime(string="e-CF Sign Date", copy=False)
l10n_do_electronic_stamp = fields.Char(
string="Electronic Stamp",
store=True,
)
l10n_do_ncf_expiration_date = fields.Date(
string="Valid until",
)
Loading