[FIX] purchase_requisition: currency updated on blanket order vendor change

Steps to reproduce:
- install contacts and purchase
- go to purchase > configuration > settings > activate "purchase agreements"
- go to general settings and activate multi-currency
- go to contacts > select a contact > edit > sale & purchase > change the currency
- go to purchase > purchase agreements > create
- change the agreement to a blanket order > add your modified contact as the vendor

Previous behavior:
the currency is not updated

Current behavior:
the currency is updated on vendor change

opw-2177431

closes odoo/odoo#43877

X-original-commit: 764135630949eb01cb2b3a4a19d6ec5b1bd39400
Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
This commit is contained in:
jerome hanke (jhk)
2020-01-23 19:10:57 +00:00
parent e5720203fc
commit 79e6d9f93f
@@ -75,6 +75,11 @@ class PurchaseRequisition(models.Model):
@api.onchange('vendor_id')
def _onchange_vendor(self):
if not self.vendor_id:
self.currency_id = self.env.company.currency_id.id
else:
self.currency_id = self.vendor_id.property_purchase_currency_id.id or self.env.company.currency_id.id
requisitions = self.env['purchase.requisition'].search([
('vendor_id', '=', self.vendor_id.id),
('state', '=', 'ongoing'),