arsi 42859bed9c [FIX] account_taxcloud: change display_type filter
Traceback when computing taxes using TaxCloud.

Steps to reproduce:
-Activate TaxCloud in accounting settings, with valids "API ID" and
 "API KEY".
-Create an invoice for a USA customer with an invoice line and
 "Fiscal Position" set to "Automatic Tax Mapping (TaxCloud)" (in the
 "Other Info" tab).
-Confirm
-->Traceback

Traceback:
File
"/src/enterprise/16.0/account_taxcloud/models/taxcloud_request.py",
line 136, in get_all_taxes_values
for item in response.CartItemsResponse.CartItemResponse:
AttributeError: 'NoneType' object has no attribute 'CartItemResponse

Explanation:
-There's a traceback when CartItem is empty (like if there are no move
 lines).
-It is empty because of the filter in the function
 '_process_lines(self, lines)'.
 --> 'lines.filtered(lambda l: not l.display_type)'.
-The goal is to take only move lines that are not Notes or Sections.
-This worked in v15 because display_type was defined as:

    display_type = fields.Selection([
            ('line_section', 'Section'),
            ('line_note', 'Note'),
        ], default=False, help="Technical field for UX purpose.")

-But now in v16 it is defined as:

    display_type = fields.Selection(
            selection=[
                ('product', 'Product'),
                ('cogs', 'Cost of Goods Sold'),
                ('tax', 'Tax'),
                ('rounding', "Rounding"),
                ('payment_term', 'Payment Term'),
                ('line_section', 'Section'),
                ('line_note', 'Note'),
                ('epd', 'Early Payment Discount'),
            ],
            compute='_compute_display_type', store=True, readonly=False,
            precompute=True, required=True,
        )

-The display_type=False does not corresponds anymore to move lines
 that are not Sections or Notes, but it corresponds to no move lines at
 all.

The fix:
 Will filter move lines that are not of type 'line_section' or
 'line_note'.

Discussion:
 Do I fix the traceback that we get when there a no move lines?  This
 'issue' is present since at least v14 and it seems like nobody ever
 complained.

+:
 I've applied the similar change to some lines in the code that also
 check if 'display_type' is False for some 'account.move.line' records.

++:
 The fix revealed an other issue in the function
  '_inter_company_create_invoices' of the file
  enterprise/account_inter_company_rules/models/account_move.py:
  There's a call on a function that doesn't exist anymore
  'line._set_price_and_tax_after_fpos()'.  I've deleted the line.

opw-3064174

closes odoo/odoo#106452

X-original-commit: 8bfca5832adaf9e147f2443d0bf56cf921f9ff0c
Related: odoo/enterprise#34352
Signed-off-by: William André (wan) <wan@odoo.com>
2022-11-24 19:25:21 +01:00
2022-10-06 14:56:52 +02:00
2022-11-23 17:14:52 +01:00
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%