-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] base_delivery_carrier_files_document
- Loading branch information
1 parent
6bc7f90
commit 3369d0f
Showing
14 changed files
with
201 additions
and
217 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
**This file is going to be generated by oca-gen-addon-readme.** | ||
|
||
*Manual changes will be overwritten.* | ||
|
||
Please provide content in the ``readme`` directory: | ||
|
||
* **DESCRIPTION.rst** (required) | ||
* INSTALL.rst (optional) | ||
* CONFIGURE.rst (optional) | ||
* **USAGE.rst** (optional, highly recommended) | ||
* DEVELOP.rst (optional) | ||
* ROADMAP.rst (optional) | ||
* HISTORY.rst (optional, recommended) | ||
* **CONTRIBUTORS.rst** (optional, highly recommended) | ||
* CREDITS.rst (optional) | ||
|
||
Content of this README will also be drawn from the addon manifest, | ||
from keys such as name, authors, maintainers, development_status, | ||
and license. | ||
|
||
A good, one sentence summary in the manifest is also highly recommended. |
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,22 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Author: Guewen Baconnier | ||
# Copyright 2012 Camptocamp SA | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
# Copyright 2012 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import carrier_file # noqa | ||
from . import models | ||
from . import tests |
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,43 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Author: Guewen Baconnier | ||
# Copyright 2012 Camptocamp SA | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
# Copyright 2012 Camptocamp SA | ||
# Author: Guewen Baconnier | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
'name': 'Base module for picking carrier files creation for document', | ||
'version': '1.0.1', | ||
'version': '8.0.1.0.1', | ||
'category': 'Generic Modules/Warehouse', | ||
'description': """ | ||
Allow to store the carrier files in a Document directory. | ||
Auto-install when the module Document and | ||
Base Delivery Carrier Files are installed. | ||
""", | ||
'author': "Camptocamp,Odoo Community Association (OCA)", | ||
'author': 'Camptocamp,Odoo Community Association (OCA)', | ||
'license': 'AGPL-3', | ||
'website': 'http://www.camptocamp.com', | ||
'depends': ['base_delivery_carrier_files', | ||
'document'], | ||
'data': ['carrier_file_view.xml'], | ||
'demo': ['carrier_file_demo.xml'], | ||
'test': ['test/carrier_file.yml', | ||
'test/carrier_file_manual.yml'], | ||
'depends': [ | ||
'base_delivery_carrier_files', | ||
'document' | ||
], | ||
'data': [ | ||
'views/carrier_file_view.xml' | ||
], | ||
'demo': [ | ||
'demo/carrier_file_demo.xml' | ||
], | ||
'images': [], | ||
'installable': False, | ||
'installable': True, | ||
'auto_install': True, | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2012 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import delivery_carrier_file |
43 changes: 43 additions & 0 deletions
43
base_delivery_carrier_files_document/models/delivery_carrier_file.py
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2012 Camptocamp SA | ||
# Author: Guewen Baconnier | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
import base64 | ||
|
||
from openerp import api, models, fields | ||
|
||
|
||
class DeliveryCarrierFile(models.Model): | ||
_inherit = 'delivery.carrier.file' | ||
|
||
@api.model | ||
def get_write_mode_selection(self): | ||
res = super(DeliveryCarrierFile, self).get_write_mode_selection() | ||
if 'document' not in [a[0] for a in res]: | ||
res.append(('document', 'Document')) | ||
return res | ||
|
||
document_directory_id = fields.Many2one('document.directory') | ||
|
||
@api.model | ||
def _prepare_attachment(self, carrier_file, filename, file_content): | ||
return {'name': "%s_%s" % (carrier_file.name, filename), | ||
'datas_fname': filename, | ||
'datas': base64.encodestring(file_content), | ||
'parent_id': carrier_file.document_directory_id.id, | ||
'type': 'binary'} | ||
|
||
@api.multi | ||
def _write_file(self, filename, file_content): | ||
ret = True | ||
for this in self: | ||
if this.write_mode == 'document': | ||
vals = self._prepare_attachment( | ||
this, filename, file_content) | ||
self.env['ir.attachment'].create(vals) | ||
ret &= True | ||
else: | ||
ret &= super(DeliveryCarrierFile, this)._write_file( | ||
filename, file_content) | ||
return ret |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Guewen Baconnier <[email protected]> | ||
* Tom Blauwendraat <[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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Allows to store the delivery carrier files in a Document directory. | ||
Auto-installs when the module Document and Base Delivery Carrier Files are installed. | ||
|
40 changes: 0 additions & 40 deletions
40
base_delivery_carrier_files_document/test/carrier_file.yml
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
base_delivery_carrier_files_document/test/carrier_file_manual.yml
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2012 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import test_base_delivery_carrier_files_document |
Oops, something went wrong.