Skip to content

[IMP] *: adapt tests for mysterious egg #4590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
8532118
[REM] hr_holidays: removed unused js im_status override
Atovange Apr 28, 2025
f851fc6
[FIX] html_editor,web_editor: wait for selectionchange handlers in tests
dmo-odoo May 20, 2025
7745045
[FIX] html_editor: fix non-deterministic link tests
dmo-odoo May 21, 2025
f5fab68
[FIX] partner_autocomplete: Prevent unnecessary input field display f…
dwa-odoo May 8, 2025
e544f36
[FIX] web_editor: fix caret navigation with mixed nodes
walidsahli Apr 11, 2025
1fd1174
[FIX] sale_stock: fix barcode duplication tour
mohammadhossam May 19, 2025
ec17829
[FIX] *: add spacing between addresses on reports
mano-odoo Apr 28, 2025
972cccc
[IMP] im_livechat,website_livechat: rename `country` to `country_id`
phenix-factory May 6, 2025
9fe45e2
[REF] website: rewrite website builder using owl and new html editor
ged-odoo Apr 29, 2025
4e8c951
[FIX] account: prevent TypeError when calculating days left
agbr-odoo Apr 9, 2025
156c0e4
[FIX] account: apply Bank St line regex on narration
proose May 19, 2025
560683b
[FIX] mail: properly display activity create name and type name
seb-odoo May 16, 2025
c915fe8
[FIX] stock_landed_cost: runbot error 99086
svs-odoo May 16, 2025
57bd125
[IMP] website{_sale}: improve onboarding with AI generated categories
deda-odoo Apr 9, 2025
45d41a4
[IMP] l10n_my_edi: use _commit_progress
kmagusiak Apr 17, 2025
e37a9a9
[IMP] stock: _commit_progress in run_scheduler_tasks
kmagusiak Apr 17, 2025
19d5367
[IMP] mail, mass_mailing: _commit_progress
kmagusiak Apr 17, 2025
1209d62
[IMP] base: deprecate _notify_progress
kmagusiak Apr 17, 2025
cd8238b
[FIX] website_sale: inherit website salesperson domain in settings
lvsz May 19, 2025
44c0ece
[FIX] pos_loyalty: remove duplicate when two variants with same discount
plha-odoo Apr 23, 2025
7429dc7
[FIX] html_editor: select entire cell when all content is selected
adch-odoo Apr 23, 2025
037876e
[REV] core: reflect inherits done via delegate fields
KangOl May 16, 2025
2759293
[FIX] mail : Show mails from automation rules in portal view
yoba-odoo Jan 20, 2025
c8da974
[FIX] web: core: codeEditor can take an initial cursor position
kebeclibre May 7, 2025
181e4f7
[FIX] website_sale_loyalty: prevent traceback on multireward coupons
lvsz May 13, 2025
a67b519
[REM] core: test_limits
rugo-odoo Apr 9, 2025
9ee8744
[FIX] calendar: fix mail activity schedule override
tde-banana-odoo May 21, 2025
0d3228e
[IMP] payment: copy payment providers for new companies
nipl-odoo Feb 27, 2025
1a215a0
[IMP] base: add thread_time to profiler
kmagusiak Apr 30, 2025
6756e78
[IMP] website: handle punycode safely in systray
SergeBayet May 15, 2025
5306180
[FIX] crm: fix recurring revenue fields visibility
amdi-odoo May 21, 2025
e19f59c
[FIX] stock: stock.group_production_lot was missing group to admin
Apr 23, 2025
61caeb4
[FIX] sale: compute credit_to_invoice on commercial_partner_id
lvsz May 15, 2025
ad10bdb
[FIX] repair: prevent propagation of "repair_id" to new moves
DjamelTouati May 6, 2025
bef3ada
[IMP] im_livechat: remove agent display name from channel kanban card
tsm-odoo May 20, 2025
8858d0a
[FIX] sale_project: don't use form view of SO to edit SOL
xavierbol May 12, 2025
853f6ec
[FIX] website: adapt comment for switch theme preview bypass
qsm-odoo May 15, 2025
1ce2110
[FIX] website_slides: avoid horizontal scroll on small screen
rfr-odoo May 20, 2025
4cc6c66
[FIX] account: prevent error when importing product records with tax …
assh-odoo May 20, 2025
8305df9
[FIX] mail: add missing allowUpload check in composer actions
dhrp-odoo Apr 16, 2025
4b04c40
[FIX] web: skip field validation if parent is not ready
lvsz May 20, 2025
5c51a3f
[FIX] web: round half up numbers
pipu-odoo May 21, 2025
f415931
[FIX] account: wrong conversion in invoice analysis values
hyhevic Apr 18, 2025
3b36580
[FIX] account_edi_ubl_cii,l10n_tr_nilvera_einvoice: fixes TR export
proose Apr 11, 2025
4c501b4
[FIX] mail, account, sms: various followup for many2many tags email
kmdi-odoo Apr 8, 2025
c1981f2
[FIX] fleet: update future_driver_id in batch
xavierbol May 20, 2025
b9ea0fb
[REV] account: make accounting fields not required
guva-odoo May 12, 2025
3e14359
[IMP] l10n_din5008: improve SO/Invoice layout of DIN5008
AhmedElemary57 Mar 14, 2025
3c95e75
[IMP] im_livechat: fix chat bot restart error
tsm-odoo May 21, 2025
4f4f482
[FIX] website: keep background-color properly applied on animated text
bvr-odoo Apr 16, 2025
9866c8f
[PERF] product_product: avoid injecting ids in product name_search
MohamedKasem99 Apr 29, 2025
f77e8d4
[REV] web: no quotes processing in search bar autocompletion
Polymorphe57 May 15, 2025
f864876
[REV] web: search model: no split of edited domains
Polymorphe57 May 15, 2025
8d57cdf
[IMP] web: search: display of operators
Polymorphe57 May 16, 2025
b658813
[IMP] web: facet tooltips on several lines
Polymorphe57 May 16, 2025
9185b42
[IMP] account: change payment state tag colors for better UX clarity
smjo-odoo May 15, 2025
659ec52
[CLA] JonathanStein.md
JonathanStein Apr 15, 2024
880e455
[FIX] orm: improve `_setup` performance
thle-odoo May 22, 2025
848f63d
[FIX] mail: message actions in mobile aligned correctly (non-mailbox)
alexkuhn May 20, 2025
deeee04
[FIX] l10n_es: convert number lines to manual input for mod 111
hatr-odoo May 15, 2025
9812d44
[FIX] bus: fix non deterministic page watcher test
tsm-odoo May 21, 2025
325665a
[FIX] l10n_es_edi_sii, l10n_es_edi_tbai: allow resequencing vendor bills
yajo Feb 17, 2025
3a26986
[FIX] account, sale: More accurate down payment/global discount with …
smetl May 8, 2025
4089373
[IMP] *: server actions: cleanup naming and kanban
brboi Apr 28, 2025
a325a2e
[FIX] web: Odd rows on stripped lists are not highlighted
leclerc-leo May 21, 2025
71b0d9c
[IMP] mail: rename `persona` with `res_partner_id` in notification
phenix-factory May 21, 2025
e61c35e
[FIX] website_sale: remove partner email from abandoned cart email vals
ryce-odoo Apr 15, 2025
3be3175
[CLA] Signature for Ricardo-MC
Ricardo-MC May 19, 2025
6761801
[IMP] web, *: Highlight matches in Many2XAutocomplete inputs
juliusc2066 May 5, 2025
65f084c
[IMP] base: server actions: add sequence support
brboi May 5, 2025
d6f4fb3
[IMP] website: adapt snippet_carousel_autoplay tour
aans-odoo May 7, 2025
3333a87
[IMP] website_sale_wishlist: re-enable test_01_wishlist_tour tour
aans-odoo May 7, 2025
a5b037f
[IMP] website_sale_autocomplete: re-enable test_autocomplete tour
aans-odoo May 7, 2025
4f3867f
[IMP] html_editor: support frontend url in linkpopover preview
aans-odoo May 15, 2025
60d7d15
[IMP] website: adapt megamenu_active_nav_link tour
aans-odoo May 9, 2025
e1ceb86
[IMP] website: adapt edit_menus tour
aans-odoo May 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -5495,6 +5495,7 @@ def action_invoice_sent(self):
self.ensure_one()

report_action = self.action_send_and_print()
report_action['context'].update({'allow_partners_without_mail': True})
if self.env.is_admin() and not self.env.company.external_report_layout_id and not self.env.context.get('discard_logo_check'):
report_action = self.env['ir.actions.report']._action_configure_external_report_layout(report_action, "account.action_base_document_layout_configurator")
report_action['context']['default_from_invoice'] = self.move_type == 'out_invoice'
Expand Down Expand Up @@ -5925,9 +5926,9 @@ def _get_invoice_next_payment_values(self, custom_amount=None):
next_amount_to_pay = self.amount_residual
next_payment_reference = self.name
next_due_date = epd_installment['date_maturity']
discount_date = epd_installment['line'].discount_date
discount_date = epd_installment['line'].discount_date or fields.Date.context_today(self)
discount_amount_currency = epd_installment['discount_amount_currency']
days_left = (discount_date - fields.Date.context_today(self)).days # should never be lower than 0 since epd is valid
days_left = max(0, (discount_date - fields.Date.context_today(self)).days) # should never be lower than 0 since epd is valid
if days_left > 0:
discount_msg = _(
"Discount of %(amount)s if paid within %(days)s days",
Expand Down
3 changes: 2 additions & 1 deletion addons/account/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ class AccountMoveLine(models.Model):
discount_date = fields.Date(
string='Discount Date',
store=True,
help='Last date at which the discounted amount must be paid in order for the Early Payment Discount to be granted'
help='Last date at which the discounted amount must be paid in order for the Early Payment Discount to be granted',
readonly=True
)
# Discounted amount to pay when the early payment discount is applied
discount_amount_currency = fields.Monetary(
Expand Down
2 changes: 1 addition & 1 deletion addons/account/models/account_move_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def _get_default_mail_partner_ids(self, move, mail_template, mail_lang):
partner_to = self._get_mail_default_field_value_from_template(mail_template, mail_lang, move, 'partner_to')
partner_ids = mail_template._parse_partner_to(partner_to)
partners |= self.env['res.partner'].sudo().browse(partner_ids).exists()
return partners.filtered('email')
return partners if self.env.context.get('allow_partners_without_mail') else partners.filtered('email')

# -------------------------------------------------------------------------
# ATTACHMENTS
Expand Down
3 changes: 1 addition & 2 deletions addons/account/models/account_reconcile_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class AccountReconcileModelLine(models.Model):
('percentage', 'Percentage of balance'),
('percentage_st_line', 'Percentage of statement line'),
('regex', 'From label'),
('from_transaction_details', 'From Transaction Details'),
],
required=True,
default='percentage',
Expand Down Expand Up @@ -71,7 +70,7 @@ def _validate_amount(self):
raise UserError(_("Balance percentage can't be 0"))
if record.amount_type == 'percentage' and record.amount == 0:
raise UserError(_("Statement line percentage can't be 0"))
if record.amount_type in {'regex', 'from_transaction_details'}:
if record.amount_type == 'regex':
try:
re.compile(record.amount_string)
except re.error:
Expand Down
93 changes: 53 additions & 40 deletions addons/account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _constrains_cash_basis_transition_account(self):
@api.model
@api.readonly
def name_search(self, name='', domain=None, operator='ilike', limit=100):
domain = Domain(domain)
domain = Domain(domain or Domain.TRUE)
if 'search_default_domestictax' in self.env.context:
domain &= Domain('fiscal_position_ids', '=', False) | Domain('fiscal_position_ids.is_domestic', '=', True)
if fp_id := self.env.context.get('dynamic_fiscal_position_id'):
Expand Down Expand Up @@ -1291,9 +1291,9 @@ def _import_base_line_extra_tax_data(self, base_line, extra_tax_data):
extra_tax_data
and extra_tax_data.get('manual_tax_amounts')
and base_line['currency_id'].id == extra_tax_data['currency_id']
and base_line['currency_id'].is_zero(base_line['price_unit'] - extra_tax_data['price_unit'])
and base_line['currency_id'].is_zero(base_line['discount'] - extra_tax_data['discount'])
and base_line['currency_id'].is_zero(base_line['quantity'] - extra_tax_data['quantity'])
and base_line['currency_id'].compare_amounts(base_line['price_unit'], extra_tax_data['price_unit']) == 0
and base_line['currency_id'].compare_amounts(base_line['discount'], extra_tax_data['discount']) == 0
and base_line['currency_id'].compare_amounts(base_line['quantity'], extra_tax_data['quantity']) == 0
and all(str(tax.id) in extra_tax_data['manual_tax_amounts'] for tax in base_line['tax_ids'])
):
results['manual_tax_amounts'] = extra_tax_data['manual_tax_amounts']
Expand Down Expand Up @@ -2757,7 +2757,10 @@ def _reduce_base_lines_with_grouping_function(self, base_lines, grouping_functio
quantity=1.0,
discount=0.0,
)
grouping_key = {'tax_ids': new_base_line['tax_ids']}
grouping_key = {
'tax_ids': new_base_line['tax_ids'],
'computation_key': base_line['computation_key'],
}
if grouping_function:
grouping_key.update(grouping_function(new_base_line))
grouping_key = frozendict(grouping_key)
Expand All @@ -2770,12 +2773,21 @@ def _reduce_base_lines_with_grouping_function(self, base_lines, grouping_functio
if target_base_line:
target_base_line['price_unit'] += new_base_line['price_unit']
else:
new_base_line = base_line_map[grouping_key] = self._prepare_base_line_for_taxes_computation(
target_base_line = base_line_map[grouping_key] = self._prepare_base_line_for_taxes_computation(
new_base_line,
**grouping_key,
)
target_base_line['manual_tax_amounts'] = {}
aggregated_base_lines.setdefault(grouping_key, []).append(base_line)

manual_tax_amounts = target_base_line['manual_tax_amounts']
for tax_id, amounts in (base_line['manual_tax_amounts'] or {}).items():
aggregated_amounts = manual_tax_amounts.setdefault(tax_id, {'tax_amount_currency': 0.0})
aggregated_amounts['tax_amount_currency'] += amounts['tax_amount_currency']
if 'base_amount_currency' in amounts:
aggregated_amounts.setdefault('base_amount_currency', 0.0)
aggregated_amounts['base_amount_currency'] += amounts['base_amount_currency']

# Remove zero lines.
base_line_map = {
grouping_key: base_line
Expand Down Expand Up @@ -2815,8 +2827,6 @@ def _apply_base_lines_manual_amounts_to_reach(self, base_lines, target_amount_cu
:param target_amount_currency: The expected total amount for the base lines passed as parameter.
"""
currency = base_lines[0]['currency_id']
reduced_amount_currency = self._compute_subset_base_lines_total(base_lines)
delta_reduced_amount_currency = currency.round(target_amount_currency - reduced_amount_currency)
for base_line in base_lines:
taxes_data = base_line['tax_details']['taxes_data']
if not taxes_data:
Expand All @@ -2831,6 +2841,8 @@ def _apply_base_lines_manual_amounts_to_reach(self, base_lines, target_amount_cu
base_line['manual_tax_amounts'][str(tax.id)] = tax_amounts

# Smooth distribution of the delta accross the base line, starting at the biggest one.
reduced_amount_currency = self._compute_subset_base_lines_total(base_lines)
delta_reduced_amount_currency = currency.round(target_amount_currency - reduced_amount_currency)
sorted_base_lines = sorted(
[
base_line
Expand All @@ -2845,13 +2857,16 @@ def _apply_base_lines_manual_amounts_to_reach(self, base_lines, target_amount_cu
if not nb_cents_to_distribute:
break

nb_cents = min(
max(
math.ceil(abs(base_line['tax_details']['total_excluded_currency']) * nb_cents_to_distribute / total_excluded_currency),
0.0,
),
nb_cents_to_distribute,
)
if currency.is_zero(total_excluded_currency):
nb_cents = nb_cents_to_distribute
else:
nb_cents = min(
max(
math.ceil(abs(base_line['tax_details']['total_excluded_currency']) * nb_cents_to_distribute / total_excluded_currency),
0.0,
),
nb_cents_to_distribute,
)
nb_cents_to_distribute -= nb_cents
delta = sign * nb_cents * currency.rounding

Expand All @@ -2866,7 +2881,7 @@ def _apply_base_lines_manual_amounts_to_reach(self, base_lines, target_amount_cu
if tax in first_batch:
base_line['manual_tax_amounts'][str(tax.id)]['base_amount_currency'] += delta
else:
return
break

@api.model
def _prepare_global_discount_lines(
Expand Down Expand Up @@ -2949,27 +2964,26 @@ def _prepare_global_discount_lines(
target_amount_currency = currency.round(total_currency * -percentage)

# Apply the percentage to each line.
reduced_base_lines = []
new_base_lines = self._reduce_base_lines_with_grouping_function(discountable_base_lines, grouping_function=grouping_function)
for base_line in new_base_lines:
reduced_base_line = self._prepare_base_line_for_taxes_computation(
new_base_lines = []
for base_line in discountable_base_lines:
new_base_line = self._prepare_base_line_for_taxes_computation(
base_line,
computation_key=computation_key,
price_unit=base_line['price_unit'] * -percentage,
)
self._add_tax_details_in_base_line(reduced_base_line, company)
self._add_tax_details_in_base_line(new_base_line, company)

# Propagate custom values.
for k, v in base_line.items():
if k not in reduced_base_line:
reduced_base_line[k] = v
if k not in new_base_line:
new_base_line[k] = v

reduced_base_lines.append(reduced_base_line)
new_base_lines.append(new_base_line)

if reduced_base_lines:
self._round_base_lines_tax_details(reduced_base_lines, company)
self._apply_base_lines_manual_amounts_to_reach(reduced_base_lines, target_amount_currency)
return reduced_base_lines
if new_base_lines:
self._round_base_lines_tax_details(new_base_lines, company)
self._apply_base_lines_manual_amounts_to_reach(new_base_lines, target_amount_currency)
return self._reduce_base_lines_with_grouping_function(new_base_lines, grouping_function=grouping_function)

@api.model
def _prepare_down_payment_lines(
Expand Down Expand Up @@ -3060,27 +3074,26 @@ def _prepare_down_payment_lines(
target_amount_currency = currency.round(total_currency * percentage)

# Apply the percentage to each line.
reduced_base_lines = []
new_base_lines = self._reduce_base_lines_with_grouping_function(discountable_base_lines, grouping_function=grouping_function)
for base_line in new_base_lines:
reduced_base_line = self._prepare_base_line_for_taxes_computation(
new_base_lines = []
for base_line in discountable_base_lines:
new_base_line = self._prepare_base_line_for_taxes_computation(
base_line,
computation_key=computation_key,
price_unit=base_line['price_unit'] * percentage,
)
self._add_tax_details_in_base_line(reduced_base_line, company)
self._add_tax_details_in_base_line(new_base_line, company)

# Propagate custom values.
for k, v in base_line.items():
if k not in reduced_base_line:
reduced_base_line[k] = v
if k not in new_base_line:
new_base_line[k] = v

reduced_base_lines.append(reduced_base_line)
new_base_lines.append(new_base_line)

if reduced_base_lines:
self._round_base_lines_tax_details(reduced_base_lines, company)
self._apply_base_lines_manual_amounts_to_reach(reduced_base_lines, target_amount_currency)
return reduced_base_lines
if new_base_lines:
self._round_base_lines_tax_details(new_base_lines, company)
self._apply_base_lines_manual_amounts_to_reach(new_base_lines, target_amount_currency)
return self._reduce_base_lines_with_grouping_function(new_base_lines, grouping_function=grouping_function)

# -------------------------------------------------------------------------
# END HELPERS IN BOTH PYTHON/JAVASCRIPT (account_tax.js)
Expand Down
1 change: 0 additions & 1 deletion addons/account/models/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,6 @@ def _default_display_invoice_template_pdf_report_id(self):
duplicated_bank_account_partners_count = fields.Integer(
compute='_compute_duplicated_bank_account_partners_count',
)
is_coa_installed = fields.Boolean(store=False, default=lambda partner: bool(partner.env.company.chart_template))

property_outbound_payment_method_line_id = fields.Many2one(
comodel_name='account.payment.method.line',
Expand Down
6 changes: 3 additions & 3 deletions addons/account/report/account_invoice_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def _select(self) -> SQL:
0.0) * account_currency_table.rate AS price_average,
CASE
WHEN move.move_type NOT IN ('out_invoice', 'out_receipt', 'out_refund') THEN 0.0
WHEN move.move_type = 'out_refund' THEN -line.balance * account_currency_table.rate + (line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0)) * COALESCE(product.standard_price -> line.company_id::text, to_jsonb(0.0))::float
ELSE -line.balance * account_currency_table.rate - (line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0)) * COALESCE(product.standard_price -> line.company_id::text, to_jsonb(0.0))::float
WHEN move.move_type = 'out_refund' THEN account_currency_table.rate * (-line.balance + (line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0)) * COALESCE(product.standard_price -> line.company_id::text, to_jsonb(0.0))::float)
ELSE account_currency_table.rate * (-line.balance - (line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0)) * COALESCE(product.standard_price -> line.company_id::text, to_jsonb(0.0))::float)
END
AS price_margin,
line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0) * (CASE WHEN move.move_type IN ('out_invoice','in_refund','out_receipt') THEN -1 ELSE 1 END)
account_currency_table.rate * line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0) * (CASE WHEN move.move_type IN ('out_invoice','in_refund','out_receipt') THEN -1 ELSE 1 END)
* COALESCE(product.standard_price -> line.company_id::text, to_jsonb(0.0))::float AS inventory_value,
COALESCE(partner.country_id, commercial_partner.country_id) AS country_id,
line.currency_id AS currency_id
Expand Down
Loading