Skip to content

Commit

Permalink
misc fixes, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhao committed Oct 25, 2023
1 parent e3745b8 commit 6e6052f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
7 changes: 2 additions & 5 deletions wms_connector/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
FILTER_DOMAINS = {
"wms_export_product_filter_id": "[]",
"wms_export_picking_in_filter_id": '[("wms_export_date", "=", False),'
' ("picking_type_id", "=", "{}"), ("state", "=", "assigned")]',
' ("picking_type_id", "=", {}), ("state", "=", "assigned")]',
"wms_export_picking_out_filter_id": '[("wms_export_date", "=", False),'
' ("picking_type_id", "=", "{}"), ("state", "=", "assigned")]',
' ("picking_type_id", "=", {}), ("state", "=", "assigned")]',
}

MAPPINGS = {
Expand Down Expand Up @@ -89,9 +89,6 @@ class StockWarehouse(models.Model):
wms_export_picking_out_cron_id = fields.Many2one("ir.cron", readonly=True)
wms_import_confirm_reception_cron_id = fields.Many2one("ir.cron", readonly=True)
wms_import_confirm_delivery_cron_id = fields.Many2one("ir.cron", readonly=True)
wms_product_sync_filter_id = fields.Many2one(
"ir.filters",
)
wms_export_product_filter_id = fields.Many2one(
"ir.filters",
)
Expand Down
27 changes: 27 additions & 0 deletions wms_connector/tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,30 @@ def test_export_repeat(self):
self.assertNewAttachmentQueue(n_products)
self.cron_export_product.method_direct_trigger()
self.assertNewAttachmentQueue(n_products)

def test_export_pickings(self):
self.env["stock.picking"].search([]).state = "assigned"
self.cron_export_picking_in.method_direct_trigger()
aq_in = len(
self.env["stock.picking"]
.search(
[
("wms_export_date", "!=", False),
("picking_type_id", "=", self.warehouse.in_type_id.id),
]
)
.ids
)
self.assertNewAttachmentQueue(aq_in)
self.cron_export_picking_out.method_direct_trigger()
aq_out = len(
self.env["stock.picking"]
.search(
[
("wms_export_date", "!=", False),
("picking_type_id", "=", self.warehouse.out_type_id.id),
]
)
.ids
)
self.assertNewAttachmentQueue(aq_in + aq_out)
7 changes: 3 additions & 4 deletions wms_connector/views/stock_warehouse.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
<div class="oe_button_box" position="inside">
<button
name="button_open_wms_sync_ids"
string="WMS sync'd products"
string="WMS sync products"
icon="fa-refresh"
class="oe_stat_button"
type="object"
/>
<button
name="button_open_wms_pickings_in"
string="View pickings in"
string="WMS sync pickings in"
icon="fa-refresh"
class="oe_stat_button"
type="object"
/>
<button
name="button_open_wms_pickings_out"
string="View pickings out"
string="WMS sync pickings out"
icon="fa-refresh"
class="oe_stat_button"
type="object"
Expand All @@ -55,7 +55,6 @@
<field name="wms_import_confirm_reception_cron_id" />
</group>
<group>
<field name="wms_product_sync_filter_id" />
<field name="wms_export_product_filter_id" />
<field name="wms_export_picking_in_filter_id" />
<field name="wms_export_picking_out_filter_id" />
Expand Down

0 comments on commit 6e6052f

Please sign in to comment.