From c89d934d53e043baa0a0cfba8ec868174d59207e Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Fri, 26 Feb 2016 10:52:28 +0100 Subject: [PATCH 1/5] Noupdate on datas --- account_analytic_attribution/data/install.xml | 3 +-- account_reconcile_compassion/data/statement_operation.xml | 2 +- chart_account_compassion/account.xml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/account_analytic_attribution/data/install.xml b/account_analytic_attribution/data/install.xml index 56568c770..bfdc7cc45 100644 --- a/account_analytic_attribution/data/install.xml +++ b/account_analytic_attribution/data/install.xml @@ -7,8 +7,7 @@ - - + diff --git a/account_reconcile_compassion/data/statement_operation.xml b/account_reconcile_compassion/data/statement_operation.xml index 24ee1b051..8fe0145b6 100644 --- a/account_reconcile_compassion/data/statement_operation.xml +++ b/account_reconcile_compassion/data/statement_operation.xml @@ -1,6 +1,6 @@ - + +
diff --git a/recurring_contract/wizard/recurring_invoicer_wizard.py b/recurring_contract/wizard/recurring_invoicer_wizard.py index a316614a8..82e88d632 100644 --- a/recurring_contract/wizard/recurring_invoicer_wizard.py +++ b/recurring_contract/wizard/recurring_invoicer_wizard.py @@ -20,9 +20,6 @@ class recurring_invoicer_wizard(models.TransientModel): ''' _name = 'recurring.invoicer.wizard' - invoice_ids = fields.One2many( - 'account.invoice', 'recurring_invoicer_id', - _('Generated invoices'), readonly=True) generation_date = fields.Date(_('Generation date'), readonly=True) @api.multi From b3e048df8066a40b41f70e319efcdd66fcc96e2f Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Wed, 2 Mar 2016 12:12:52 +0100 Subject: [PATCH 5/5] Correct jobs of reconciling --- .../model/bank_statement_line.py | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/account_reconcile_compassion/model/bank_statement_line.py b/account_reconcile_compassion/model/bank_statement_line.py index 74e79bfac..736d0b620 100644 --- a/account_reconcile_compassion/model/bank_statement_line.py +++ b/account_reconcile_compassion/model/bank_statement_line.py @@ -16,7 +16,7 @@ from datetime import datetime -from openerp.addons.connector.queue.job import job +from openerp.addons.connector.queue.job import job, related_action from openerp.addons.connector.session import ConnectorSession @@ -81,15 +81,15 @@ def get_move_lines_for_reconciliation( reverse=True) return res_sorted - @api.multi - def process_reconciliation(self, mv_line_dicts): + @api.model + def process_reconciliations(self, mv_line_dicts): """ Launch reconciliation in a job. """ if self.env.context.get('async_mode', True): session = ConnectorSession.from_env(self.env) - process_reconciliation_job.delay( - session, self._name, self.ids, mv_line_dicts) + process_reconciliations_job.delay( + session, self._name, mv_line_dicts) else: - self._process_reconciliation(mv_line_dicts) + self._process_reconciliations(mv_line_dicts) @api.model def product_id_changed(self, product_id, date): @@ -108,8 +108,13 @@ def product_id_changed(self, product_id, date): ########################################################################## # PRIVATE METHODS # ########################################################################## + @api.model + def _process_reconciliations(self, mv_line_dicts): + super(bank_statement_line, self).process_reconciliations( + mv_line_dicts) + @api.one - def _process_reconciliation(self, mv_line_dicts): + def process_reconciliation(self, mv_line_dicts): """ Create invoice if product_id is set in move_lines to be created. """ partner_invoices = dict() @@ -294,8 +299,24 @@ def _find_open_invoice(self, mv_line_dicts): ############################################################################## # CONNECTOR METHODS # ############################################################################## +def related_action_reconciliations(session, job): + line_ids = [arg[0] for arg in job.args[1]] + statement_lines = session.env[job.args[0]].browse(line_ids) + statement_ids = statement_lines.mapped('statement_id').ids + action = { + 'name': _("Bank statements"), + 'type': 'ir.actions.act_window', + 'res_model': 'account.bank.statement', + 'view_type': 'form', + 'view_mode': 'form,tree', + 'res_id': statement_ids[0], + 'domain': [('id', 'in', statement_ids)], + } + return action + + @job(default_channel='root.reconciliation') -def process_reconciliation_job(session, model_name, line_ids, mv_line_dicts): +@related_action(action=related_action_reconciliations) +def process_reconciliations_job(session, model_name, mv_line_dicts): """Job for reconciling bank statment lines.""" - statement_lines = session.env[model_name].browse(line_ids) - statement_lines._process_reconciliation(mv_line_dicts) + session.env[model_name]._process_reconciliations(mv_line_dicts)