Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.0 sale quick payment #54

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
language: python
python:
- "2.7"
sudo: false
cache: pip

Expand All @@ -10,15 +13,13 @@ addons:
- python-lxml # because pip installation is slow
- wkhtmltopdf

language: python

python:
- "2.7"

env:
- VERSION="8.0" LINT_CHECK="1"
- VERSION="8.0" ODOO_REPO="odoo/odoo" LINT_CHECK="0"
- VERSION="8.0" ODOO_REPO="OCA/OCB" LINT_CHECK="0"
global:
- VERSION="8.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0"
matrix:
- LINT_CHECK="1"
- ODOO_REPO="odoo/odoo" LINT_CHECK="0"
- ODOO_REPO="OCA/OCB" LINT_CHECK="0"

virtualenv:
system_site_packages: true
Expand All @@ -31,11 +32,9 @@ install:
- git clone https://github.com/OCA/maintainer-quality-tools.git $HOME/maintainer-quality-tools
- export PATH=$HOME/maintainer-quality-tools/travis:$PATH
- travis_install_nightly
- git clone https://github.com/OCA/sale-workflow $HOME/sale-workflow -b ${VERSION}
- git clone https://github.com/OCA/bank-statement-reconcile $HOME/bank-statement-reconcile -b ${VERSION}

script:
- travis_run_tests

after_success:
coveralls
- travis_after_tests_success
84 changes: 0 additions & 84 deletions __unported__/sale_quick_payment/wizard/pay_sale_order.py

This file was deleted.

2 changes: 2 additions & 0 deletions oca_dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sale-workflow
bank-statement-reconcile
80 changes: 80 additions & 0 deletions sale_quick_payment/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==================
Sale Quick Payment
==================

Sale Quick Payment gives the possibility to pay a sale order from the
sale order itself.

The payment will be linked to the sale order.

If you install the module Sale Automatic Workflow, you can forbid the
validation of an unpaid order and the invoice will be automatically
reconciled with the payment.

This module was originally designed for the e-commerce sector, but it
does not preclude to use it in other sectors.


Configuration
=============

To configure this module, you need to to configure the payment methods which
come from the `sale_payment_method` module.

Usage
=====

Use the "Register Payments" button on the sale order to flag the order as
paid.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/e-commerce-113/8.0

For further information, please visit:

* https://www.odoo.com/forum/help-1

Known issues / Roadmap
======================

* none for now.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce}/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/e-commerce/issues/new?body=module:%20sale_quick_payment%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.


Credits
=======

Contributors
------------

* Sébastien BEAU <[email protected]>
* Guewen Baconnier <[email protected]>
* Mart Raudsepp <[email protected]>


Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,9 @@

{
'name': 'Sale Quick Payment',
'version': '0.2',
'version': '0.3',
'category': 'Generic Modules/Others',
'license': 'AGPL-3',
'description': """
Sale Quick Payment
==================

Sale Quick Payment gives the possibility to pay a sale order from the
sale order itself.

The payment will be linked to the sale order.

If you install the module Sale Automatic Workflow, you can forbid the
validation of an unpaid order and the invoice will be automatically
reconciled with the payment.

This module was originally designed for the e-commerce sector, but it
does not preclude to use it in other sectors.
""",
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com/',
'depends': ['sale_payment_method',
Expand All @@ -50,6 +34,5 @@
'sale_view.xml',
'settings/sale.exception.csv',
],
'demo': [],
'installable': False,
'installable': True,
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@
string="Register Payments"
type="action" states="draft,sent"/>
</button>
<field name="payment_method_id" position="after" >
<group name="payments" string="Generated Payments" colspan="4">
<field name="payment_ids" nolabel="1">
<tree string="Payment">
<field name="date"/>
<field name="journal_id"/>
<field name="partner_id"/>
<field name="debit"/>
<field name="credit"/>
</tree>
</field>
</group>
</field>
</field>
</record>

Expand Down
74 changes: 74 additions & 0 deletions sale_quick_payment/wizard/pay_sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# sale_quick_payment for OpenERP
# Copyright (C) 2011 Akretion Sébastien BEAU <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp import api, fields, models
import openerp.addons.decimal_precision as dp


class PaySaleOrder(models.TransientModel):
_name = 'pay.sale.order'
_description = 'Wizard to generate a payment from the sale order'

@api.model
def _default_journal_id(self):
context = self.env.context
if not context.get('active_id'):
return False
order = self.env['sale.order'].browse(context['active_id'])
if order.payment_method_id:
return order.payment_method_id.journal_id.id
return False

journal_id = fields.Many2one('account.journal', 'Journal',
default=_default_journal_id)

@api.model
def _default_amount(self):
context = self.env.context
if not context.get('active_id'):
return False
return self.env['sale.order'].browse(context['active_id']).residual

amount = fields.Float('Amount', digits=dp.get_precision('Sale Price'),
default=_default_amount)

date = fields.Datetime('Payment Date', default=fields.Datetime.now)

description = fields.Char('Description', size=64)

@api.multi
def pay_sale_order(self):
""" Pay the sale order """
self.ensure_one()
order = self.env['sale.order'].browse(self.env.context['active_id'])
order.add_payment(self.journal_id.id,
self.amount,
date=self.date,
description=self.description)
return True

@api.multi
def pay_sale_order_and_confirm(self):
""" Pay the sale order """
self.ensure_one()
self.pay_sale_order()
order = self.env['sale.order'].browse(self.env.context['active_id'])
return order.action_button_confirm()