diff --git a/base_delivery_carrier_files/__manifest__.py b/base_delivery_carrier_files/__manifest__.py index 0196e289e8..1ac44d8b6a 100644 --- a/base_delivery_carrier_files/__manifest__.py +++ b/base_delivery_carrier_files/__manifest__.py @@ -20,14 +20,7 @@ 'wizards/generate_carrier_files_view.xml', 'security/ir.model.access.csv' ], - 'demo': [ - 'demo/carrier_file_demo.xml', - 'demo/carrier_file_demo.yml' - ], - 'summary': """ -Base module for creation of carrier files (La Poste, TNT Express Shipper, ...). -Files are exported as text (csv, ...). -""", + 'summary': 'Base module for creation of delivery carrier files', 'images': [], 'installable': True, 'auto_install': False, diff --git a/base_delivery_carrier_files/demo/carrier_file_demo.xml b/base_delivery_carrier_files/demo/carrier_file_demo.xml deleted file mode 100644 index d49ad7a240..0000000000 --- a/base_delivery_carrier_files/demo/carrier_file_demo.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - Generic - generic - - - disk - /tmp - - - - Generic Manual - generic - - - disk - /tmp - - - - - - - - - - - - - - diff --git a/base_delivery_carrier_files/demo/carrier_file_demo.yml b/base_delivery_carrier_files/demo/carrier_file_demo.yml deleted file mode 100644 index 5963131bed..0000000000 --- a/base_delivery_carrier_files/demo/carrier_file_demo.yml +++ /dev/null @@ -1,64 +0,0 @@ -- - !record {model: stock.location, id: location_refrigerator}: - name: Refrigerator - usage: internal -- - !record {model: stock.location, id: location_delivery_counter}: - name: Delivery Counter - usage: internal -- - !record {model: stock.location, id: location_opening}: - name: opening - usage: inventory -- - !record {model: product.product, id: product_icecream}: - default_code: 001 - name: Ice Cream - type: product - categ_id: product.product_category_1 - list_price: 100.0 - standard_price: 70.0 - uom_id: product.product_uom_kgm - uom_po_id: product.product_uom_kgm - property_stock_inventory: location_opening - valuation: real_time - cost_method: average - property_stock_account_input: account.o_expense - property_stock_account_output: account.o_income - description: Ice cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events. -- - !record {model: stock.picking.type, id: outgoing_shipment_type_carrier_file}: - name: Outgoing Ice Cream - code: outgoing - sequence_id: stock.sequence_mrp_op -- - !record {model: stock.picking, id: outgoing_shipment_carrier_file}: - picking_type_id: outgoing_shipment_type_carrier_file - location_dest_id: location_delivery_counter - carrier_id: delivery.delivery_carrier -- - !record {model: stock.move, id: outgoing_shipment_icecream_carrier_file}: - picking_id: outgoing_shipment_carrier_file - product_id: product_icecream - product_uom: product.product_uom_kgm - product_uom_qty: 130.0 - location_id: location_refrigerator - location_dest_id: location_delivery_counter -- - !record {model: stock.picking.type, id: outgoing_shipment_type_carrier_file_manual}: - name: Outgoing Ice Cream - code: outgoing - sequence_id: stock.sequence_mrp_op -- - !record {model: stock.picking, id: outgoing_shipment_carrier_file_manual}: - picking_type_id: outgoing_shipment_type_carrier_file_manual - location_dest_id: location_delivery_counter - carrier_id: delivery.free_delivery_carrier -- - !record {model: stock.move, id: outgoing_shipment_icecream_carrier_file_manual}: - picking_id: outgoing_shipment_carrier_file_manual - product_id: product_icecream - product_uom: product.product_uom_kgm - product_uom_qty: 130.0 - location_id: location_refrigerator - location_dest_id: location_delivery_counter diff --git a/base_delivery_carrier_files/test/carrier_file_test_data.xml b/base_delivery_carrier_files/test/carrier_file_test_data.xml new file mode 100644 index 0000000000..c906f39348 --- /dev/null +++ b/base_delivery_carrier_files/test/carrier_file_test_data.xml @@ -0,0 +1,104 @@ + + + + + + + + Generic + generic + + + disk + /tmp + + + + Generic Manual + generic + + + disk + /tmp + + + + + + + + + + + + + + + + + + + Delivery Counter + internal + + + + opening + inventory + + + + 001 + Ice Cream + product + + 100.0 + 70.0 + + + + real_time + average + + + + + + Outgoing Ice Cream + outgoing + + + + + + + + + + + + + + 130.0 + + + + + + diff --git a/base_delivery_carrier_files/tests/test_base_delivery_carrier_files.py b/base_delivery_carrier_files/tests/test_base_delivery_carrier_files.py index 57a5d93660..84fe889ba3 100644 --- a/base_delivery_carrier_files/tests/test_base_delivery_carrier_files.py +++ b/base_delivery_carrier_files/tests/test_base_delivery_carrier_files.py @@ -10,6 +10,11 @@ class CarrierFilesTest(TransactionCase): + def setUp(self): + super(CarrierFilesTest, self).setUp() + self._load('account', 'test', 'account_minimal_test.xml') + self._load('base_delivery_carrier_files', 'test', 'carrier_file_test_data.xml') + def test_carrier_file_generation(self): """ Test carrier file generation """ # I configure the carrier file configuration diff --git a/base_delivery_carrier_files/views/carrier_file_view.xml b/base_delivery_carrier_files/views/carrier_file_view.xml index 49992e672c..622ecf7075 100644 --- a/base_delivery_carrier_files/views/carrier_file_view.xml +++ b/base_delivery_carrier_files/views/carrier_file_view.xml @@ -51,9 +51,11 @@ - - - + + + + + diff --git a/base_delivery_carrier_files/views/stock_view.xml b/base_delivery_carrier_files/views/stock_view.xml index 742ea5ff4f..dba01c4699 100644 --- a/base_delivery_carrier_files/views/stock_view.xml +++ b/base_delivery_carrier_files/views/stock_view.xml @@ -6,11 +6,9 @@ - - - - - + + + diff --git a/base_delivery_carrier_files_document/__manifest__.py b/base_delivery_carrier_files_document/__manifest__.py index e7c5d6e579..c149f5243e 100644 --- a/base_delivery_carrier_files_document/__manifest__.py +++ b/base_delivery_carrier_files_document/__manifest__.py @@ -3,11 +3,11 @@ # 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', + 'name': 'Store carrier files as attachments', 'version': '10.0.1.0.0', 'category': 'Generic Modules/Warehouse', 'summary': """ -Allow to store the carrier files in a Document directory. +Allow to store carrier files as attachments. Auto-install when the module Document and Base Delivery Carrier Files are installed. """, @@ -18,13 +18,9 @@ 'base_delivery_carrier_files', 'document' ], - 'data': [ - 'views/carrier_file_view.xml' - ], 'demo': [ 'demo/carrier_file_demo.xml' ], - 'images': [], 'installable': True, 'auto_install': True, } diff --git a/base_delivery_carrier_files_document/demo/carrier_file_demo.xml b/base_delivery_carrier_files_document/demo/carrier_file_demo.xml index ddf42b96fb..2f602ad865 100644 --- a/base_delivery_carrier_files_document/demo/carrier_file_demo.xml +++ b/base_delivery_carrier_files_document/demo/carrier_file_demo.xml @@ -3,15 +3,16 @@ - - - document - - + + Automatic carrier file + document + generic + + Manual carrier file document - + generic diff --git a/base_delivery_carrier_files_document/models/delivery_carrier_file.py b/base_delivery_carrier_files_document/models/delivery_carrier_file.py index 92c78cbf5c..00141c15b2 100644 --- a/base_delivery_carrier_files_document/models/delivery_carrier_file.py +++ b/base_delivery_carrier_files_document/models/delivery_carrier_file.py @@ -18,14 +18,11 @@ def get_write_mode_selection(self): 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 diff --git a/base_delivery_carrier_files_document/tests/test_base_delivery_carrier_files_document.py b/base_delivery_carrier_files_document/tests/test_base_delivery_carrier_files_document.py index d88f243af9..3825caa3dd 100644 --- a/base_delivery_carrier_files_document/tests/test_base_delivery_carrier_files_document.py +++ b/base_delivery_carrier_files_document/tests/test_base_delivery_carrier_files_document.py @@ -10,14 +10,11 @@ class CarrierFilesDocumentTest(TransactionCase): def test_carrier_file_generation(self): """ Test carrier file generation """ - # I set the system tempfile on the carrier file configuration - # to be sure the path will be writable carrier_file = self.env.ref( 'base_delivery_carrier_files.delivery_carrier_file') - carrier_file.write({ - 'document_directory_id': self.env.ref('document.dir_root').id, - 'write_mode': 'document' - }) + + # Save as attachment + carrier_file.write({'write_mode': 'document'}) # I set the carrier file configuration on the carrier # 'Free delivery charges' @@ -53,14 +50,11 @@ def test_carrier_file_generation(self): def test_manual_carrier_file_generation(self): """ Test manual carrier file generation """ - # I set the system tempfile on the carrier file configuration - # to be sure the path will be writable carrier_file = self.env.ref( 'base_delivery_carrier_files.delivery_carrier_file_manual') - carrier_file.write({ - 'document_directory_id': self.env.ref('document.dir_root').id, - 'write_mode': 'document' - }) + + # Save as attachment + carrier_file.write({'write_mode': 'document'}) # I set the carrier file configuration on the carrier # 'Free delivery charges'