Skip to content

Commit

Permalink
[16.0][ADD] purchase_order_downpayment
Browse files Browse the repository at this point in the history
  • Loading branch information
Murtaza-OSI committed Mar 8, 2024
1 parent 4700ed3 commit f5ac00a
Show file tree
Hide file tree
Showing 17 changed files with 767 additions and 0 deletions.
76 changes: 76 additions & 0 deletions purchase_order_downpayment/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
==========================
Purchase Order Downpayment
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7d61f49e6bbdaf0d11f54d526d3011548db93ada9194005c4c32f52599d877b1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_downpayment
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_downpayment
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

The module allows for creating down payments from purchase orders.

**Table of contents**

.. contents::
:local:

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

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

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Open Source Integrators (OSI)

Contributors
~~~~~~~~~~~~

* Murtaza Mithaiwala <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

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

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.

This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_downpayment>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions purchase_order_downpayment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizard
16 changes: 16 additions & 0 deletions purchase_order_downpayment/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Purchase Order Downpayment",
"version": "16.0.1.0.0",
"author": "Open Source Integrators (OSI), Odoo Community Association (OCA)",
"website": "https://github.com/OCA/purchase-workflow",
"category": "Purchase",
"license": "AGPL-3",
"summary": "Allow to add payments from Purchase order view",
"depends": ["purchase", "account"],
"data": [
"security/ir.model.access.csv",
"wizard/purchase_order_downpayment_wiz_view.xml",
"views/purchase_view.xml",
],
"installable": True,
}
2 changes: 2 additions & 0 deletions purchase_order_downpayment/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import payment
from . import purchase
12 changes: 12 additions & 0 deletions purchase_order_downpayment/models/payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from odoo import fields, models


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

purchase_id = fields.Many2one(
"purchase.order",
"Purchase",
readonly=True,
states={"draft": [("readonly", False)]},
)
25 changes: 25 additions & 0 deletions purchase_order_downpayment/models/purchase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from odoo import fields, models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

account_payment_ids = fields.One2many(
"account.payment",
"purchase_id",
string="Purchase Payment",
)

def _compute_payment_count(self):
for rec in self:
rec.payment_count = len(rec.account_payment_ids)

payment_count = fields.Integer(compute="_compute_payment_count")

def action_open_payment(self):
self.ensure_one()
action = self.env["ir.actions.actions"]._for_xml_id(

Check warning on line 21 in purchase_order_downpayment/models/purchase.py

View check run for this annotation

Codecov / codecov/patch

purchase_order_downpayment/models/purchase.py#L20-L21

Added lines #L20 - L21 were not covered by tests
"account.action_account_payments_payable"
)
action.update({"domain": [("purchase_id", "=", self.id)]})
return action

Check warning on line 25 in purchase_order_downpayment/models/purchase.py

View check run for this annotation

Codecov / codecov/patch

purchase_order_downpayment/models/purchase.py#L24-L25

Added lines #L24 - L25 were not covered by tests
1 change: 1 addition & 0 deletions purchase_order_downpayment/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Murtaza Mithaiwala <[email protected]>
1 change: 1 addition & 0 deletions purchase_order_downpayment/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The module allows for creating down payments from purchase orders.
2 changes: 2 additions & 0 deletions purchase_order_downpayment/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
purchase_order_downpayment.access_purchase_order_down_payment_wizard,access_purchase_order_down_payment_wizard,purchase_order_downpayment.model_purchase_order_down_payment_wizard,base.group_user,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f5ac00a

Please sign in to comment.