feat: Se añade línea para descuadres negatios en el cierre de caja, se añade cuenta en configuración para descuadres positivios
This commit is contained in:
parent
36d45a6e55
commit
f7d0a61278
@ -24,6 +24,12 @@ class Configuration(ModelSingleton, ModelView, ModelSQL):
|
|||||||
('closed', '!=', True),
|
('closed', '!=', True),
|
||||||
],)
|
],)
|
||||||
|
|
||||||
|
account_mismatch_positive = fields.Many2One('account.account', "Account Mismatch Positivo",
|
||||||
|
domain=[
|
||||||
|
('company', '=', Eval('company', 0)),
|
||||||
|
('type', '!=', None),
|
||||||
|
('closed', '!=', True),
|
||||||
|
],)
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_currency():
|
def default_currency():
|
||||||
Company = Pool().get('company.company')
|
Company = Pool().get('company.company')
|
||||||
|
26
statement.py
26
statement.py
@ -271,9 +271,13 @@ class CloseStatement(Wizard):
|
|||||||
User = pool.get('res.user')
|
User = pool.get('res.user')
|
||||||
Statement = pool.get('account.statement')
|
Statement = pool.get('account.statement')
|
||||||
StatementLine = pool.get('account.statement.line')
|
StatementLine = pool.get('account.statement.line')
|
||||||
|
ConfigurationClosure = pool.get('sale.cash_closures')
|
||||||
|
config = ConfigurationClosure(8)
|
||||||
user = Transaction().user
|
user = Transaction().user
|
||||||
user = User(user)
|
user = User(user)
|
||||||
|
employee_party = user.employee.party.id if user.employee else None
|
||||||
device = user.sale_device
|
device = user.sale_device
|
||||||
|
|
||||||
if device:
|
if device:
|
||||||
journals = [j.id for j in device.journals]
|
journals = [j.id for j in device.journals]
|
||||||
draft_statements = {
|
draft_statements = {
|
||||||
@ -290,6 +294,7 @@ class CloseStatement(Wizard):
|
|||||||
for journal in self.start.statementLines:
|
for journal in self.start.statementLines:
|
||||||
account = journal.account
|
account = journal.account
|
||||||
transfer = journal.transfer
|
transfer = journal.transfer
|
||||||
|
mismatch = journal.mismatch
|
||||||
end_balance = journal.end_balance
|
end_balance = journal.end_balance
|
||||||
journal = journal.journal
|
journal = journal.journal
|
||||||
statement = draft_statements.get(journal)
|
statement = draft_statements.get(journal)
|
||||||
@ -307,9 +312,24 @@ class CloseStatement(Wizard):
|
|||||||
account=account.id)]
|
account=account.id)]
|
||||||
)
|
)
|
||||||
statement.lines = statement.lines + conciliation
|
statement.lines = statement.lines + conciliation
|
||||||
else:
|
|
||||||
statement.end_balance = end_balance
|
if mismatch.real > 0:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if (config.mismatch_limit and config.account_mismatch_charge):
|
||||||
|
if mismatch and (abs(mismatch) >= abs(config.mismatch_limit.real)):
|
||||||
|
lines = statement.lines
|
||||||
|
if employee_party == None:
|
||||||
|
raise UserError(str("Debe definir un Empleado para el Usuario."))
|
||||||
|
conciliation_mismatch = tuple([StatementLine(
|
||||||
|
date=datetime.today().date(),
|
||||||
|
amount=mismatch,
|
||||||
|
account=config.account_mismatch_charge.id)]
|
||||||
|
)
|
||||||
|
statement.lines = statement.lines + conciliation_mismatch
|
||||||
|
end_balance = abs(end_balance) - abs(mismatch)
|
||||||
|
|
||||||
|
statement.end_balance = end_balance
|
||||||
statement.save()
|
statement.save()
|
||||||
statements.append(statement)
|
statements.append(statement)
|
||||||
results.append(gettext('sale_payment.close_statement',
|
results.append(gettext('sale_payment.close_statement',
|
||||||
|
Loading…
Reference in New Issue
Block a user