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

[18.0][MIG] purchase_force_invoiced_quantity: Migration to 18.0 #2503

Open
wants to merge 8 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
115 changes: 115 additions & 0 deletions purchase_force_invoiced_quantity/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
================================
Purchase Force Invoiced Quantity
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e1885771b042f46156fefe89944fa3a364d4a3dd6f5682c87b2b4bd02a13027d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/18.0/purchase_force_invoiced_quantity
: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-18-0/purchase-workflow-18-0-purchase_force_invoiced_quantity
: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=18.0
:alt: Try me on Runboat

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

This module add a new "Force Invoiced" field to purchase order lines.
This field is used as modifier when computing quantity to be invoiced.

Current behaviour: quantity to invoice = delivered - invoiced

Implemented behaviour: quantity to invoice = delivered - invoiced -
force invoiced

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

This module implements additional featured for the `Purchase Force
Invoiced <https://github.com/OCA/purchase-workflow/tree/16.0/purchase_force_invoiced>`__
module.

It covers the following scenarios:

- One need to modify the quantity to be invoiced after the products were
received. Eg .you negotiated an extra discount from your vendor.
- You would like to fix some issues with quantities invoiced cause by
incorrect data entry.

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

No configuration is required.

Usage
=====

Open a purchase order and add an amount into the "Force Invoiced" field.
Amount to invoice will be adjusted accordingly. This field is optional
so you can hide it if you don't need it.

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_force_invoiced_quantity%0Aversion:%2018.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
-------

* Cetmix

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

- `Cetmix <http://cetmix.com>`__

..

- Ivan Sokolov
- Dessan Hemrayev

- Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>

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/18.0/purchase_force_invoiced_quantity>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions purchase_force_invoiced_quantity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (C) 2024 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
21 changes: 21 additions & 0 deletions purchase_force_invoiced_quantity/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2024 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Purchase Force Invoiced Quantity",
"summary": "Add manual invoice quantity in purchase order lines",
"version": "18.0.1.0.0",
"author": "Cetmix, Odoo Community Association (OCA)",
"category": "Purchase Management",
"license": "AGPL-3",
"website": "https://github.com/OCA/purchase-workflow",
"depends": ["purchase_force_invoiced"],
"data": [
"views/purchase_order.xml",
],
"demo": [
"demo/demo_product.xml",
"demo/demo_purchase_order.xml",
],
"installable": True,
}
14 changes: 14 additions & 0 deletions purchase_force_invoiced_quantity/demo/demo_product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="demo_product_purchase_force_invoiced_qty_1" model="product.product">
<field name="name">Purchase Force Invoiced qty product 1</field>
<field name="type">service</field>
<field name="purchase_method">receive</field>
</record>

<record id="demo_product_purchase_force_invoiced_qty_2" model="product.product">
<field name="name">Purchase Force Invoiced qty product 2</field>
<field name="type">service</field>
<field name="purchase_method">receive</field>
</record>
</odoo>
23 changes: 23 additions & 0 deletions purchase_force_invoiced_quantity/demo/demo_purchase_order.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="so_purchase_force_invoiced_qty_1" model="purchase.order">
<field name="partner_id" ref="base.partner_admin" />
<field name="user_id" ref="base.user_admin" />
</record>

<record id="sol_purchase_force_invoiced_qty_1_1" model="purchase.order.line">
<field name="order_id" ref="so_purchase_force_invoiced_qty_1" />
<field name="product_id" ref="demo_product_purchase_force_invoiced_qty_1" />
<field name="product_uom_qty">5</field>
<field name="force_invoiced">3</field>
<field name="price_unit">295.00</field>
</record>

<record id="sol_purchase_force_invoiced_qty_1_2" model="purchase.order.line">
<field name="order_id" ref="so_purchase_force_invoiced_qty_1" />
<field name="product_id" ref="demo_product_purchase_force_invoiced_qty_2" />
<field name="product_uom_qty">5</field>
<field name="force_invoiced">0</field>
<field name="price_unit">145.00</field>
</record>
</odoo>
46 changes: 46 additions & 0 deletions purchase_force_invoiced_quantity/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_force_invoiced_quantity
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-12-21 14:06+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: purchase_force_invoiced_quantity
#: model:ir.model.fields,field_description:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced
msgid "Force Invoiced"
msgstr "Forza a fatturato"

#. module: purchase_force_invoiced_quantity
#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_1_product_template
msgid "Purchase Force Invoiced qty product 1"
msgstr "Quantità fatturazione formzata acquisto prodotto 1"

#. module: purchase_force_invoiced_quantity
#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_2_product_template
msgid "Purchase Force Invoiced qty product 2"
msgstr "Quantità fatturazione formzata acquisto prodotto 2"

#. module: purchase_force_invoiced_quantity
#: model:ir.model,name:purchase_force_invoiced_quantity.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Riga ordine di acquisto"

#. module: purchase_force_invoiced_quantity
#: model:ir.model.fields,help:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced
msgid ""
"This amount will be deducted from quantity to invoice.\n"
"quantity to invoice = delivered - invoiced - force invoiced"
msgstr ""
"Questo valore verrà dedotto dalla quantità da fatturare.\n"
"quantità da fatturare = consegnata - fatturata - forzata a fatturata"
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_force_invoiced_quantity
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_force_invoiced_quantity
#: model:ir.model.fields,field_description:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced
msgid "Force Invoiced"
msgstr ""

#. module: purchase_force_invoiced_quantity
#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_1_product_template
msgid "Purchase Force Invoiced qty product 1"
msgstr ""

#. module: purchase_force_invoiced_quantity
#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_2_product_template
msgid "Purchase Force Invoiced qty product 2"
msgstr ""

#. module: purchase_force_invoiced_quantity
#: model:ir.model,name:purchase_force_invoiced_quantity.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""

#. module: purchase_force_invoiced_quantity
#: model:ir.model.fields,help:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced
msgid ""
"This amount will be deducted from quantity to invoice.\n"
"quantity to invoice = delivered - invoiced - force invoiced"
msgstr ""
4 changes: 4 additions & 0 deletions purchase_force_invoiced_quantity/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (C) 2024 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import purchase_order_line
33 changes: 33 additions & 0 deletions purchase_force_invoiced_quantity/models/purchase_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (C) 2024 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


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

force_invoiced = fields.Float(
digits="Product Unit of Measure",
help=(
"This amount will be deducted from quantity to invoice."
"\nquantity to invoice = delivered - invoiced - force invoiced"
),
)

@api.depends("force_invoiced")
def _compute_qty_invoiced(self):
"""
Compute the quantity to invoice.
"""
res = super()._compute_qty_invoiced()
for line in self.filtered(lambda ln: ln.force_invoiced):
# compute qty_to_invoice
if (
line.order_id.state in ["purchase", "done"]
and line.product_id.purchase_method != "purchase"
):
line.qty_to_invoice = (
line.qty_received - line.qty_invoiced - line.force_invoiced
)
return res
3 changes: 3 additions & 0 deletions purchase_force_invoiced_quantity/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions purchase_force_invoiced_quantity/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No configuration is required.
10 changes: 10 additions & 0 deletions purchase_force_invoiced_quantity/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This module implements additional featured for the [Purchase Force
Invoiced](https://github.com/OCA/purchase-workflow/tree/16.0/purchase_force_invoiced)
module.

It covers the following scenarios:

- One need to modify the quantity to be invoiced after the products were
received. Eg .you negotiated an extra discount from your vendor.
- You would like to fix some issues with quantities invoiced cause by
incorrect data entry.
6 changes: 6 additions & 0 deletions purchase_force_invoiced_quantity/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- [Cetmix](http://cetmix.com)

> - Ivan Sokolov
> - Dessan Hemrayev

- Heliconia Solutions Pvt. Ltd. \<<https://www.heliconia.io>\>
7 changes: 7 additions & 0 deletions purchase_force_invoiced_quantity/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module add a new "Force Invoiced" field to purchase order lines.
This field is used as modifier when computing quantity to be invoiced.

Current behaviour: quantity to invoice = delivered - invoiced

Implemented behaviour: quantity to invoice = delivered - invoiced -
force invoiced
3 changes: 3 additions & 0 deletions purchase_force_invoiced_quantity/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Open a purchase order and add an amount into the "Force Invoiced" field.
Amount to invoice will be adjusted accordingly. This field is optional
so you can hide it if you don't need it.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading