Skip to content

Commit

Permalink
[ADD] Added new module to restrict invoice lines created from sale or…
Browse files Browse the repository at this point in the history
…der.
  • Loading branch information
Chandresh-OSI committed Sep 20, 2021
1 parent e7f29ed commit e5e3e1a
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 0 deletions.
87 changes: 87 additions & 0 deletions account_invoice_restrict_linked_so/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
================================
Restrict Invoice created from SO
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/14.0/account_invoice_restrict_linked_so
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-14-0/account-invoicing-14-0-account_invoice_restrict_linked_so
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/95/14.0
:alt: Try me on Runbot

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

Restricts editing the Product, Quantity and Unit Price columns for invoice lines that originated in Sales Orders.

**Table of contents**

.. contents::
:local:

Usage
=====

On a Sales Order, an Invoice can be generated.

On the Invoice generated from a Sales Orders, for the lines generated from the SO, the Product, Quantity and Unit Price fields should not be editable.

Changing these requires deleting (or cancelling) the draft invoice, correcting the data in the source Sales Order, and then redoing the Invoice creation.

Note that other columns can be edited, such as taxes or accounts, and that additional lines could be manually added and fully editable.

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 <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_restrict_linked_so%0Aversion:%2014.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

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

* `Open Source Integrators <https://opensourceintegrators.com>`:

* Daniel Reis <[email protected]>
* Chandresh Thakkar <[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/account-invoicing <https://github.com/OCA/account-invoicing/tree/14.0/account_invoice_restrict_linked_so>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Empty file.
19 changes: 19 additions & 0 deletions account_invoice_restrict_linked_so/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (C) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Restrict Invoice created from SO",
"summary": "Restricts editing the Product, Quantity and Unit Price "
"columns for invoice lines that originated in Sales Orders.",
"version": "14.0.1.0.1",
"category": "Accounting",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"license": "AGPL-3",
"depends": ["sale_management"],
"data": [
"views/account_move.xml",
],
"installable": True,
"maintainer": "dreispt",
}
4 changes: 4 additions & 0 deletions account_invoice_restrict_linked_so/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Open Source Integrators <https://opensourceintegrators.com>`:

* Daniel Reis <[email protected]>
* Chandresh Thakkar <[email protected]>
1 change: 1 addition & 0 deletions account_invoice_restrict_linked_so/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restricts editing the Product, Quantity and Unit Price columns for invoice lines that originated in Sales Orders.
7 changes: 7 additions & 0 deletions account_invoice_restrict_linked_so/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
On a Sales Order, an Invoice can be generated.

On the Invoice generated from a Sales Orders, for the lines generated from the SO, the Product, Quantity and Unit Price fields should not be editable.

Changing these requires deleting (or cancelling) the draft invoice, correcting the data in the source Sales Order, and then redoing the Invoice creation.

Note that other columns can be edited, such as taxes or accounts, and that additional lines could be manually added and fully editable.
39 changes: 39 additions & 0 deletions account_invoice_restrict_linked_so/views/account_move.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="view_move_form_inherit" model="ir.ui.view">
<field name="name">account.move.form.inherit</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/tree" position="inside">
<field name="sale_line_ids" invisible="1" />
</xpath>
<xpath
expr="//field[@name='invoice_line_ids']/tree/field[@name='product_id']"
position="attributes"
>
<attribute
name="attrs"
>{'readonly':[('sale_line_ids','!=',[])]}</attribute>
</xpath>
<xpath
expr="//field[@name='invoice_line_ids']/tree/field[@name='quantity']"
position="attributes"
>
<attribute
name="attrs"
>{'readonly':[('sale_line_ids','!=',[])]}</attribute>
</xpath>
<xpath
expr="//field[@name='invoice_line_ids']/tree/field[@name='price_unit']"
position="attributes"
>
<attribute
name="attrs"
>{'readonly':[('sale_line_ids','!=',[])]}</attribute>
</xpath>
</field>
</record>

</odoo>
6 changes: 6 additions & 0 deletions setup/account_invoice_restrict_linked_so/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 e5e3e1a

Please sign in to comment.