Skip to content

Commit

Permalink
Merge pull request #460 from ecosoft-odoo/16.0-mig-budget_activity_pu…
Browse files Browse the repository at this point in the history
…rchase

[16.0][MIG] budget_activity_purchase
  • Loading branch information
Saran440 authored Sep 24, 2024
2 parents 31dc5c0 + 7df4428 commit a19d3f2
Show file tree
Hide file tree
Showing 16 changed files with 709 additions and 0 deletions.
7 changes: 7 additions & 0 deletions budget_activity/models/base_budget_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ def _domain_activity(self):
class BudgetDoclineMixin(models.AbstractModel):
_inherit = "budget.docline.mixin"

required_activity = fields.Boolean(compute="_compute_required_activity", store=True)

@api.depends("company_id.budget_control_key")
def _compute_required_activity(self):
for rec in self:
rec.required_activity = rec.company_id.budget_control_key == "activity_id"

def _update_budget_commitment(self, budget_vals, analytic, reverse=False):
budget_vals = super()._update_budget_commitment(
budget_vals, analytic, reverse=reverse
Expand Down
84 changes: 84 additions & 0 deletions budget_activity_purchase/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
==========================
Budget Activity - Purchase
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2ec0d9d2dcd679b97696fb5dc415dc6cae6a403f5b227e495f4cc44def6b2ab8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |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-ecosoft--odoo%2Fbudgeting-lightgray.png?logo=github
:target: https://github.com/ecosoft-odoo/budgeting/tree/16.0/budget_activity_purchase
:alt: ecosoft-odoo/budgeting

|badge1| |badge2| |badge3|

This module add "Activity" element for purchase budget commitment

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Usage
=====

#. Go to Purchase > Create new purchase
#. On Products Tab (Order lines), select Activity field
#. It will send activity to invoice when you create bill.

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

Bugs are tracked on `GitHub Issues <https://github.com/ecosoft-odoo/budgeting/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/ecosoft-odoo/budgeting/issues/new?body=module:%20budget_activity_purchase%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
~~~~~~~

* Ecosoft

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

* `Ecosoft <http://ecosoft.co.th>`__:

* Kitti Upariphutthiphong <[email protected]>
* Saran Lim. <[email protected]>
* Pimolnat Suntian <[email protected]>

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

.. |maintainer-kittiu| image:: https://github.com/kittiu.png?size=40px
:target: https://github.com/kittiu
:alt: kittiu

Current maintainer:

|maintainer-kittiu|

This module is part of the `ecosoft-odoo/budgeting <https://github.com/ecosoft-odoo/budgeting/tree/16.0/budget_activity_purchase>`_ project on GitHub.

You are welcome to contribute.
3 changes: 3 additions & 0 deletions budget_activity_purchase/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
22 changes: 22 additions & 0 deletions budget_activity_purchase/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Budget Activity - Purchase",
"version": "16.0.1.0.0",
"category": "Accounting",
"license": "AGPL-3",
"author": "Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/ecosoft-odoo/budgeting",
"depends": [
"budget_activity",
"budget_control_purchase",
],
"data": [
"views/purchase_view.xml",
],
"installable": True,
"auto_install": True,
"maintainers": ["kittiu"],
"development_status": "Alpha",
}
3 changes: 3 additions & 0 deletions budget_activity_purchase/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import purchase
19 changes: 19 additions & 0 deletions budget_activity_purchase/models/purchase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


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

def _prepare_account_move_line(self, move=False):
self.ensure_one()
res = super()._prepare_account_move_line(move)
res["activity_id"] = self.activity_id.id
return res

def _get_po_line_account(self):
if self.activity_id:
return self.activity_id.account_id
return super()._get_po_line_account()
5 changes: 5 additions & 0 deletions budget_activity_purchase/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* `Ecosoft <http://ecosoft.co.th>`__:

* Kitti Upariphutthiphong <[email protected]>
* Saran Lim. <[email protected]>
* Pimolnat Suntian <[email protected]>
1 change: 1 addition & 0 deletions budget_activity_purchase/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module add "Activity" element for purchase budget commitment
3 changes: 3 additions & 0 deletions budget_activity_purchase/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#. Go to Purchase > Create new purchase
#. On Products Tab (Order lines), select Activity field
#. It will send activity to invoice when you create bill.
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 a19d3f2

Please sign in to comment.