-
-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] sale_order_import: Migration to 16.0
- Loading branch information
duongtq
committed
Sep 26, 2023
1 parent
418d7df
commit 23dd7a7
Showing
11 changed files
with
108 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ Sale Order Import | |
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:35292a110f9d19dbd36bec18d748fcca76a94b2a97a60d0fe563c00d4078493f | ||
!! source digest: sha256:488cfb728bd029ca722e0084a281dfd3772ad7bd8237142ac2629be32c2493a3 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
|
@@ -17,13 +17,13 @@ Sale Order Import | |
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github | ||
:target: https://github.com/OCA/edi/tree/14.0/sale_order_import | ||
:target: https://github.com/OCA/edi/tree/16.0/sale_order_import | ||
:alt: OCA/edi | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-sale_order_import | ||
:target: https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-sale_order_import | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=14.0 | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
@@ -57,7 +57,7 @@ Bug Tracker | |
Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20sale_order_import%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20sale_order_import%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
|
@@ -77,11 +77,12 @@ Contributors | |
* Dennis Sluijk <[email protected]> | ||
* Andrea Stirpe <[email protected]> | ||
* Simone Orsi <[email protected]> | ||
* Duong (Tran Quoc) <[email protected]> | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp | ||
The migration of this module from 13.0 to 16.0 was financially supported by Camptocamp | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
@@ -96,6 +97,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose | |
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/14.0/sale_order_import>`_ project on GitHub. | ||
This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/16.0/sale_order_import>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
* Dennis Sluijk <[email protected]> | ||
* Andrea Stirpe <[email protected]> | ||
* Simone Orsi <[email protected]> | ||
* Duong (Tran Quoc) <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp | ||
The migration of this module from 13.0 to 16.0 was financially supported by Camptocamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" /> | ||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" /> | ||
<title>Sale Order Import</title> | ||
<style type="text/css"> | ||
|
||
/* | ||
:Author: David Goodger ([email protected]) | ||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ | ||
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $ | ||
:Copyright: This stylesheet has been placed in the public domain. | ||
|
||
Default cascading style sheet for the HTML output of Docutils. | ||
|
||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to | ||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to | ||
customize this style sheet. | ||
*/ | ||
|
||
|
@@ -367,9 +367,9 @@ <h1 class="title">Sale Order Import</h1> | |
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:35292a110f9d19dbd36bec18d748fcca76a94b2a97a60d0fe563c00d4078493f | ||
!! source digest: sha256:488cfb728bd029ca722e0084a281dfd3772ad7bd8237142ac2629be32c2493a3 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> | ||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/edi/tree/14.0/sale_order_import"><img alt="OCA/edi" src="https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-sale_order_import"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> | ||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/edi/tree/16.0/sale_order_import"><img alt="OCA/edi" src="https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-sale_order_import"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> | ||
<p>This module adds support for the import of electronic RFQ or orders. This module provides the base methods to import electronic orders ; it requires additional modules to support specific order formats:</p> | ||
<ul class="simple"> | ||
<li>module <em>sale_order_import_csv</em>: adds support for CSV orders,</li> | ||
|
@@ -382,61 +382,62 @@ <h1 class="title">Sale Order Import</h1> | |
<p><strong>Table of contents</strong></p> | ||
<div class="contents local topic" id="contents"> | ||
<ul class="simple"> | ||
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li> | ||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li> | ||
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul> | ||
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li> | ||
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li> | ||
<li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li> | ||
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li> | ||
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li> | ||
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li> | ||
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> | ||
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li> | ||
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> | ||
<li><a class="reference internal" href="#other-credits" id="id6">Other credits</a></li> | ||
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="section" id="usage"> | ||
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1> | ||
<h1><a class="toc-backref" href="#id1">Usage</a></h1> | ||
<p>This module adds a wizard in the sale menu named <em>Import RFQ or Order</em>. This wizard will propose you to select the order or RFQ file. Depending on the format of the file (CSV, XML or PDF) and the type of file (RFQ or order), it may propose you additional options.</p> | ||
<p>When you import an order, if there is a quotation in Odoo for the same customer, the wizard will propose you to either update the existing quotation or create a new order (in fact, it will create a new quotation, so that you are free to make some modifications before you click on the <em>Confirm Sale</em> button to convert the quotation to a sale order).</p> | ||
<p>Once the RFQ/order is imported, you should read the messages in the chatter of the quotation because it may contain important information about the import.</p> | ||
</div> | ||
<div class="section" id="bug-tracker"> | ||
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1> | ||
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1> | ||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/edi/issues">GitHub Issues</a>. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
<a class="reference external" href="https://github.com/OCA/edi/issues/new?body=module:%20sale_order_import%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> | ||
<a class="reference external" href="https://github.com/OCA/edi/issues/new?body=module:%20sale_order_import%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> | ||
<p>Do not contact contributors directly about support or help with technical issues.</p> | ||
</div> | ||
<div class="section" id="credits"> | ||
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1> | ||
<h1><a class="toc-backref" href="#id3">Credits</a></h1> | ||
<div class="section" id="authors"> | ||
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2> | ||
<h2><a class="toc-backref" href="#id4">Authors</a></h2> | ||
<ul class="simple"> | ||
<li>Akretion</li> | ||
<li>Camptocamp</li> | ||
</ul> | ||
</div> | ||
<div class="section" id="contributors"> | ||
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2> | ||
<h2><a class="toc-backref" href="#id5">Contributors</a></h2> | ||
<ul class="simple"> | ||
<li>Alexis de Lattre <<a class="reference external" href="mailto:alexis.delattre@akretion.com">alexis.delattre@akretion.com</a>></li> | ||
<li>Dennis Sluijk <<a class="reference external" href="mailto:d.sluijk@onestein.nl">d.sluijk@onestein.nl</a>></li> | ||
<li>Andrea Stirpe <<a class="reference external" href="mailto:a.stirpe@onestein.nl">a.stirpe@onestein.nl</a>></li> | ||
<li>Simone Orsi <<a class="reference external" href="mailto:simone.orsi@camptocamp.com">simone.orsi@camptocamp.com</a>></li> | ||
<li>Duong (Tran Quoc) <<a class="reference external" href="mailto:duongtq@trobz.com">duongtq@trobz.com</a>></li> | ||
</ul> | ||
</div> | ||
<div class="section" id="other-credits"> | ||
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2> | ||
<p>The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp</p> | ||
<h2><a class="toc-backref" href="#id6">Other credits</a></h2> | ||
<p>The migration of this module from 13.0 to 16.0 was financially supported by Camptocamp</p> | ||
</div> | ||
<div class="section" id="maintainers"> | ||
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2> | ||
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2> | ||
<p>This module is maintained by the OCA.</p> | ||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> | ||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use.</p> | ||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/edi/tree/14.0/sale_order_import">OCA/edi</a> project on GitHub.</p> | ||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/edi/tree/16.0/sale_order_import">OCA/edi</a> project on GitHub.</p> | ||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
# @author: Simone Orsi <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
import base64 | ||
from unittest import mock | ||
|
||
import mock | ||
from lxml import etree | ||
|
||
from odoo import exceptions | ||
|
@@ -29,23 +29,14 @@ def test_onchange_validation_not_supported(self): | |
# Test it gets called (cannot do it w/ Form) | ||
mock_file_msg = mock.patch.object(type(self.wiz_model), "_unsupported_file_msg") | ||
with mock_file_msg as mocked: | ||
with Form(self.wiz_model) as form: | ||
form.order_filename = "test.omg" | ||
with Form( | ||
self.wiz_model.with_context(default_order_filename="test.omg") | ||
) as form: | ||
form.order_file = "00100000" | ||
self.assertFalse(form.csv_import) | ||
self.assertFalse(form.doc_type) | ||
mocked.assert_called() | ||
|
||
def test_onchange_validation_csv(self): | ||
csv_data = base64.b64encode(b"id,name\n,1,Foo") | ||
|
||
with Form(self.wiz_model) as form: | ||
form.partner_id = self.partner # required by the view if CSV is set | ||
form.order_filename = "test.csv" | ||
form.order_file = csv_data | ||
self.assertTrue(form.csv_import) | ||
self.assertFalse(form.doc_type) | ||
|
||
def test_onchange_validation_xml(self): | ||
xml_data = base64.b64encode( | ||
b"<?xml version='1.0' encoding='utf-8'?><root><foo>baz</foo></root>" | ||
|
@@ -54,8 +45,9 @@ def test_onchange_validation_xml(self): | |
# Simulate bad file handling | ||
mock_parse_xml = mock.patch.object(type(self.wiz_model), "_parse_xml") | ||
|
||
with Form(self.wiz_model) as form: | ||
form.order_filename = "test.xml" | ||
with Form( | ||
self.wiz_model.with_context(default_order_filename="test.xml") | ||
) as form: | ||
with mock_parse_xml as mocked: | ||
mocked.return_value = ("", "I don't like this file") | ||
with self.assertRaisesRegex( | ||
|
@@ -66,8 +58,9 @@ def test_onchange_validation_xml(self): | |
|
||
mock_parse_order = mock.patch.object(type(self.wiz_model), "parse_xml_order") | ||
|
||
with Form(self.wiz_model) as form: | ||
form.order_filename = "test.xml" | ||
with Form( | ||
self.wiz_model.with_context(default_order_filename="test.xml") | ||
) as form: | ||
with mock_parse_order as mocked: | ||
mocked.return_value = "rfq" | ||
form.order_file = xml_data | ||
|
@@ -79,9 +72,9 @@ def test_onchange_validation_pdf(self): | |
pdf_data = self.read_test_file("test.pdf", mode="rb", as_b64=True) | ||
mock_parse_order = mock.patch.object(type(self.wiz_model), "parse_pdf_order") | ||
|
||
with Form(self.wiz_model) as form: | ||
# form.partner_id = self.partner # required by the view if CSV is set | ||
form.order_filename = "test.pdf" | ||
with Form( | ||
self.wiz_model.with_context(default_order_filename="test.pdf") | ||
) as form: | ||
with mock_parse_order as mocked: | ||
mocked.return_value = "rfq" | ||
form.order_file = pdf_data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.