Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
45f93daa by Cédric Krier at 2023-07-18T22:58:23+02:00
Test company header is not empty before using its id
Closes #12363
- - - - -
3 changed files:
- modules/purchase/purchase.py
- modules/purchase_request_quotation/purchase.py
- modules/sale/sale.py
Changes:
=====================================
modules/purchase/purchase.py
=====================================
@@ -1945,7 +1945,9 @@
pool = Pool()
Date = pool.get('ir.date')
context = super().get_context(records, header, data)
- with Transaction().set_context(company=context.get('company')):
+ company = header.get('company')
+ with Transaction().set_context(
+ company=company.id if company else None):
context['today'] = Date.today()
return context
=====================================
modules/purchase_request_quotation/purchase.py
=====================================
@@ -431,7 +431,9 @@
pool = Pool()
Date = pool.get('ir.date')
context = super().get_context(records, header, data)
- with Transaction().set_context(company=header['company'].id):
+ company = header.get('company')
+ with Transaction().set_context(
+ company=company.id if company else None):
context['today'] = Date.today()
return context
=====================================
modules/sale/sale.py
=====================================
@@ -1986,7 +1986,9 @@
pool = Pool()
Date = pool.get('ir.date')
context = super().get_context(records, header, data)
- with Transaction().set_context(company=header['company'].id):
+ company = header.get('company')
+ with Transaction().set_context(
+ company=company.id if company else None):
context['today'] = Date.today()
return context
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/45f93daaa14c14bb55e47efae6fd3c2d0df05a3c
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/45f93daaa14c14bb55e47efae6fd3c2d0df05a3c
You're receiving this email because of your account on foss.heptapod.net.