chore: import enterprise addons 19.0 bulk snapshot

This commit is contained in:
1b-agent committed 2026-09-16 10:13:08 +00:00
commit ca4af030d3
39951 files changed
+15570005

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_move_reversal
from . import l10n_ar_afip_ws_consult
@@ -0,0 +1,20 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class AccountMoveReversal(models.TransientModel):
_inherit = "account.move.reversal"
l10n_ar_afip_fce_is_cancellation = fields.Boolean(string='FCE: Is Cancellation?',
help='Argentina: When informing a MiPyMEs (FCE) debit/credit notes in ARCA it is required to send information about whether the'
' original document has been explicitly rejected by the buyer. More information here'
' http://www.afip.gob.ar/facturadecreditoelectronica/preguntasFrecuentes/emisor-factura.asp')
def _prepare_default_reversal(self, move):
res = super()._prepare_default_reversal(move)
if move.company_id.account_fiscal_country_id.code == "AR":
res.update({
'l10n_ar_afip_fce_is_cancellation': self.l10n_ar_afip_fce_is_cancellation,
})
return res
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_account_move_reversal" model="ir.ui.view">
<field name="name">account.move.reversal.form</field>
<field name="model">account.move.reversal</field>
<field name="inherit_id" ref="l10n_latam_invoice_document.view_account_move_reversal"/>
<field name="arch" type="xml">
<field name="l10n_latam_document_number" position="after">
<field name="country_code" invisible="1"/>
<field name="l10n_ar_afip_fce_is_cancellation" invisible="country_code != 'AR'"/>
</field>
</field>
</record>
</odoo>
@@ -0,0 +1,98 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, _
from odoo.exceptions import UserError
from odoo.tools.zeep.helpers import serialize_object
import logging
_logger = logging.getLogger(__name__)
class L10n_Ar_AfipWsConsult(models.TransientModel):
_name = 'l10n_ar_afip.ws.consult'
_description = 'Consult Invoice Data in ARCA'
number = fields.Integer(required=True)
journal_id = fields.Many2one('account.journal', domain="[('l10n_ar_afip_pos_system', 'in', ['RAW_MAW', 'BFEWS', 'FEEWS'])]", required=True)
document_type_id = fields.Many2one('l10n_latam.document.type')
# Technical field used to compute the domain of the documents available for the given journal
available_document_type_ids = fields.Many2many('l10n_latam.document.type', compute='_compute_available_document_types')
consult_type = fields.Selection([('specific', 'Specific Invoice Number'), ('last', 'Get Last Invoice')], required=True,
default="specific", string="Type", help="* Specific Invoice Number: consult all the invoice information in ARCA"
" for the given number\n* Get Last Invoice: it connects to ARCA to get the last invoice number and show it in"
" the number field")
@api.onchange('journal_id')
def onchange_journal(self):
self.document_type_id = self.available_document_type_ids[0] if self.available_document_type_ids else False
@api.depends('journal_id')
def _compute_available_document_types(self):
self.available_document_type_ids = False
with_journal = self.filtered('journal_id')
for rec in with_journal:
rec.available_document_type_ids = self.env['l10n_latam.document.type'].search(
rec.journal_id._get_journal_codes_domain()
)
remaining = self - with_journal
remaining.available_document_type_ids = False
def button_confirm(self):
""" Recover infomation of an invoice that has already been authorized by ARCA.
For auditing and troubleshooting purposes you can get the detailed information of an invoice number that has
been previously sent to ARCA. You can also get the last number used in ARCA for a specific Document Type and
POS Number as support for any possible issues on the sequence synchronization between Odoo and ARCA """
self.ensure_one()
pos_number = self.journal_id.l10n_ar_afip_pos_number
afip_ws = self.journal_id.l10n_ar_afip_ws
if not afip_ws:
raise UserError(_('No ARCA WS selected on point of sale %s', self.journal_id.name))
if not self.number:
raise UserError(_('Please set the number you want to consult'))
connection = self.journal_id.company_id._l10n_ar_get_connection(afip_ws)
client, auth = connection._get_client()
res = error = False
# We need to call a different method for every webservice type and assemble the returned errors if they exist
if afip_ws == 'wsfe':
response = client.service.FECompConsultar(auth, {'CbteTipo': self.document_type_id.code, 'CbteNro': self.number, 'PtoVta': pos_number})
res = response.ResultGet
error = response.Errors
elif afip_ws == 'wsfex':
response = client.service.FEXGetCMP(auth, {'Cbte_tipo': self.document_type_id.code, 'Punto_vta': pos_number, 'Cbte_nro': self.number})
res = response.FEXResultGet
if response.FEXErr.ErrCode != 0 or response.FEXErr.ErrMsg != 'OK':
error = response.FEXErr
elif afip_ws == 'wsbfe':
response = client.service.BFEGetCMP(auth, {"Tipo_cbte": self.document_type_id.code, "Punto_vta": pos_number, "Cbte_nro": self.number})
res = response.BFEResultGet
if response.BFEErr.ErrCode != 0 or response.BFEErr.ErrMsg != 'OK':
error = '\n* Code %s: %s' % (response.BFEErr.ErrCode, response.BFEErr.ErrMsg)
if response.BFEEvents.EventCode != 0 or response.BFEEvents.EventMsg:
error += repr(response.BFEEvents)
else:
raise UserError(_('ARCA WS %s not implemented', afip_ws))
title = _('Invoice number %s\n', self.number)
if error:
_logger.warning('%s\n%s' % (title, error))
raise UserError(_("ARCA Errors: %(error)s", error=error))
msg = ''
data = serialize_object(res, dict)
for key, value in data.items():
msg += " * %s: %s\n" % (key, value or '')
raise UserError(title + msg)
@api.onchange('consult_type', 'journal_id', 'document_type_id')
def onchange_last_invoice(self):
""" Get the info of the last invoice we have in ARCA for this document tye and ARCA POS """
if self.consult_type == 'last':
if not self.journal_id or not self.document_type_id:
raise UserError(_('Please set first the Journal and the Document Type before select this option'))
self.number = self.journal_id._l10n_ar_get_afip_last_invoice_number(self.document_type_id)
else:
self.number = 0
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="l10n_ar_afip_ws_consult_form" model="ir.ui.view">
<field name="name">ARCA WS Consult form</field>
<field name="model">l10n_ar_afip.ws.consult</field>
<field name="arch" type="xml">
<form string="Consult Data in ARCA">
<div>
Get information stored in ARCA. You can get the detail information of an invoice number or you can get the last number used in ARCA for a specific Document Type and POS Number.
</div>
<group>
<field name="journal_id" options="{'no_create': True, 'no_open': True}" required="1"/>
<field name="available_document_type_ids" invisible="1"/>
<field name="document_type_id" domain="[('id', 'in', available_document_type_ids)]" options="{'no_create': True, 'no_open': True}" required="1"/>
</group>
<group>
<group>
<field name="consult_type" widget="radio"/>
<field name="number" readonly="consult_type == 'last'" force_save="1"/>
</group>
</group>
<footer>
<button string="Get Invoice Detail" name="button_confirm" type="object" class="oe_highlight" data-hotkey="q"/>
or
<button string="Cancel" class="oe_link" special="cancel" data-hotkey="x"/>
</footer>
</form>
</field>
</record>
<record id="action_l10n_ar_afip_ws_consult" model="ir.actions.act_window">
<field name="name">Consult invoice in ARCA</field>
<field name="res_model">l10n_ar_afip.ws.consult</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="menu_l10n_ar_afip_ws_consult" parent="account.menu_finance_entries" action="action_l10n_ar_afip_ws_consult" sequence="100"/>
</odoo>