-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
264 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
from odoo import models, _ | ||
from odoo import models | ||
|
||
|
||
class AccountPaymentRegister(models.TransientModel): | ||
_inherit = "account.payment.register" | ||
|
||
def _compute_available_journal_ids(self): | ||
super()._compute_available_journal_ids() | ||
restrict_store = self.env['res.store'].browse(self._context.get('restrict_store_id')) | ||
restrict_store = self.env["res.store"].browse(self._context.get("restrict_store_id")) | ||
if restrict_store: | ||
for rec in self: | ||
if restrict_store.only_allow_reonciliaton_of_this_store: | ||
rec.available_journal_ids = rec.available_journal_ids.filtered( | ||
lambda x: x.store_id == restrict_store) | ||
lambda x: x.store_id == restrict_store | ||
) | ||
elif restrict_store: | ||
rec.available_journal_ids = rec.available_journal_ids.filtered( | ||
lambda x: not x.store_id.only_allow_reonciliaton_of_this_store) | ||
lambda x: not x.store_id.only_allow_reonciliaton_of_this_store | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 13 additions & 10 deletions
23
account_payment_pro_multi_store/models/account_payment.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
from odoo import models, api | ||
from odoo import models | ||
|
||
|
||
class AccountPayment(models.Model): | ||
_inherit = 'account.payment' | ||
_inherit = "account.payment" | ||
|
||
def _get_to_pay_move_lines_domain(self): | ||
""" Si soy pago de un payment group con store, y : | ||
"""Si soy pago de un payment group con store, y : | ||
* el store fuerza concilacion de mismo store, entonces buscamos deuda solo de ese store | ||
* el store NO fuerza conciliacion de mismo store, buscamos deuda de cualquier store que no fuerce este comportamiento """ | ||
* el store NO fuerza conciliacion de mismo store, buscamos deuda de cualquier store que no fuerce este comportamiento""" | ||
res = super()._get_to_pay_move_lines_domain() | ||
if self.store_id.only_allow_reonciliaton_of_this_store: | ||
res += [('store_id', '=', self.store_id.id)] | ||
res += [("store_id", "=", self.store_id.id)] | ||
if self.partner_id.commercial_partner_id.id: | ||
self.with_context(restrict_store_id=self.store_id.id)._compute_available_journal_ids() | ||
elif self.store_id: | ||
res += ['|', ('store_id', '=', False), ('store_id.only_allow_reonciliaton_of_this_store', '=', False)] | ||
res += ["|", ("store_id", "=", False), ("store_id.only_allow_reonciliaton_of_this_store", "=", False)] | ||
return res | ||
|
||
def compute_withholdings(self): | ||
# only compute withholdings for payment groups where the store is not disabling it | ||
return super( | ||
AccountPayment, self.filtered(lambda x: not x.store_id.dont_compute_withholdings)).compute_withholdings() | ||
AccountPayment, self.filtered(lambda x: not x.store_id.dont_compute_withholdings) | ||
).compute_withholdings() | ||
|
||
def _compute_available_journal_ids(self): | ||
super()._compute_available_journal_ids() | ||
restrict_store = self.env['res.store'].browse(self._context.get('restrict_store_id')) | ||
restrict_store = self.env["res.store"].browse(self._context.get("restrict_store_id")) | ||
if restrict_store: | ||
for rec in self: | ||
if restrict_store.only_allow_reonciliaton_of_this_store: | ||
rec.available_journal_ids = rec.available_journal_ids.filtered( | ||
lambda x: x.store_id == restrict_store) | ||
lambda x: x.store_id == restrict_store | ||
) | ||
elif restrict_store: | ||
rec.available_journal_ids = rec.available_journal_ids.filtered( | ||
lambda x: not x.store_id.only_allow_reonciliaton_of_this_store) | ||
lambda x: not x.store_id.only_allow_reonciliaton_of_this_store | ||
) |
Oops, something went wrong.