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

+6
View File
@@ -0,0 +1,6 @@
from . import l10n_latam_identification_type
from . import pos_config
from . import pos_order
from . import pos_session
from . import res_config_settings
from . import res_partner
@@ -0,0 +1,13 @@
from odoo import api, models
class L10n_LatamIdentificationType(models.Model):
_name = 'l10n_latam.identification.type'
_inherit = ['l10n_latam.identification.type', 'pos.load.mixin']
@api.model
def _load_pos_data_fields(self, config):
fields = super()._load_pos_data_fields(config)
if config.is_guatemalan_company:
fields.append('country_id')
return fields
+32
View File
@@ -0,0 +1,32 @@
from odoo import api, fields, models
class PosConfig(models.Model):
_inherit = 'pos.config'
l10n_gt_final_consumer_limit = fields.Monetary(
string="Final Consumer Max Amount",
currency_field='currency_id',
default=2499,
)
is_guatemalan_company = fields.Boolean(compute='_compute_is_guatemalan_company')
@api.depends('company_id')
def _compute_is_guatemalan_company(self):
for config in self:
config.is_guatemalan_company = config.company_id.country_code == 'GT'
@api.model
def _load_pos_data_read(self, records, config):
read_records = super()._load_pos_data_read(records, config)
if read_records and config.is_guatemalan_company:
read_records[0]['_consumidor_final_id'] = self.env.ref('l10n_gt_edi.final_consumer').id
return read_records
def get_limited_partners_loading(self, offset=0):
partner_ids = super().get_limited_partners_loading(offset)
if self.is_guatemalan_company:
final_consumer_id = self.env.ref('l10n_gt_edi.final_consumer').id
if (final_consumer_id,) not in partner_ids:
partner_ids.append((final_consumer_id,))
return partner_ids
+52
View File
@@ -0,0 +1,52 @@
from odoo import models
from odoo.exceptions import UserError
from odoo.tools import formatLang
class PosOrder(models.Model):
_inherit = 'pos.order'
def _prepare_invoice_vals(self):
move_vals = super()._prepare_invoice_vals()
if self.config_id.is_guatemalan_company and self.company_id.l10n_gt_edi_phrase_ids:
move_vals['l10n_gt_edi_phrase_ids'] = self.company_id.l10n_gt_edi_phrase_ids.ids
return move_vals
def _generate_pos_order_invoice(self):
if self.config_id.is_guatemalan_company:
refunds_without_invoice = self.filtered(
lambda order: order.is_refund and not order.refunded_order_id.is_invoiced
)
if refunds_without_invoice:
raise UserError(self.env._(
"The order linked to this refund has not been electronically invoiced. "
"Please make sure the original order has an electronic invoice before "
"trying to create an electronic credit note for this refund.\n"
"%(orders)s", orders="\n".join([f"{o.name} ({o.pos_reference})" for o in refunds_without_invoice])
))
# Unidentified customers restriction
commercial_partner = self.partner_id.commercial_partner_id
is_partner_cf = (
commercial_partner.id == self.env.ref('l10n_gt_edi.final_consumer').id
)
has_invalid_identification_type = (
commercial_partner.country_code == 'GT' and
commercial_partner.l10n_latam_identification_type_id.country_id.code != 'GT'
)
is_unidentified_customer = is_partner_cf or has_invalid_identification_type or not commercial_partner.vat
total_amount = sum(self.mapped('amount_total'))
limit = self.config_id.l10n_gt_final_consumer_limit
if is_unidentified_customer and total_amount > limit:
raise UserError(self.env._(
"This order exceeds the maximum amount allowed for an unidentified customer.\n"
"Maximum allowed amount: %(limit)s\n"
"Please select a customer with a valid Identification Type and Number before continuing.\n"
"%(orders)s",
orders="\n".join([f"{o.name} ({o.pos_reference})" for o in self]),
limit=formatLang(self.env, limit, currency_obj=self.currency_id),
))
return super()._generate_pos_order_invoice()
+12
View File
@@ -0,0 +1,12 @@
from odoo import api, models
class PosSession(models.Model):
_inherit = 'pos.session'
@api.model
def _load_pos_data_models(self, config):
models = super()._load_pos_data_models(config)
if config.is_guatemalan_company:
models.append('l10n_latam.identification.type')
return models
@@ -0,0 +1,10 @@
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
pos_l10n_gt_final_consumer_limit = fields.Monetary(
related='pos_config_id.l10n_gt_final_consumer_limit',
readonly=False,
)
+12
View File
@@ -0,0 +1,12 @@
from odoo import api, models
class ResPartner(models.Model):
_inherit = 'res.partner'
@api.model
def _load_pos_data_fields(self, config):
fields = super()._load_pos_data_fields(config)
if self.env.company.country_code == 'GT':
fields += ['country_code', 'commercial_partner_id', 'l10n_latam_identification_type_id']
return fields