diff --git a/setup/shipment_advice_cash_on_delivery/odoo/addons/shipment_advice_cash_on_delivery b/setup/shipment_advice_cash_on_delivery/odoo/addons/shipment_advice_cash_on_delivery new file mode 120000 index 00000000..74408cf6 --- /dev/null +++ b/setup/shipment_advice_cash_on_delivery/odoo/addons/shipment_advice_cash_on_delivery @@ -0,0 +1 @@ +../../../../shipment_advice_cash_on_delivery \ No newline at end of file diff --git a/setup/shipment_advice_cash_on_delivery/setup.py b/setup/shipment_advice_cash_on_delivery/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/shipment_advice_cash_on_delivery/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shipment_advice/README.rst b/shipment_advice/README.rst index ba716da9..bc5fce3d 100644 --- a/shipment_advice/README.rst +++ b/shipment_advice/README.rst @@ -61,7 +61,8 @@ Contributors * Simone Orsi * `Trobz `_: * Dung Tran - + * Tuan Tran + * Tri Doan Design ~~~~~~ diff --git a/shipment_advice/__manifest__.py b/shipment_advice/__manifest__.py index 7d94b631..ec561187 100644 --- a/shipment_advice/__manifest__.py +++ b/shipment_advice/__manifest__.py @@ -21,6 +21,7 @@ "data/ir_sequence.xml", "data/queue_job_channel.xml", "data/queue_job_function.xml", + "report/reports.xml", "views/res_config_settings.xml", "views/shipment_advice.xml", "views/stock_picking.xml", diff --git a/shipment_advice/models/shipment_advice.py b/shipment_advice/models/shipment_advice.py index 0dd792a5..05666911 100644 --- a/shipment_advice/models/shipment_advice.py +++ b/shipment_advice/models/shipment_advice.py @@ -528,3 +528,11 @@ def button_open_receptions_in_progress(self): action["views"][tree_view_index] = (view_tree.id, "tree") action["domain"] = [("id", "in", self.planned_picking_ids.ids)] return action + + def print_all_deliveryslip(self): + pickings = self.mapped("loaded_picking_ids").filtered( + lambda p: p.picking_type_code == "outgoing" and p.state != "cancel" + ) + if pickings: + return self.env.ref("stock.action_report_delivery").report_action(pickings) + return {} diff --git a/shipment_advice/readme/CONTRIBUTORS.rst b/shipment_advice/readme/CONTRIBUTORS.rst index 09f87c8c..a504ee7f 100644 --- a/shipment_advice/readme/CONTRIBUTORS.rst +++ b/shipment_advice/readme/CONTRIBUTORS.rst @@ -3,7 +3,8 @@ * Simone Orsi * `Trobz `_: * Dung Tran - + * Tuan Tran + * Tri Doan Design ~~~~~~ diff --git a/shipment_advice/tests/test_shipment_advice.py b/shipment_advice/tests/test_shipment_advice.py index 01791f45..f7eb16d2 100644 --- a/shipment_advice/tests/test_shipment_advice.py +++ b/shipment_advice/tests/test_shipment_advice.py @@ -93,6 +93,17 @@ def test_shipment_advice_done_full(self): ) ) self.assertEqual(picking.state, "done") + # Print deliveryslip + action = self.shipment_advice_out.with_context( + discard_logo_check=True + ).print_all_deliveryslip() + self.assertEqual(action.get("type"), "ir.actions.report") + self.assertEqual(action.get("report_name"), "stock.report_deliveryslip") + self.assertEqual(action.get("report_type"), "qweb-pdf") + self.assertEqual( + action.get("context").get("active_ids"), + picking.ids, + ) def test_shipment_advice_done_backorder_policy_disabled(self): """Validating a shipment with no backorder policy should let partial diff --git a/shipment_advice/views/shipment_advice.xml b/shipment_advice/views/shipment_advice.xml index 0f1a0683..6a4d10ea 100644 --- a/shipment_advice/views/shipment_advice.xml +++ b/shipment_advice/views/shipment_advice.xml @@ -60,6 +60,20 @@ class="btn-secondary" states="cancel" /> +