Skip to content

Commit

Permalink
[ADD] stock_orderpoint_manual_update: filter by main supplier
Browse files Browse the repository at this point in the history
closes #463

Signed-off-by: Bruno Zanotti <bz@adhoc.com.ar>
  • Loading branch information
Bruno-Zanotti committed Mar 26, 2024
1 parent 8806cbf commit 6a85cd4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stock_orderpoint_manual_update/__manifest__.py
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Stock Orderpoint Manual Update',
'version': "16.0.1.1.0",
'version': "16.0.1.2.0",
'category': 'Warehouse Management',
'sequence': 14,
'summary': '',
Expand Down
Expand Up @@ -9,6 +9,7 @@ class StockWarehouseOrderpointWizard(models.TransientModel):
product_ids = fields.Many2many('product.product', string='Product')
category_ids = fields.Many2many('product.category', string='Product Category')
supplier_ids = fields.Many2many('res.partner', string='Vendor', check_company=True)
filter_by_main_supplier = fields.Boolean(string="Filter by Main Vendor")
location_ids = fields.Many2many('stock.location', string="Location")

def action_confirm(self):
Expand All @@ -34,7 +35,9 @@ def _get_orderpoint_domain(self):
orderpoint_domain.append(('product_id', 'in', self.product_ids.ids))
if self.category_ids:
orderpoint_domain.append(('product_category_id', 'in', self.category_ids.ids))
if self.supplier_ids:
if self.filter_by_main_supplier:
orderpoint_domain.append(('supplier_id.partner_id', 'in', self.supplier_ids.ids))
elif self.supplier_ids:
orderpoint_domain.append(('product_id.seller_ids.partner_id', 'in', self.supplier_ids.ids))
if self.location_ids:
orderpoint_domain.append(('location_id', 'in', self.location_ids.ids))
Expand Down
Expand Up @@ -17,6 +17,7 @@
</group>
<group col="2">
<field name="supplier_ids" widget="many2many_tags" context="{'res_partner_search_mode': 'supplier'}"></field>
<field name="filter_by_main_supplier" attrs="{'invisible': [('supplier_ids','=', [])]}"></field>
<field name="location_ids" widget="many2many_tags"/>
</group>
</group>
Expand Down

0 comments on commit 6a85cd4

Please sign in to comment.