Skip to content

Commit

Permalink
Merge 30faf48 into 99e3598
Browse files Browse the repository at this point in the history
  • Loading branch information
klogas committed Aug 24, 2020
2 parents 99e3598 + 30faf48 commit 6ac3309
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 37 deletions.
2 changes: 1 addition & 1 deletion account_payment_group/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "13.0.1.1.0",
"category": "Accounting",
"website": "www.adhoc.com.ar",
"author": "ADHOC SA,",
"author": "ADHOC SA, AITIC S.A.S",
"license": "AGPL-3",
"application": False,
'installable': True,
Expand Down
79 changes: 46 additions & 33 deletions account_payment_group/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ msgid "Cancel"
msgstr "Cancelar"

#. module: account_payment_group
#: selection:account.payment.group,state:0
#: model:ir.model.fields.selection,name:account_payment_group.selection__account_payment_group__state__cancel
msgid "Cancelled"
msgstr "Cancelado"

Expand Down Expand Up @@ -216,7 +216,7 @@ msgid "Confirm payments (only if double validation is enabled)"
msgstr "Confirmar pagos (solo si esta habilitada la doble validación)"

#. module: account_payment_group
#: selection:account.payment.group,state:0
#: model:ir.model.fields.selection,name:account_payment_group.selection__account_payment_group__state__confirmed
msgid "Confirmed"
msgstr "Confirmado"

Expand Down Expand Up @@ -251,7 +251,7 @@ msgid "Currency"
msgstr "Moneda"

#. module: account_payment_group
#: selection:account.payment.group,partner_type:0
#: model:ir.model.fields.selection,name:account_payment_group.selection__account_payment_group__partner_type__customer
msgid "Customer"
msgstr "Cliente"

Expand Down Expand Up @@ -303,7 +303,7 @@ msgid "Double Validation on Payments?"
msgstr "¿Doble validación en los Pagos?"

#. module: account_payment_group
#: selection:account.payment.group,state:0
#: model:ir.model.fields.selection,name:account_payment_group.selection__account_payment_group__state__draft
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_account_payment_group_search
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_account_payment_transfer_search
msgid "Draft"
Expand Down Expand Up @@ -387,16 +387,18 @@ msgstr "Si marca nuevos mensajes requieren su atención"

#. module: account_payment_group
#: model:ir.model.fields,help:account_payment_group.field_account_payment_group__message_needaction
#: model:ir.model.fields,help:account_payment_group.field_account_payment_group__message_unread
msgid "If checked, new messages require your attention."
msgstr "Si marca, nuevos mensajes requieren su atención."

#. module: account_payment_group
#: model:ir.model.fields,help:account_payment_group.field_account_payment_group__message_has_error
#: model:ir.model.fields,help:account_payment_group.field_account_payment_group__message_has_sms_error
msgid "If checked, some messages have a delivery error."
msgstr "Si está marcado, algunos mensajes tienen un error de envío."

#. module: account_payment_group
#: model:ir.model.fields,help:account_payment_group.field_account_invoice__pay_now_journal_id
#: model:ir.model.fields,help:account_payment_group.field_account_move__pay_now_journal_id
msgid ""
"If you set a journal here, after invoice validation, the invoice will be "
"automatically paid with this journal. As manual paymentmethod is used, only "
Expand Down Expand Up @@ -429,13 +431,18 @@ msgstr "Indica que el recibo se ha enviado."
msgid "Journal"
msgstr "Diario"

#. module: account_payment_group
#: model:ir.model,name:account_payment_group.model_account_move
msgid "Journal Entries"
msgstr "Asientos contables"

#. module: account_payment_group
#: model:ir.model,name:account_payment_group.model_account_move_line
msgid "Journal Item"
msgstr "Apunte Contable"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment_group.py:546
#: code:addons/account_payment_group/models/account_payment_group.py:0
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_account_payment_group_form
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_move_line_tree
#, python-format
Expand Down Expand Up @@ -534,7 +541,7 @@ msgstr "Número de Acciones"

#. module: account_payment_group
#: model:ir.model.fields,field_description:account_payment_group.field_account_payment_group__message_has_error_counter
msgid "Number of error"
msgid "Number of errors"
msgstr "Número de error"

#. module: account_payment_group
Expand All @@ -553,7 +560,7 @@ msgid "Number of unread messages"
msgstr "Número de mensajes sin leer"

#. module: account_payment_group
#: model:ir.model.fields,field_description:account_payment_group.field_account_invoice__open_move_line_ids
#: model:ir.model.fields,field_description:account_payment_group.field_account_move__open_move_line_ids
msgid "Open Move Line"
msgstr "Apunte contable no conciliado"

Expand Down Expand Up @@ -584,12 +591,12 @@ msgid "Partner Type"
msgstr "Tipo de Empresa"

#. module: account_payment_group
#: model:ir.model.fields,field_description:account_payment_group.field_account_invoice__pay_now_journal_id
#: model:ir.model.fields,field_description:account_payment_group.field_account_move__pay_now_journal_id
msgid "Pay now Journal"
msgstr "Diario de Pago Directo"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_invoice.py:137
#: code:addons/account_payment_group/models/account_move.py:0
#, python-format
msgid "Pay now journal must have manual method!"
msgstr "El diario de pago directo debe tener método manual!"
Expand Down Expand Up @@ -622,13 +629,13 @@ msgid "Payment Group Matched Amount"
msgstr "Grupo de pago conciliado"

#. module: account_payment_group
#: model:ir.model.fields,field_description:account_payment_group.field_account_invoice__payment_group_ids
#: model:ir.model.fields,field_description:account_payment_group.field_account_move__payment_group_ids
#: model:ir.model.fields,field_description:account_payment_group.field_account_move_line__payment_group_ids
msgid "Payment Groups"
msgstr "Grupos de Pago"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment.py:321
#: code:addons/account_payment_group/models/account_payment.py:0
#: model:ir.model.fields,field_description:account_payment_group.field_account_payment_group__payment_ids
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_account_payment_group_form
#, python-format
Expand Down Expand Up @@ -666,7 +673,7 @@ msgid "Payment Type (without transfer)"
msgstr "Tipo de pago (sin transferencia)"

#. module: account_payment_group
#: code:addons/account_payment_group/wizards/account_payment_group_invoice_wizard.py:164
#: code:addons/account_payment_group/wizards/account_payment_group_invoice_wizard.py:0
#, python-format
msgid "Payment id %s"
msgstr "Id del Pago %s"
Expand Down Expand Up @@ -710,13 +717,13 @@ msgstr ""
"Puede procesar esos pagos por sus propios medios o utilizando los servicios instalados."

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment.py:182
#: code:addons/account_payment_group/models/account_payment.py:0
#, python-format
msgid "Payments with partners must be created from payments groups"
msgstr "Los pagos con empresas deben crearse desde grupos de pagos."

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment.py:187
#: code:addons/account_payment_group/models/account_payment.py:0
#, python-format
msgid ""
"Payments without partners (usually transfers) cant't have a related payment "
Expand All @@ -731,7 +738,7 @@ msgid "Pop Up"
msgstr "Pestaña emergente"

#. module: account_payment_group
#: selection:account.payment.group,state:0
#: model:ir.model.fields.selection,name:account_payment_group.selection__account_payment_group__state__posted
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_account_payment_group_search
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_account_payment_transfer_search
msgid "Posted"
Expand All @@ -753,7 +760,12 @@ msgid "Reason"
msgstr "Razón"

#. module: account_payment_group
#: selection:account.payment,payment_type_copy:0
#: model:ir.actions.report,name:account_payment_group.action_report_payment_group
msgid "Receipt / Payment Order"
msgstr "Recibo / Orden de Pago"

#. module: account_payment_group
#: model:ir.model.fields.selection,name:account_payment_group.selection__account_payment__payment_type_copy__inbound
msgid "Receive Money"
msgstr "Recibir Dinero"

Expand All @@ -768,12 +780,13 @@ msgid "Reconciled"
msgstr "Conciliado"

#. module: account_payment_group
#: model:ir.model.fields,field_description:account_payment_group.field_account_payment_group_invoice_wizard__date_invoice
#: model:ir.model.fields,field_description:account_payment_group.field_account_payment_group_invoice_wizard__invoice_date
msgid "Refund Date"
msgstr "Fecha de Devolución"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_invoice.py:61
#: code:addons/account_payment_group/models/account_move.py:0
#: code:addons/account_payment_group/models/account_payment_group.py:0
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_account_payment_group_form
#, python-format
msgid "Register Payment"
Expand Down Expand Up @@ -805,7 +818,7 @@ msgid "Selected Financial Debt"
msgstr "Deuda Financiera Seleccionada"

#. module: account_payment_group
#: selection:account.payment,payment_type_copy:0
#: model:ir.model.fields.selection,name:account_payment_group.selection__account_payment__payment_type_copy__outbound
msgid "Send Money"
msgstr "Enviar Dinero"

Expand Down Expand Up @@ -863,7 +876,7 @@ msgid "To Pay Amount"
msgstr "Importe a pagar"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment_group.py:622
#: code:addons/account_payment_group/models/account_payment_group.py:0
#, python-format
msgid "To Pay Amount and Payment Amount must be equal!"
msgstr "¡El Importe a pagar y el Importe de Pago deben ser iguales!"
Expand All @@ -875,8 +888,8 @@ msgid "To Pay Lines"
msgstr "Líneas a Pagar"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment.py:306
#: code:addons/account_payment_group/models/account_payment_group.py:593
#: code:addons/account_payment_group/models/account_payment.py:0
#: code:addons/account_payment_group/models/account_payment_group.py:0
#, python-format
msgid "To Pay Lines must be of the same account!"
msgstr "Las líneas a pagar deben ser de la misma cuenta!"
Expand Down Expand Up @@ -952,13 +965,12 @@ msgid "Validate"
msgstr "Validar"

#. module: account_payment_group
#: selection:account.payment.group,partner_type:0
#: model:ir.model.fields.selection,name:account_payment_group.selection__account_payment_group__partner_type__supplier
msgid "Vendor"
msgstr "Proveedor"

#. module: account_payment_group
#: model_terms:ir.ui.view,arch_db:account_payment_group.invoice_form
#: model_terms:ir.ui.view,arch_db:account_payment_group.invoice_supplier_form
#: model_terms:ir.ui.view,arch_db:account_payment_group.view_move_form
msgid "View Payments"
msgstr "Ver pagos"

Expand All @@ -973,32 +985,33 @@ msgid "Website communication history"
msgstr "Historial de comunicación del sitio web"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment_group.py:614
#: code:addons/account_payment_group/models/account_payment_group.py:0
#, python-format
msgid "You can not confirm a payment group without payment lines!"
msgstr "¡No puede confirmar un grupo de pagos sin líneas de pago!"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment_group.py:584
#: code:addons/account_payment_group/models/account_payment_group.py:0
#, python-format
msgid "You can not delete a payment that is already posted"
msgstr "No puede eliminar un pago que ya ha sido publicado"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_payment_group.py:524
#: code:addons/account_payment_group/models/account_payment_group.py:530
#: code:addons/account_payment_group/models/account_payment_group.py:0
#: code:addons/account_payment_group/models/account_payment_group.py:0
#, python-format
msgid "You can not send to pay lines from different partners"
msgstr "No puede enviar a pagar líneas de diferentes partners"

#. module: account_payment_group
#: code:addons/account_payment_group/models/account_invoice.py:58
#: code:addons/account_payment_group/models/account_move.py:0
#: code:addons/account_payment_group/models/account_payment_group.py:0
#, python-format
msgid "You can only register payment if invoice is open"
msgid "You can only register payment if invoice is posted and unpaid"
msgstr "Solamente puede registrar un pago si la factura está abierta"

#. module: account_payment_group
#: code:addons/account_payment_group/wizards/account_payment_group_invoice_wizard.py:117
#: code:addons/account_payment_group/wizards/account_payment_group_invoice_wizard.py:0
#, python-format
msgid "You can only set amount total if taxes are of type percentage"
msgstr ""
Expand Down
15 changes: 15 additions & 0 deletions account_payment_group/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@ def onchange_payment_group_id(self):
if self.payment_group_id.payment_difference:
self.amount = self.payment_group_id.payment_difference

#Cuando cambie la moneda del pago se recompute el valor del mismo
@api.onchange('journal_id')
def _onchange_journal(self):
update_currency = False
currency_id = self.currency_id
if (self.journal_id.currency_id and self.journal_id.currency_id != self.currency_id
) or (not self.journal_id.currency_id and self.journal_id.company_id.currency_id != self.currency_id):
update_currency = True
res = super(AccountPayment, self)._onchange_journal()
if self.journal_id and update_currency:
currency_to_id = self.journal_id.currency_id or self.journal_id.company_id.currency_id
self.amount = currency_id._convert(self.amount, currency_to_id, self.company_id,
self.payment_date or fields.Date.context_today())
return res

@api.depends('amount', 'other_currency', 'amount_company_currency')
def _compute_exchange_rate(self):
for rec in self:
Expand Down
44 changes: 42 additions & 2 deletions account_payment_group/models/account_payment_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,17 @@ def _get_to_pay_move_lines_domain(self):

def add_all(self):
for rec in self:
rec.to_pay_move_line_ids = rec.env['account.move.line'].search(
rec._get_to_pay_move_lines_domain())
# Cuando se genera el pago desde la factura debe reconocer las deudas de las
# facturas a pagar y no la deuda global.
if self._context.get('to_pay_move_line_ids', False):
to_pay_move_line_ids = self._context.get('to_pay_move_line_ids')
rec.to_pay_move_line_ids = self.env['account.move.line'].browse(
to_pay_move_line_ids).filtered(lambda x: (
x.account_id.reconcile and
x.account_id.internal_type in ('receivable', 'payable')))
else:
rec.to_pay_move_line_ids = rec.env['account.move.line'].search(
rec._get_to_pay_move_lines_domain())

def remove_all(self):
self.to_pay_move_line_ids = False
Expand Down Expand Up @@ -597,3 +606,34 @@ def message_post(self, **kwargs):
self.filtered(lambda rec: not rec.sent).write({'sent': True})
return super(AccountPaymentGroup, self.with_context(
mail_post_autofollow=True)).message_post(**kwargs)

def action_account_invoice_payment_group(self):
active_ids = self.env.context.get('active_ids')
if not active_ids:
return ''
move_ids = self.env['account.move'].browse(active_ids)
if move_ids.filtered(lambda x: x.state != 'posted') or \
move_ids.filtered(lambda x: x.invoice_payment_state != 'not_paid'):
raise ValidationError(_('You can only register payment if invoice is posted and unpaid'))
return {
'name': _('Register Payment'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'account.payment.group',
'view_id': False,
'target': 'current',
'type': 'ir.actions.act_window',
'context': {
# si bien el partner se puede adivinar desde los apuntes
# con el default de payment group, preferimos mandar por aca
# ya que puede ser un contacto y no el commercial partner (y
# en los apuntes solo hay commercial partner)
'to_pay_move_line_ids': move_ids.mapped('open_move_line_ids').ids,
'pop_up': True,
# We set this because if became from other view and in the
# context has 'create=False' you can't crate payment lines
# (for ej: subscription)
'create': True,
'default_company_id': move_ids[0].company_id.id,
},
}
10 changes: 10 additions & 0 deletions account_payment_group/views/account_payment_group_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@
</field>
</record>

<!-- Abrir el formulario de multipagos cuando se selecciona varias facturas-->
<record id="account.action_account_invoice_from_list" model="ir.actions.server">
<field name="model_id" ref="account_payment_group.model_account_payment_group"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
action = model.action_account_invoice_payment_group()
</field>
</record>

<menuitem action="action_account_payments_group" id="menu_action_account_payments_group_receivable" parent="account.menu_finance_receivables" sequence="20"/>
<menuitem action="action_account_payments_group_payable" id="menu_action_account_payments_group_payable" parent="account.menu_finance_payables" sequence="20"/>

Expand Down
2 changes: 1 addition & 1 deletion account_payment_group/views/report_payment_group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</template>

<report
string="Recibo / Orden de Pago"
string="Receipt / Payment Order"
id="action_report_payment_group"
model="account.payment.group"
report_type="qweb-pdf"
Expand Down

0 comments on commit 6ac3309

Please sign in to comment.