diff --git a/l10n_do_accounting_plus/__manifest__.py b/l10n_do_accounting_plus/__manifest__.py index 2881f8aed..99418eefd 100644 --- a/l10n_do_accounting_plus/__manifest__.py +++ b/l10n_do_accounting_plus/__manifest__.py @@ -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", diff --git a/l10n_do_accounting_plus/models/__init__.py b/l10n_do_accounting_plus/models/__init__.py index bade2dff7..24d36c9df 100644 --- a/l10n_do_accounting_plus/models/__init__.py +++ b/l10n_do_accounting_plus/models/__init__.py @@ -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 diff --git a/l10n_do_accounting_plus/models/account_journal.py b/l10n_do_accounting_plus/models/account_journal.py index 7c0eec56e..a001d652d 100644 --- a/l10n_do_accounting_plus/models/account_journal.py +++ b/l10n_do_accounting_plus/models/account_journal.py @@ -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' @@ -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') + ] \ No newline at end of file diff --git a/l10n_do_accounting_plus/models/account_move.py b/l10n_do_accounting_plus/models/account_move.py index ea72582cc..0febd62bf 100644 --- a/l10n_do_accounting_plus/models/account_move.py +++ b/l10n_do_accounting_plus/models/account_move.py @@ -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 diff --git a/l10n_do_accounting_plus/models/res_config_setting.py b/l10n_do_accounting_plus/models/res_config_setting.py index a79cfe33d..d40fcb3f8 100644 --- a/l10n_do_accounting_plus/models/res_config_setting.py +++ b/l10n_do_accounting_plus/models/res_config_setting.py @@ -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') diff --git a/l10n_do_accounting_plus/models/res_currency_rate.py b/l10n_do_accounting_plus/models/res_currency_rate.py deleted file mode 100644 index 7f2b54c5d..000000000 --- a/l10n_do_accounting_plus/models/res_currency_rate.py +++ /dev/null @@ -1,13 +0,0 @@ -from odoo import fields, models, api - - -class ResCurrencyRate(models.Model): - _inherit = 'res.currency.rate' - _description = 'Description' - - converted = fields.Float(readonly=False, digits=(2, 2)) - - @api.onchange("converted") - def _get_converted(self): - if self.converted > 0: - self.rate = 1 / self.converted diff --git a/l10n_do_accounting_plus/static/description/icon.png b/l10n_do_accounting_plus/static/description/icon.png new file mode 100644 index 000000000..82baa8546 Binary files /dev/null and b/l10n_do_accounting_plus/static/description/icon.png differ diff --git a/l10n_do_accounting_plus/views/account_journal_views.xml b/l10n_do_accounting_plus/views/account_journal_views.xml new file mode 100644 index 000000000..1b1828bd6 --- /dev/null +++ b/l10n_do_accounting_plus/views/account_journal_views.xml @@ -0,0 +1,25 @@ + + + + account.journal + account.journal.form + + + + + + + { + 'invisible': ['|', '|', ('type','not in',('cash','bank')), ('country_code', '!=', 'DO'), ('hidden_payment_form', '=', True)], + 'required': [('type','in',('cash','bank')), ('country_code', '!=', 'DO')] + } + + + + + + + + + + \ No newline at end of file diff --git a/l10n_do_accounting_plus/views/account_payment.xml b/l10n_do_accounting_plus/views/account_payment.xml index 2bf483ede..999ceeb97 100644 --- a/l10n_do_accounting_plus/views/account_payment.xml +++ b/l10n_do_accounting_plus/views/account_payment.xml @@ -1,7 +1,7 @@ - + account_payment_form_currency account.payment @@ -17,4 +17,5 @@ + \ No newline at end of file