123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- # -*- coding: utf-8 -*-
- from openerp import models, fields, tools, api
- class AccountBankStatement(models.Model):
- _inherit = 'account.bank.statement'
- @api.model
- def _default_type_statement(self):
- typeStatement = self.env['account.bank.statement.type'].search([('is_default', '=', True)],limit=1)
- return typeStatement.id if (typeStatement) else ''
- type_statement = fields.Many2one('account.bank.statement.type', string='Tipo de Caja', ondelete='restrict')
- _defaults = {
- 'type_statement': _default_type_statement,
- }
- @api.model
- def update_statement_type_defualt(self):
- type = self.env['account.bank.statement.type'].search([('is_default', '=', True)],limit=1)
- statement = self.env['account.bank.statement'].search([('type_statement', '=', False)])
- if (not statement):
- return False
- for statementUpdate in statement:
- statementUpdate.write({
- 'type_statement': type.id
- })
- # @api.multi
- # def button_cancel(self):
- # import web_pdb; web_pdb.set_trace()
- # @api.model
- # def get_statement_point_of_sale(self, id):
- # accountStatement = self.env['account.bank.statement'].browse(id)
- # decimal_precision = self.env['decimal.precision'].precision_get('Account')
- # if (not accountStatement):
- # return False
- #
- # statementPointOfSale = self._get_statement_point_of_sale(accountStatement)
- # if (not statementPointOfSale):
- # return False
- #
- # statementLine = []
- #
- # for line in statementPointOfSale:
- # lineStatement = self.env['account.bank.statement.line'].search([('name', '=', line['name'])])
- # if (not lineStatement):
- # amount = line['amount']
- #
- # statementLine.append([0, False, {
- # 'name': line['name'],
- # 'ref' : 'Responsable/'+line['userName'],
- # 'amount': round(float(amount), decimal_precision),
- # 'journal_id': accountStatement.journal_id.id,
- # 'account_id': accountStatement.journal_id.internal_account_id.id,
- # 'statement_id': accountStatement.id,
- # 'date': line['date'],
- # }])
- #
- # line = []
- #
- # if (not statementLine):
- # return False
- #
- # line = accountStatement.write({'line_ids': statementLine})
- # if (not line):
- # return False
- #
- # return len(statementLine)
- #
- # '''
- # Get Account Bank Statement Point of Sale
- # '''
- # def _get_statement_point_of_sale(self, statement):
- # statementPoint = self.env['account.bank.statement'].search([
- # ('date','=',statement.date),
- # ('journal_id.id', '=',statement.journal_id.id),
- # ('period_id.id', '=', statement.period_id.id),
- # ('type_statement', '=', 'normal'),
- # ('state', '=', 'confirm')], order='id')
- # pointSatatement = []
- #
- # for statementP in statementPoint:
- # amount = 0.0
- # for line in statementP.line_ids:
- # amount += line.amount
- #
- # if (statementP.balance_start > 0):
- # amount += statementP.balance_start
- #
- # if (amount != 0):
- # pointSatatement.append({
- # 'name': statementP.name,
- # 'date': statementP.date,
- # 'journalId': statementP.journal_id.id,
- # 'periodId': statementP.period_id.id,
- # 'userId': statementP.user_id.id,
- # 'userName': statementP.user_id.name,
- # # 'posSessionId': statementP.pos_session_id.id,
- # # 'posSessionName': statementP.pos_session_id.name,
- # 'amount': amount
- # })
- #
- # return pointSatatement
|