Skip to content

Commit

Permalink
[ADD] Agregar diferente formas de pago en los metodos de pago entrant…
Browse files Browse the repository at this point in the history
…e y saliente en plus validar funcionamiento.
  • Loading branch information
alexcape14 committed Nov 5, 2023
1 parent f8c3485 commit 2a7fe24
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 46 deletions.
4 changes: 2 additions & 2 deletions l10n_do_accounting_plus/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"website": "https://capw.com.do",
"version": "15.0.3",
# any module necessary for this one to work correctly
"depends": ["l10n_latam_invoice_document", "l10n_do"],
"depends": ["l10n_do_accounting"],
# always loaded
"data": [
"views/account_fiscal_sequence.xml",
# "views/account_journal_views.xml",
"views/account_journal_views.xml",
# "views/account_move_views.xml",
"views/account_payment.xml",
# "views/res_company_views.xml",
Expand Down
1 change: 0 additions & 1 deletion l10n_do_accounting_plus/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
from . import account_payment
from . import res_company
from . import res_config_setting
from . import res_currency_rate
from . import wsmovildgii

38 changes: 38 additions & 0 deletions l10n_do_accounting_plus/models/account_journal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
from odoo import fields, models, _


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

hidden_payment_form = fields.Boolean(
string='Payment Form With Method Lines',
required=False)


class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method.line'

Expand All @@ -20,3 +28,33 @@ def _get_l10n_do_payment_form(self):
string='Payment Form',
selection='_get_l10n_do_payment_form',
required=False, )


class AccountFiscalSequence(models.Model):
_name = 'account.fiscal.sequence'
_description = "Account Fiscal Sequence"

l10n_do_warning_vouchers = fields.Char(
string='Warning Sequence',
required=False)

l10n_do_limit_vouchers = fields.Char(
string='Limit Sequence',
required=False)

document_type = fields.Many2one(
comodel_name='l10n_latam.document.type',
string='Document Type',
required=False)

code = fields.Char(related='document_type.doc_code_prefix')

company_id = fields.Many2one(
comodel_name='res.company',
string='Company', required=True, readonly=True,
default=lambda self: self.env.company)

_sql_constraints = [
('document_type', 'unique (code, company_id)',
'You only can use one document type per company')
]
25 changes: 12 additions & 13 deletions l10n_do_accounting_plus/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,23 @@ class AccountMove(models.Model):
total_descontado = fields.Monetary(string="Total Descontado", compute='calculo_total_descontado')
total_without_discount = fields.Float(string='Total_without_discount')
received_delivered = fields.Boolean(string="received/delivered", compute='get_received_delivered')
label_report_one = fields.Char(
string='Label_report_one',
compute='get_received_delivered',
required=False)
label_report_two = fields.Char(
string='Label_report_two',
compute='get_received_delivered',
required=False)

fiscal_type_name = fields.Char(
string='Name_fiscal_type',
compute='call_name_type_fiscal',
required=False)
label_report_one = fields.Char(string='Label_report_one', compute='get_received_delivered')
label_report_two = fields.Char(string='Label_report_two', compute='get_received_delivered')
fiscal_type_name = fields.Char(string='Name_fiscal_type', compute='call_name_type_fiscal')

def call_name_type_fiscal(self):
for rec in self:
rec.fiscal_type_name = rec.l10n_latam_document_type_id.id

def convert_to_fiscal_invoice(self):
for invoice in self:
if invoice.jounal_id.l10n_latam_use_documents:
print(invoice.state)
else:
raise ValidationError(
"This invoice is associated with a fiscal journal %s," % invoice.journal_id.name /
"you cannot convert it to fiscal again.")

def calculo_total_descontado(self):
total = 0
total_imponible = 0
Expand Down
24 changes: 8 additions & 16 deletions l10n_do_accounting_plus/models/res_config_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,32 @@ class ResConfigSettings(models.TransientModel):

financial_currency = fields.Boolean(
string='Financial Currency',
related='company_id.financial_currency',
readonly=False, )
related='company_id.financial_currency')

manual_change_currency = fields.Boolean(
string='Manual Change Currency',
related='company_id.manual_change_currency',
readonly=False, )
related='company_id.manual_change_currency')

date_equal_to_invoice_retention = fields.Boolean(
string='Date Retention Equal to Date Invoice',
related='company_id.date_equal_to_invoice_retention',
readonly=False)
related='company_id.date_equal_to_invoice_retention')

l10n_do_fiscal_sequence_control = fields.Boolean(
string='Activate Fiscal Sequence Control',
related='company_id.l10n_do_fiscal_sequence_control',
required=False)
related='company_id.l10n_do_fiscal_sequence_control')

view_discount_in_account = fields.Boolean(
string='Visualizar descuentos',
config_parameter='l10n_dominicana.view_discount_in_account',
required=False)
config_parameter='l10n_dominicana.view_discount_in_account')

view_delivered_received = fields.Boolean(
string='Delivered/Received',
config_parameter='l10n_do_accounting.view_delivered_received',
required=False)
config_parameter='l10n_do_accounting.view_delivered_received')

label_one_report = fields.Char(
string='Show name in report label left',
config_parameter='l10n_do_accounting.label_one_report',
required=False)
config_parameter='l10n_do_accounting.label_one_report')

label_one_report_2 = fields.Char(
string='Show name in report label right',
config_parameter='l10n_do_accounting.label_one_report_2',
required=False)
config_parameter='l10n_do_accounting.label_one_report_2')
13 changes: 0 additions & 13 deletions l10n_do_accounting_plus/models/res_currency_rate.py

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions l10n_do_accounting_plus/views/account_journal_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_account_journal_form" model="ir.ui.view">
<field name="model">account.journal</field>
<field name="name">account.journal.form</field>
<field name="inherit_id" ref="l10n_do_accounting.view_account_journal_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='type']" position="after">
<field name="hidden_payment_form" attrs="{'invisible': [('type','not in',('cash','bank'))]}"/>
</xpath>
<xpath expr="//field[@name='l10n_do_payment_form']" position="attributes">
<attribute name="attrs">{
'invisible': ['|', '|', ('type','not in',('cash','bank')), ('country_code', '!=', 'DO'), ('hidden_payment_form', '=', True)],
'required': [('type','in',('cash','bank')), ('country_code', '!=', 'DO')]
}</attribute>
</xpath>
<xpath expr="//page[@id='outbound_payment_settings']/field[@name='outbound_payment_method_line_ids']/tree/field[@name='name']" position="after">
<field name="l10n_do_payment_form" attrs="{'column_invisible': [('parent.hidden_payment_form', '=', False)]}"/>
</xpath>
<xpath expr="//page[@id='inbound_payment_settings']/field[@name='inbound_payment_method_line_ids']/tree/field[@name='name']" position="after">
<field name="l10n_do_payment_form" attrs="{'column_invisible': [('parent.hidden_payment_form', '=', False)]}"/>
</xpath>
</field>
</record>
</odoo>
3 changes: 2 additions & 1 deletion l10n_do_accounting_plus/views/account_payment.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>

<data>
<record id="account_payment_form_inherit_currency" model="ir.ui.view">
<field name="name">account_payment_form_currency</field>
<field name="model">account.payment</field>
Expand All @@ -17,4 +17,5 @@
</field>
</record>
</data>

</odoo>

0 comments on commit 2a7fe24

Please sign in to comment.