Debian Codegraph @

addons/purchase_stock/report/report_stock_rule.py

raw
1 # -*- coding: utf-8 -*-
2 # Part of Odoo. See LICENSE file for full copyright and licensing details.
3
4 from odoo import api, models
5
6
7 class ReportStockReport_Stock_Rule(models.AbstractModel):
8 _inherit = 'report.stock.report_stock_rule'
9
10 @api.model
11 def _get_rule_loc(self, rule, product_id):
12 """ We override this method to handle buy rules which do not have a location_src_id.
13 """
14 res = super()._get_rule_loc(rule, product_id)
15 if rule.action == 'buy':
16 res['source'] = self.env.ref('stock.stock_location_suppliers')
17 return res