[10.0]Fix payment method onchange with multicompany (#374)

This commit is contained in:
Akim Juillerat
2017-08-28 18:38:17 +02:00
committed by Pedro M. Baeza
parent 951fd6f2b7
commit a667c20362
2 changed files with 7 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
{
'name': 'Account Payment Mode',
'version': '10.0.1.0.0',
'version': '10.0.1.0.1',
'license': 'AGPL-3',
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/bank-payment',

View File

@@ -117,10 +117,14 @@ class AccountPaymentMode(models.Model):
aj_ids = []
if self.payment_method_id.payment_type == 'outbound':
aj_ids = ajo.search([
('type', 'in', ('purchase_refund', 'purchase'))]).ids
('type', 'in', ('purchase_refund', 'purchase')),
('company_id', '=', self.company_id.id)
]).ids
elif self.payment_method_id.payment_type == 'inbound':
aj_ids = ajo.search([
('type', 'in', ('sale_refund', 'sale'))]).ids
('type', 'in', ('sale_refund', 'sale')),
('company_id', '=', self.company_id.id)
]).ids
self.default_journal_ids = [(6, 0, aj_ids)]
@api.onchange('generate_move')