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 #94

Draft
wants to merge 20 commits into
base: 14.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# generated from manifests external_dependencies
extendable_pydantic
marshmallow_objects
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
2 changes: 0 additions & 2 deletions sale_import_base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from . import datamodels
from . import components
from . import models
13 changes: 7 additions & 6 deletions sale_import_base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@
{
"name": "Sale Import Base",
"summary": "Base for importing Sale Orders through a JSON file format",
"version": "14.0.1.1.0",
"version": "14.0.2.0.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",
"extendable",
],
"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"],
"installable": True,
"external_dependencies": {"python": ["marshmallow_objects"]},
"external_dependencies": {
"python": ["extendable_pydantic"],
},
}
1 change: 0 additions & 1 deletion sale_import_base/components/__init__.py

This file was deleted.

7 changes: 0 additions & 7 deletions sale_import_base/datamodels/__init__.py

This file was deleted.

19 changes: 0 additions & 19 deletions sale_import_base/datamodels/sale_order.py

This file was deleted.

20 changes: 0 additions & 20 deletions sale_import_base/datamodels/sale_order_address.py

This file was deleted.

12 changes: 0 additions & 12 deletions sale_import_base/datamodels/sale_order_amount.py

This file was deleted.

12 changes: 0 additions & 12 deletions sale_import_base/datamodels/sale_order_customer.py

This file was deleted.

11 changes: 0 additions & 11 deletions sale_import_base/datamodels/sale_order_invoice.py

This file was deleted.

15 changes: 0 additions & 15 deletions sale_import_base/datamodels/sale_order_line.py

This file was deleted.

15 changes: 0 additions & 15 deletions sale_import_base/datamodels/sale_order_payment.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()
1 change: 1 addition & 0 deletions sale_import_base/models/sale_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class SaleChannel(models.Model):
"(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
Loading