Skip to content

Commit

Permalink
[IMP] Operation type field in invoice and clean invoice view
Browse files Browse the repository at this point in the history
  • Loading branch information
sadamo committed Apr 21, 2020
1 parent 575fcb4 commit 0859169
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
18 changes: 18 additions & 0 deletions l10n_br_account_payment_cobranca/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ def _compute_receivables(self):
readonly=True,
)

operation_type = fields.Selection(
related='payment_mode_id.operation_type',
)

def register_invoice_api(self):
""" Registrar o boleto via sua API"""
raise NotImplementedError
Expand Down Expand Up @@ -415,6 +419,20 @@ def invoice_validate(self):
filtered_invoice_ids.create_account_payment_line()
return result

@api.multi
def _prepare_new_payment_order(self, payment_mode=None):
vals = super(AccountInvoice, self)._prepare_new_payment_order(
payment_mode)
if payment_mode is None:
payment_mode = self.env['account.payment.mode']
vals.update(
{
'operation_type': payment_mode.operation_type or
self.payment_mode_id.operation_type
}
)
return vals

@api.multi
def assign_outstanding_credit(self, credit_aml_id):
self.ensure_one()
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_account_payment_cobranca/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ResCompany(models.Model):
(SEQUENCIAL_CARTEIRA, "Sequêncial único por carteira"),
],
string="Tipo de nosso número",
default="2",
default=SEQUENCIAL_FATURA,
)

own_number_sequence = fields.Many2one(
Expand Down
37 changes: 22 additions & 15 deletions l10n_br_account_payment_cobranca/views/account_invoice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,40 @@
<field name="name">view.l10n_br_account.invoice.form.form.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id"
ref="account.invoice_supplier_form"/>
ref="account_payment_order.invoice_form"/>
<field name="arch" type="xml">
<button name="create_account_payment_line" position="attributes">
<attribute name="invisible">1</attribute>
</button>
<!-- <xpath expr="//field[@name='move_id']" position="after">-->
<!-- <field name="state_cnab"/>-->
<!-- <field name="nosso_numero"/>-->
<!-- </xpath>-->
<header position="inside">
<!-- <header position="inside">-->
<!-- <field name="eval_state_cnab" invisible="1"/>-->
<button name="%(account_invoice_api_action)d"
string="Registrar Boleto via API" type="action"
groups="base.group_user"
class="oe_highlight" style="background-color:red; text-color:white;"
attrs="{'invisible': ['|','|',
('state', '!=', 'open')
]}"
/>
<!-- <button name="%(account_invoice_api_action)d"-->
<!-- string="Registrar Boleto via API" type="action"-->
<!-- groups="base.group_user"-->
<!-- class="oe_highlight" style="background-color:red; text-color:white;"-->
<!-- attrs="{'invisible': ['|','|',-->
<!-- ('state', '!=', 'open')-->
<!-- ]}"-->
<!-- />-->
<!-- ('eval_state_cnab', 'in', ('added_paid', 'accepted', 'done', 'accepted_hml')),-->
<!-- ('eval_situacao_pagamento', 'in', ('aberta'))-->
</header>
<!-- </header>-->

<!-- <field name="payment_mode_id" position="after">-->
<!-- <field name="eval_state_cnab" attrs="{'invisible': [('eval_state_cnab', '=', False)]}"/>-->
<!-- <field name="eval_situacao_pagamento" attrs="{'invisible': [('eval_situacao_pagamento', '=', False)]}"/>-->
<!-- </field>-->

<notebook position="inside">
<page string="Instruções de Cobrança">
<page string="Vencimentos" name="vencimentos">
<field name="operation_type" invisible="1"/>
<field name="move_line_receivable_ids"/>
</page>
<page string="Instruções de Cobrança" attrs="{'invisible': [('operation_type', '!=', '3')]}">
<group>
<separator string="Instruções do Modo de Pagamento" />
<field name="eval_payment_mode_instrucoes" nolabel="1" colspan="4"
Expand All @@ -82,9 +89,9 @@
<field name="instrucoes" class="oe_inline" nolabel="=1" colspan="4"/>
</group>
</page>
<page string="Operações Bancárias Via API">
<field name="bank_api_operation_ids" class="oe_inline" readonly="True"/>
</page>
<!-- <page string="Operações Bancárias Via API">-->
<!-- <field name="bank_api_operation_ids" class="oe_inline" readonly="True"/>-->
<!-- </page>-->
</notebook>
</field>
</record>
Expand Down

0 comments on commit 0859169

Please sign in to comment.