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

[10.0][MIG] account_due_list (rebase on top of 9.0) #1

Open
wants to merge 33 commits into
base: 10.0-mig-account_due_list
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3496475
[ADD] account_check_printing_report_base, account_check_printing_repo…
JordiBForgeFlow Jan 24, 2017
cb4a9f2
[UPD] addons table in README.md
OCA-git-bot Jan 24, 2017
460c3d9
[ADD] setup.py
OCA-git-bot Jan 24, 2017
1942fd4
[IMP] account_due_list
pedrobaeza Oct 8, 2015
7b18af8
Add invoice salesperson to account.move.line for filtering and grouping
antespi May 11, 2016
e153227
Add fast install script for account_due_list (#87)
Jul 15, 2016
50d323e
check if currency id not changed per company, remove it from create v…
archetipo Mar 7, 2016
073e3ae
add the name of the move to the list view (#108)
JordiBForgeFlow Nov 2, 2016
eaa2b4c
OCA Transbot updated translations from Transifex
oca-transbot Mar 5, 2016
fee73a9
[MIG] migration to v9
JordiBForgeFlow Dec 28, 2016
6487bdd
Merge pull request #122 from Eficent/9.0-mig-account_due_list
pedrobaeza Mar 23, 2017
d0671ce
[UPD] addons table in README.md
OCA-git-bot Mar 24, 2017
ef9bf20
[ADD] setup.py
OCA-git-bot Mar 24, 2017
2c2ed7a
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
2385160
[MIG] Update metafiles
pedrobaeza Oct 6, 2016
03a4869
account_due_list: Include also move lines without invoice
pedrobaeza Oct 8, 2015
5d3b62b
account_due_list: Select by default "From invoice" filter
pedrobaeza Oct 14, 2015
2abcdff
OCA Transbot updated translations from Transifex
oca-transbot Mar 5, 2016
13f4abf
OCA Transbot updated translations from Transifex
oca-transbot Mar 26, 2016
e061f30
OCA Transbot updated translations from Transifex
oca-transbot Apr 9, 2016
158799e
OCA Transbot updated translations from Transifex
oca-transbot May 14, 2016
bd4c1a6
OCA Transbot updated translations from Transifex
oca-transbot May 21, 2016
0a3341b
Add fast install script for account_due_list (#87)
Jul 15, 2016
2bf4cfb
OCA Transbot updated translations from Transifex
oca-transbot Jul 16, 2016
61d9278
OCA Transbot updated translations from Transifex
oca-transbot Jul 30, 2016
4b96746
remove en.po that was erroneously created by transbot
sbidoul Aug 15, 2016
bf8e53a
third working test
scigghia Oct 20, 2016
784a865
[fix] computed methods name
scigghia Oct 20, 2016
751e44a
[fix] PEP8 and exceptions
scigghia Oct 20, 2016
b8893d8
[fix] PEP8 and exceptions
scigghia Oct 21, 2016
5900494
[fix] 8.0 pre_migration.py removed
scigghia Nov 11, 2016
b1bc990
[FIX] Rebase error
vonpupp Mar 25, 2017
b0887a9
[ADD] Contributors
vonpupp Mar 25, 2017
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: python

python:
- "2.7"

sudo: false
cache: pip

Expand All @@ -23,7 +23,7 @@ addons:

env:
global:
- VERSION="9.0" TESTS="0" LINT_CHECK="0"
- VERSION="10.0" TESTS="0" LINT_CHECK="0"
matrix:
- LINT_CHECK="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Runbot Status](https://runbot.odoo-community.org/runbot/badge/flat/96/9.0.svg)](https://runbot.odoo-community.org/runbot/repo/github-com-oca-account-payment-96)
[![Build Status](https://travis-ci.org/OCA/account-payment.svg?branch=9.0)](https://travis-ci.org/OCA/account-payment)
[![Coverage Status](https://coveralls.io/repos/OCA/account-payment/badge.png?branch=9.0)](https://coveralls.io/r/OCA/account-payment?branch=9.0)
[![Runbot Status](https://runbot.odoo-community.org/runbot/badge/flat/96/10.0.svg)](https://runbot.odoo-community.org/runbot/repo/github-com-oca-account-payment-96)
[![Build Status](https://travis-ci.org/OCA/account-payment.svg?branch=10.0)](https://travis-ci.org/OCA/account-payment)
[![Coverage Status](https://coveralls.io/repos/OCA/account-payment/badge.png?branch=10.0)](https://coveralls.io/r/OCA/account-payment?branch=10.0)

Odoo account payment modules
============================
Expand All @@ -17,11 +17,18 @@ You can find complementary modules for handling bank payment related tasks on:
* https://github.com/OCA/bank-payment

[//]: # (addons)
Available addons
----------------
addon | version | summary
--- | --- | ---
[account_check_printing_report_base](account_check_printing_report_base/) | 9.0.1.0.0 | Account Check Printing Report Base
[account_check_printing_report_dlt103](account_check_printing_report_dlt103/) | 9.0.1.0.0 | Account Check Printing Report DLT103
[account_due_list](account_due_list/) | 9.0.1.0.0 | Payments Due list

Unported addons
---------------
addon | version | summary
--- | --- | ---
[account_due_list](account_due_list/) | 8.0.0.1.0 (unported) | Payments Due list
[account_due_list_payment_mode](account_due_list_payment_mode/) | 8.0.1.0.0 (unported) | Payment due list with payment mode
[account_payment_order_to_voucher](account_payment_order_to_voucher/) | 8.0.1.0.0 (unported) | Payment order to voucher
[account_payment_term_multi_day](account_payment_term_multi_day/) | 8.0.1.0.0 (unported) | Multiple payment days for payment terms
Expand Down
71 changes: 71 additions & 0 deletions account_check_printing_report_base/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3

==================================
Account Check Printing Report Base
==================================

This module provides the basic framework for check printing, and a sample
layout.


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

Go to 'Settings / Users / Companies' and assign the desired check format.
This module proposes a basic layout, but other modues such as
"account_check_printing_report_dlt103" provide formats adjusted to known
check formats such as DLT103.


Usage
=====

* Go to 'Invoicing / Purchases / Payments'. Select one of the payments with
type 'Check' and print the check.


.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/96/9.0

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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/account-payment/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.


Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

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

* Jordi Ballester Alomar <[email protected]>
* Lois Rilo Antelo <[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 https://odoo-community.org.
8 changes: 8 additions & 0 deletions account_check_printing_report_base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import report
from . import models
27 changes: 27 additions & 0 deletions account_check_printing_report_base/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
'name': 'Account Check Printing Report Base',
'version': '9.0.1.0.0',
'license': 'AGPL-3',
'author': "Eficent,"
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
'category': 'Generic Modules/Accounting',
'website': "https://github.com/OCA/account-payment",
'depends': ['account_check_printing'],
'data': [
'security/ir.model.access.csv',
'data/report_paperformat.xml',
'data/account_payment_check_report_data.xml',
'views/report_check_base.xml',
'views/res_company_view.xml',
'views/account_payment_check_report_view.xml',
'report/account_check_writing_report.xml',
],
'installable': True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_payment_check_report_base"
model="account.payment.check.report">
<field name="name">base</field>
<field name="report">account_check_printing_report_base.report_check_base</field>
</record>
</data>
</openerp>
20 changes: 20 additions & 0 deletions account_check_printing_report_base/data/report_paperformat.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="paperformat_check" model="report.paperformat">
<field name="name"> US Bank Check</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="page_height">297</field>
<field name="page_width">210</field>
<field name="orientation">Portrait</field>
<field name="margin_top">3</field>
<field name="margin_bottom">3</field>
<field name="margin_left">3</field>
<field name="margin_right">3</field>
<field name="header_line" eval="False" />
<field name="header_spacing">3</field>
<field name="dpi">80</field>
</record>
</data>
</openerp>
10 changes: 10 additions & 0 deletions account_check_printing_report_base/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import account_payment
from . import res_company
from . import account_payment_check_report

19 changes: 19 additions & 0 deletions account_check_printing_report_base/models/account_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openerp import models, api


class AccountPayment(models.Model):
_inherit = "account.payment"

@api.multi
def do_print_checks(self):
for rec in self:
if rec.company_id.check_layout_id:
return self.env['report'].get_action(
rec, rec.company_id.check_layout_id.report)
return super(AccountPayment, self).do_print_checks()
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openerp import fields, models


class AccountPaymentCheckReport(models.Model):
_name = "account.payment.check.report"

name = fields.Char(string='Name', required=True)
report = fields.Char(string='Report name', required=True)
16 changes: 16 additions & 0 deletions account_check_printing_report_base/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openerp import models, fields


class ResCompany(models.Model):

_inherit = "res.company"

check_layout_id = fields.Many2one(
comodel_name='account.payment.check.report',
string="Check format")
7 changes: 7 additions & 0 deletions account_check_printing_report_base/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import check_print
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<openerp>
<data>
<report
id="action_report_check_base"
model="account.payment"
string="Payment Check Base"
report_type="qweb-pdf"
name="account_check_printing_report_base.report_check_base"
file="account_check_printing_report_base.report_check_base"
/>

<record id="action_report_check_base" model="ir.actions.report.xml">
<field name="paperformat_id" ref="account_check_printing_report_base.paperformat_check"/>
</record>
</data>
</openerp>
108 changes: 108 additions & 0 deletions account_check_printing_report_base/report/check_print.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openerp import api, exceptions, models, _
import time
from openerp.tools import float_is_zero


class ReportCheckPrint(models.AbstractModel):
_name = 'report.account_check_printing_report_base.report_check_base'

def fill_stars(self, amount_in_word):
if amount_in_word and len(amount_in_word) < 100:
stars = 100 - len(amount_in_word)
return ' '.join([amount_in_word, '*' * stars])
else:
return amount_in_word

@api.multi
def get_paid_lines(self, payments):
lines = {}
for payment in payments:
lines[payment.id] = []
for invoice in payment.invoice_ids:
amount_currency = 0.0
amount = 0.0
line = {
'date_due': invoice.date_due,
'reference': invoice.reference,
'number': invoice.number,
'amount_total': invoice.amount_total,
'residual': invoice.residual,
'paid_amount': 0.0
}
if invoice.type == 'out_refund':
line['amount_total'] *= -1
total_amount_to_show = 0.0
for pay in invoice.payment_move_line_ids:
payment_currency_id = False
if invoice.type in ('out_invoice', 'in_refund'):
amount = sum(
[p.amount for p in pay.matched_debit_ids if
p.debit_move_id in invoice.move_id.line_ids])
amount_currency = sum([p.amount_currency for p in
pay.matched_debit_ids if
p.debit_move_id in
invoice.move_id.line_ids])
if pay.matched_debit_ids:
payment_currency_id = all(
[p.currency_id ==
pay.matched_debit_ids[0].currency_id for p
in pay.matched_debit_ids]) \
and pay.matched_debit_ids[0].currency_id \
or False
elif invoice.type in ('in_invoice', 'out_refund'):
amount = sum(
[p.amount for p in pay.matched_credit_ids if
p.credit_move_id in invoice.move_id.line_ids])
amount_currency = sum([p.amount_currency for p in
pay.matched_credit_ids if
p.credit_move_id in
invoice.move_id.line_ids])
if pay.matched_credit_ids:
payment_currency_id = all(
[p.currency_id ==
pay.matched_credit_ids[0].currency_id for p
in pay.matched_credit_ids]) \
and pay.matched_credit_ids[0].currency_id \
or False

if payment_currency_id and payment_currency_id == \
invoice.currency_id:
amount_to_show = amount_currency
else:
amount_to_show = pay.company_id.currency_id.\
with_context(date=pay.date).compute(
amount, invoice.currency_id)
if not float_is_zero(
amount_to_show,
precision_rounding=invoice.currency_id.rounding):
total_amount_to_show += amount_to_show
if invoice.type in ['in_refund', 'out_refund']:
total_amount_to_show *= -1
line['paid_amount'] = total_amount_to_show
lines[payment.id].append(line)
return lines

@api.multi
def render_html(self, data):
payments = self.env['account.payment'].browse(self.ids)
paid_lines = self.get_paid_lines(payments)
docargs = {
'doc_ids': self.ids,
'doc_model': 'account.payment',
'docs': payments,
'time': time,
'fill_stars': self.fill_stars,
'paid_lines': paid_lines
}

if self.env.user.company_id.check_layout_id:
return self.env['report'].render(
self.env.user.company_id.check_layout_id.report,
docargs)
raise exceptions.Warning(_('You must define a check layout'))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_payment_check_report_invoicing,account.payment.check.report invoicing,model_account_payment_check_report,account.group_account_invoice,1,0,0,0
access_account_payment_check_report_account_manager,account.payment.check.report account.manager,model_account_payment_check_report,account.group_account_manager,1,1,1,1
5 changes: 5 additions & 0 deletions account_check_printing_report_base/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import test_check_printing_report
Loading