Skip to content

Commit

Permalink
[NEW] account_payment_term_manual_purchase
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo committed May 26, 2024
1 parent e4826c9 commit 2522791
Show file tree
Hide file tree
Showing 20 changed files with 209 additions and 0 deletions.
1 change: 1 addition & 0 deletions account_payment_term_manual_purchase/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions account_payment_term_manual_purchase/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 KMEE
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Sale Payment Term Manual",
"summary": """
Review the payment term installments before confirm the sale order and copy the due date to the invoice.""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "KMEE,Odoo Community Association (OCA)",
"website": "https://github.com/KMEE/kmee-odoo-addons",
"depends": [
"purchase",
"account_payment_term_manual",
],
"data": [
"security/purchase_payment_term_manual.xml",
"views/purchase_order.xml",
],
"demo": [
"demo/purchase_payment_term_manual.xml",
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 KMEE
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">

<!-- TODO
<record model="purchase.payment.term.manual" id="purchase_payment_term_manual_demo_1">
<field name="name">...</field>
</record>
-->

</odoo>
2 changes: 2 additions & 0 deletions account_payment_term_manual_purchase/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import purchase_payment_term_manual
from . import purchase_order
15 changes: 15 additions & 0 deletions account_payment_term_manual_purchase/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 KMEE
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class PurchaseOrder(models.Model):

_inherit = "purchase.order"

manual_payment_term_ids = fields.One2many(
"purchase.payment.term.manual",
"purchase_order_id",
string="Manual Payment Terms",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 KMEE
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class PurchasePaymentTermManual(models.Model):

_name = "purchase.payment.term.manual"
_inherit = "account.payment.term.manual.mixin"

purchase_order_id = fields.Many2one("purchase.order")
currency_id = fields.Many2one(
"res.currency",
related="purchase_order_id.currency_id",
readonly=True,
)
8 changes: 8 additions & 0 deletions account_payment_term_manual_purchase/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[ This file is optional, it should explain how to configure
the module before using it; it is aimed at advanced users. ]

To configure this module, you need to:

- Go to ...

![alternative description]()../static/description/image.png)
13 changes: 13 additions & 0 deletions account_payment_term_manual_purchase/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[ This file is optional but strongly suggested to allow end-users to evaluate the
module's usefulness in their context. ]

It should explain the “why” of the module:

- in which context or use cases this module can be useful (practical examples are welcome!).
- what is the business requirement that generated the need to develop this module

It can also inform on related modules:

- modules it depends on and their features
- other modules that can work well together with this one
- suggested setups where the module is useful (eg: multicompany, multi-website)
2 changes: 2 additions & 0 deletions account_payment_term_manual_purchase/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Firstname Lastname <[email protected]> (optional company website url)
- Second Person <[email protected]> (optional company website url)
7 changes: 7 additions & 0 deletions account_payment_term_manual_purchase/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[ This file is optional and contains additional credits, other than
authors, contributors, and maintainers. ]

The development of this module has been financially supported by:

- Company 1 name
- Company 2 name
5 changes: 5 additions & 0 deletions account_payment_term_manual_purchase/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[ This file must be max 2-3 paragraphs, and is required. ]

This module extends the functionality of ... to support ...
and to allow you to ...

22 changes: 22 additions & 0 deletions account_payment_term_manual_purchase/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[ The change log. The goal of this file is to help readers
understand changes between version. The primary audience is
end users and integrators. Purely technical changes such as
code refactoring must not be mentioned here.

This file may contain ONE level of section titles, underlined
with the ~ (tilde) character. Other section markers are
forbidden and will likely break the structure of the README.rst
or other documents where this fragment is included. ]

## 11.0.x.y.z (YYYY-MM-DD)

- [BREAKING] Breaking changes come first.
([#70](https://github.com/OCA/repo/issues/70))
- [ADD] New feature.
([#74](https://github.com/OCA/repo/issues/74))
- [FIX] Correct this.
([#71](https://github.com/OCA/repo/issues/71))

## 11.0.x.y.z (YYYY-MM-DD)

- ...
7 changes: 7 additions & 0 deletions account_payment_term_manual_purchase/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[ This file must only be present if there are very specific
installation instructions, such as installing non-python
dependencies. The audience is systems administrators. ]

To install this module, you need to:

1. Do this ...
5 changes: 5 additions & 0 deletions account_payment_term_manual_purchase/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[ Enumerate known caveats and future potential improvements.
It is mostly intended for end-users, and can also help
potential new contributors discovering new features to implement. ]

- ...
11 changes: 11 additions & 0 deletions account_payment_term_manual_purchase/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[ This file must be present and contains the usage instructions
for end-users. As all other rst files included in the README,
it MUST NOT contain reStructuredText sections
only body text (paragraphs, lists, tables, etc). Should you need
a more elaborate structure to explain the addon, please create a
Sphinx documentation (which may include this file as a "quick start"
section). ]

To use this module, you need to:

1. Go to ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 KMEE
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

<record
model="ir.model.access"
id="purchase_payment_term_manual_access_name"
> <!-- TODO acl id -->
<field
name="name"
>purchase.payment.term.manual access name</field> <!-- TODO acl name -->
<field name="model_id" ref="model_purchase_payment_term_manual" />
<!-- TODO review and adapt -->
<field name="group_id" ref="base.group_user" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="0" />
<field name="perm_write" eval="0" />
<field name="perm_unlink" eval="0" />
</record>

</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions account_payment_term_manual_purchase/views/purchase_order.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 KMEE
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="view_order_form" model="ir.ui.view">
<field name="name">purchase.order.form</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="arch" type="xml">
<notebook position="inside">
<page string="Payment Terms" groups="account.group_account_invoice">
<field name="manual_payment_term_ids">
<tree editable="bottom">
<field name="date_maturity" />
<field name="amount" />
<field
name="purchase_order_id"
invisible="1"
force_save="1"
/>
<field name="currency_id" invisible="1" />
</tree>
</field>
</page>
</notebook>
</field>
</record>

</odoo>
6 changes: 6 additions & 0 deletions setup/account_payment_term_manual_purchase/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 2522791

Please sign in to comment.