mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[NEW] contract_invoice_merge_by_partner: New module
This commit is contained in:
63
contract_invoice_merge_by_partner/README.rst
Normal file
63
contract_invoice_merge_by_partner/README.rst
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
.. 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
|
||||||
|
|
||||||
|
=================================
|
||||||
|
Contract Invoice Merge By Partner
|
||||||
|
=================================
|
||||||
|
|
||||||
|
This module merges same partner invoices generated by contracts.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
To install this module you need *account_invoice_merge*, available in:
|
||||||
|
|
||||||
|
* Install repository `OCA/account-invoicing <https://github.com/OCA/account-invoicing>`_.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
#. Go to ...
|
||||||
|
|
||||||
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||||
|
:alt: Try me on Runbot
|
||||||
|
:target: https://runbot.odoo-community.org/runbot/95/8.0
|
||||||
|
|
||||||
|
Known issues / Roadmap
|
||||||
|
======================
|
||||||
|
|
||||||
|
* If product supplier info min quantity is greater than procurement qty and we
|
||||||
|
have sale orders with distinct analytic account which contains this product,
|
||||||
|
each purchase order line takes seller min quantity.
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `GitHub Issues
|
||||||
|
<https://github.com/OCA/account-invoicing/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
|
||||||
|
=======
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
* Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
|
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
||||||
|
|
||||||
|
Maintainer
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. image:: http://odoo-community.org/logo.png
|
||||||
|
:alt: Odoo Community Association
|
||||||
|
:target: http://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.
|
||||||
5
contract_invoice_merge_by_partner/__init__.py
Normal file
5
contract_invoice_merge_by_partner/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from . import models
|
||||||
17
contract_invoice_merge_by_partner/__openerp__.py
Normal file
17
contract_invoice_merge_by_partner/__openerp__.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Contract Invoice Merge By Partner',
|
||||||
|
'summary': 'This module merges same partner invoices generated by '
|
||||||
|
'contracts',
|
||||||
|
'version': '8.0.1.0.0',
|
||||||
|
'category': 'Account',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'author': "Tecnativa, "
|
||||||
|
"Odoo Community Association (OCA)",
|
||||||
|
'website': 'http://www.tecnativa.com',
|
||||||
|
'depends': ['account_analytic_analysis', 'account_invoice_merge'],
|
||||||
|
'installable': True,
|
||||||
|
}
|
||||||
5
contract_invoice_merge_by_partner/models/__init__.py
Normal file
5
contract_invoice_merge_by_partner/models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from . import account_analytic_analysis
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import api, models
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseOrderLine(models.Model):
|
||||||
|
_inherit = 'account.analytic.account'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _recurring_create_invoice(self, automatic=False):
|
||||||
|
invoices = self.env['account.invoice'].browse(
|
||||||
|
super(PurchaseOrderLine, self)._recurring_create_invoice(automatic)
|
||||||
|
)
|
||||||
|
res = []
|
||||||
|
unlink_list = []
|
||||||
|
for partner in invoices.mapped('partner_id'):
|
||||||
|
inv_to_merge = invoices.filtered(lambda x: x.partner_id == partner)
|
||||||
|
if len(inv_to_merge) > 1:
|
||||||
|
invoices_info = inv_to_merge.do_merge(
|
||||||
|
keep_references=True, date_invoice=False)
|
||||||
|
res.extend(invoices_info.keys())
|
||||||
|
for inv_ids_list in invoices_info.values():
|
||||||
|
unlink_list.append(inv_ids_list)
|
||||||
|
else:
|
||||||
|
res.append(inv_to_merge.id)
|
||||||
|
return res
|
||||||
BIN
contract_invoice_merge_by_partner/static/description/icon.png
Normal file
BIN
contract_invoice_merge_by_partner/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
5
contract_invoice_merge_by_partner/tests/__init__.py
Normal file
5
contract_invoice_merge_by_partner/tests/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from . import test_contract_invoice_merge_by_partner
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp.tests.common import TransactionCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestContractInvoiceMergeByPartner(TransactionCase):
|
||||||
|
""" Use case : Prepare some data for current test case """
|
||||||
|
def setUp(self):
|
||||||
|
super(TestContractInvoiceMergeByPartner, self).setUp()
|
||||||
Reference in New Issue
Block a user