Skip to content
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

[14.0] sale_import_base: backport from v16 (with datamodel instead of extandable_pydantic) #95

Open
wants to merge 21 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6255f6e
Make module uninstallable
sebastienbeau Dec 30, 2022
1bd4fc7
sale_import_base: refactor and migration to V16
sebastienbeau Jan 1, 2023
0dd7bfa
sale_import_base: refactor validation
sebastienbeau Jan 2, 2023
fefaa86
sale_import_base: fix test
sebastienbeau Jan 4, 2023
24ae5d2
sale_import_base: use extendable_pydantic
sebastienbeau Jan 18, 2023
31d8272
[FIX] Adapt schema to pydantic v2
florian-dacosta Jul 28, 2023
6f7c195
[FIX] tests
florian-dacosta Jul 28, 2023
effe32e
[FIX] replace deprecated dict method by model_dump
florian-dacosta Jul 31, 2023
67a9d85
[FIX] Make main SaleOrder pydantic class extendable
florian-dacosta Sep 25, 2023
607652e
fix pre-commit stuff
florian-dacosta Jan 31, 2024
68847af
[FIX] warnings : add dummy security rule for sale.channel.importer + …
florian-dacosta Feb 16, 2024
9d60d03
IMP sale_imp_base: remove product_unique_code
bealdav May 2, 2024
d254bb4
[IMP] add crm_team_id and methods to ease inherit sale.channel.importer
clementmbr May 22, 2024
dd1d059
[IMP] search product related to its company_id
clementmbr May 22, 2024
fdf4282
[IMP] search product with no company_id
clementmbr May 23, 2024
2b9c3cc
[IMP] Add hook to allow to disable the invoice and delivery address m…
florian-dacosta Jun 5, 2024
6e4cf22
sale_import_base: be v16 ready
hparfr Aug 23, 2024
57a3cfe
[IMP] backport from v16 to v14: replace payment.provider by payment.a…
Jan 22, 2025
7d12437
[FIX] use datamodel instead of extendable_pydantic in order to keep p…
Feb 5, 2025
71e76d0
[IMP] add archive_addresses field
Feb 13, 2025
7422ad7
[IMP] dedicated method to catch product, to be able to override id
Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions queue_job_chunk/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down
2 changes: 1 addition & 1 deletion sale_import_base/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Sale Import Base
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b3c2a355c30eacde5d2e312eed69326738b51e4bcb1761d8e7a0f705bac63cee
!! source digest: sha256:404deba234e8e8dd7b3e46a4cc74e9acb4a8d478cf520d5aea51c71fad1cf748
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
3 changes: 1 addition & 2 deletions sale_import_base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from . import datamodels
from . import components
from . import models
from . import datamodels
6 changes: 3 additions & 3 deletions sale_import_base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
{
"name": "Sale Import Base",
"summary": "Base for importing Sale Orders through a JSON file format",
"version": "14.0.1.1.0",
"version": "14.0.1.2.0",
"category": "Generic Modules/Sale",
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/akretion/sale-import",
"depends": [
"queue_job_chunk",
"product_code_unique",
"datamodel",
"sale_channel_partner",
"sale_exception",
"onchange_helper",
],
"license": "AGPL-3",
"data": [
"security/ir.model.access.csv",
"data/sale_exception.xml",
"views/sale_channel.xml",
"views/sale_channel_view.xml",
"views/payment_acquirer_view.xml",
],
"demo": ["demo/demo.xml"],
Expand Down
1 change: 0 additions & 1 deletion sale_import_base/components/__init__.py

This file was deleted.

27 changes: 27 additions & 0 deletions sale_import_base/migrations/14.0.2.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Akretion France (http://www.akretion.com/)
# @author: Raphaël Reverdy <raphael.reverdy@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
if not openupgrade.column_exists(env.cr, "payment_acquirer", "ref"):
# in v16
# payment_acquirer is renamed payment_provider
# and there is another different "code" field on payment_provider
# in sale_import_base (v16) the code field is now ref
# but without migration script
# therefore, we change it here to be future proof.
openupgrade.rename_fields(
env,
[
(
"payment.aquirer",
"payment_acquirer",
"code",
"ref",
),
],
)
2 changes: 2 additions & 0 deletions sale_import_base/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from . import sale_order
from . import sale_channel
from . import payment_acquirer
from . import queue_job_chunk
from . import sale_channel_importer
7 changes: 5 additions & 2 deletions sale_import_base/models/payment_acquirer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
class PaymentAcquirer(models.Model):
_inherit = "payment.acquirer"

code = fields.Char()
# code is renamed in ref in v16
# we keep it as is, to keep compatibility only in v14
code = fields.Char(string="code", related="ref")
ref = fields.Char()

_sql_constraints = [("uniq_code", "uniq(code)", "The Acquirer code must be uniq")]
_sql_constraints = [("uniq_ref", "uniq(ref)", "The Acquirer ref must be uniq")]
20 changes: 20 additions & 0 deletions sale_import_base/models/queue_job_chunk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2022 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


from odoo import fields, models


class QueueJobChunk(models.Model):
_inherit = "queue.job.chunk"

processor = fields.Selection(
selection_add=[("sale_channel_importer", "Sale Channel Importer")]
)

def _get_processor(self):
if self.processor == "sale_channel_importer":
return self.env["sale.channel.importer"].new({"chunk_id": self.id})
else:
return super()._get_processor()
6 changes: 6 additions & 0 deletions sale_import_base/models/sale_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ class SaleChannel(models.Model):
_inherit = "sale.channel"

allow_match_on_email = fields.Boolean("Allow customer match on email")
archive_addresses = fields.Boolean(
"Automatically archive partner's addresses",
default=True,
# default = True to be backward compatible as much as possible
)
sale_orders_check_amounts_untaxed = fields.Boolean(
"(technical) Check untaxed amounts against imported values"
)
sale_orders_check_amounts_total = fields.Boolean(
"(technical) Check total amounts against imported values"
)
pricelist_id = fields.Many2one("product.pricelist", string="Pricelist")
crm_team_id = fields.Many2one("crm.team")
confirm_order = fields.Boolean(help="Confirm order after import")
invoice_order = fields.Boolean(help="Generate invoice after import")
internal_naming_method = fields.Selection(
Expand Down
Loading