report_stock_rule.py 599 B

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