Skip to content

Commit

Permalink
Módulo vinculo entre vendas e modos de pagamento
Browse files Browse the repository at this point in the history
Adiciona modo de pagamento ao pedido de venda
  • Loading branch information
danimaribeiro committed Oct 13, 2017
1 parent 9c8f172 commit 4d8e467
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 6 deletions.
3 changes: 3 additions & 0 deletions br_account_payment/views/account_invoice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<tree name="vencimentos" position="inside">
<button name="action_register_payment" type="object" string="Register Payment" groups="account.group_account_invoice" icon="fa-usd"/>
</tree>
<field name="payment_term_id" position="after">
<field name="payment_mode_id" />
</field>
</field>
</record>

Expand Down
6 changes: 0 additions & 6 deletions br_boleto/views/account_invoice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
<tree name="vencimentos" position="inside">
<button name="open_wizard_print_boleto" type="object" string="Boletos" icon="fa-barcode"/>
</tree>
<field name="date_maturity" position="before">
<field name="payment_mode_id" />
</field>
<field name="payment_term_id" position="after">
<field name="payment_mode_id" />
</field>
</field>
</record>

Expand Down
5 changes: 5 additions & 0 deletions br_sale_payment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
23 changes: 23 additions & 0 deletions br_sale_payment/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{ # pylint: disable=C8101,C8103
'name': 'Brazilian Localization Sale Payment',
'description': 'Brazilian Localization for Sale Payment',
'category': 'Localisation',
'license': 'AGPL-3',
'author': 'Trustcode',
'website': 'http://www.trustcode.com.br',
'version': '11.0.1.0.0',
'contributors': [
'Danimar Ribeiro <danimaribeiro@gmail.com>',
],
'depends': [
'sale', 'br_account_payment',
],
'data': [
'views/sale_order.xml',
],
'auto_install': True
}
5 changes: 5 additions & 0 deletions br_sale_payment/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import sale_order
19 changes: 19 additions & 0 deletions br_sale_payment/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo import api, fields, models


class SaleOrder(models.Model):
_inherit = 'sale.order'

payment_mode_id = fields.Many2one(
'payment.mode', string=u"Modo de pagamento")

@api.multi
def _prepare_invoice(self):
vals = super(SaleOrder, self)._prepare_invoice()
vals['payment_mode_id'] = self.payment_mode_id.id
return vals
15 changes: 15 additions & 0 deletions br_sale_payment/views/sale_order.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="br_sale_payment_order_form" model="ir.ui.view">
<field name="name">br_sale_payment.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="payment_term_id" position="after">
<field name="payment_mode_id" />
</field>
</field>
</record>

</odoo>

0 comments on commit 4d8e467

Please sign in to comment.