Skip to content
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
227 changes: 227 additions & 0 deletions spreadsheet_field_linking/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========================
Spreadsheet Field Linking
=========================

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

.. |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/license-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%2Fspreadsheet-lightgray.png?logo=github
:target: https://github.com/OCA/spreadsheet/tree/19.0/spreadsheet_field_linking
:alt: OCA/spreadsheet
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/spreadsheet-19-0/spreadsheet-19-0-spreadsheet_field_linking
: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/spreadsheet&target_branch=19.0
:alt: Try me on Runboat

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

This module turns an Odoo spreadsheet into a tool that can be used to
push data to a record.

You link a spreadsheet to a record (a sale order, a project, a
partner...), point some of its cells at the fields of that record, and
then write the values you computed in the spreadsheet back onto the
record in one click.

A typical use is building a pricing or estimation sheet: you do the
maths in the spreadsheet, and the results land on the right fields of
the order without any copy-paste. Cells can target a field of the linked
record, a field of a related record, or a field on the lines of the
record.

The links are stored inside the spreadsheet itself, so they are kept
when the file is saved and reopened, and they follow their cells when
rows are moved.

This is a foundation module: it adds the linking tools to every Odoo
spreadsheet but does not, by itself, tie any particular business
document to a spreadsheet. Other modules build on it could offer
ready-made spreadsheets for their own models.

**Table of contents**

.. contents::
:local:

Usage
=====

Everything happens from inside the spreadsheet editor, through two
menus: the **File** menu at the top left, and the **cell menu** you get
by right-clicking a cell.

Link the spreadsheet to a record
--------------------------------

Open any spreadsheet and go to **File → Manage linked record**. This
entry is always available.

|image1|

A side panel opens on the right:

- **Model** — pick the kind of record you want to link (Sale Order,
Partner...). Only models you are allowed to edit are offered.
- **Record** — pick the specific record.
- **Link** — confirms the choice and links the spreadsheet to that
record.
- **Unlink** — removes the link (shown only once a record is linked).

The top of the panel always shows which record is currently linked, if
any.

|image2|

Link a cell to a field
----------------------

Once the spreadsheet is linked, you can point cells at the record's
fields. Right-click the cell that holds the value you want to send and
choose **Link to field** (or, on a cell that is already linked, **Edit
field link**). The same entry is also available under **File → Link to
field**.

|image3|

A side panel opens for that cell:

- **Field to link** — choose the field that should receive the cell's
value. You can follow relations to reach a field of a related record,
or a field on the record's lines.
- **Line (position)** — when the field lives on lines, tell the module
which line to write to by its position (1 for the first line, 2 for
the second...).

A short **Saved** confirmation appears each time a change is stored.

Writing to lines, and creating new ones
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Many records hold a list of lines — a sale order, for example, has its
order lines. You can write to those lines by their position, and you can
also add brand-new ones:

- **To update a line that already exists**, set its position (1, 2,
3...) to one that is already there.
- **To add a new line**, set a position just past the last one.
Everything you mapped to that same position is gathered together into
a single new line, so before you write, map every value the new line
needs (description, quantity, price...) to that same position.

Positions follow the order the lines appear on the record's form:
position 1 is the first line, 2 the second, and so on. Because of this,
a position points at a *slot*, not at one particular line — if you
reorder, add, or remove lines, a position may end up aiming at a
different line than before, so it is worth a quick check after
rearranging.

A couple of limitations, and why they are there
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To avoid making a mess, the module only ever *creates* new lines that
belong directly to the record you linked — the record's own list of
lines, like the lines of the sale order itself. Two things it will
deliberately not do, and the reason for each:

- **It won't invent items that exist on their own.** Some fields don't
hold lines that belong to the record; instead they point to things
that live independently and can be shared by many records at once —
think of the tags on a contact, or the product picked on a line. If
one of those is already there, the module is glad to update a value on
it. But it will not create a new one for you: doing that could quietly
leave duplicates or half-finished entries scattered in other parts of
Odoo that the rest of your data relies on. To stay safe, it only
reuses what already exists in those spots.

- **It won't build a line hidden deep inside another line.** The module
only adds lines one step down, directly on the record you linked. To
create something nested further in — a line tucked inside another line
— it would first have to invent the in-between lines that aren't there
yet, filling in details you never entered. Rather than guess, it
simply leaves those untouched.

So, in plain terms: the module creates a new line only where it can do
so safely and without guessing — directly on the record you linked.
Everywhere else it updates what is already there, but never creates.

|image4|

Remove a link from a cell
-------------------------

To unlink one or more cells, select them, right-click and choose
**Remove field link**. This entry appears only when at least one cell in
the selection is linked.

Write the values back to the record
-----------------------------------

When the spreadsheet is linked to a record you can edit, a **Write to
record** button appears in the top bar (it shows the record's name once
one is linked, e.g. *Write to SO0042*). Click it to send every linked
cell's current value to its field on the record at once.

|image5|

.. |image1| image:: https://raw.githubusercontent.com/OCA/spreadsheet/19.0/spreadsheet_field_linking/static/description/file_manage_linked_record.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/spreadsheet/19.0/spreadsheet_field_linking/static/description/manage_linked_record_panel.png
.. |image3| image:: https://raw.githubusercontent.com/OCA/spreadsheet/19.0/spreadsheet_field_linking/static/description/cell_menu_link_to_field.png
.. |image4| image:: https://raw.githubusercontent.com/OCA/spreadsheet/19.0/spreadsheet_field_linking/static/description/field_link_panel.png
.. |image5| image:: https://raw.githubusercontent.com/OCA/spreadsheet/19.0/spreadsheet_field_linking/static/description/write_to_record_button.png

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/spreadsheet/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/spreadsheet/issues/new?body=module:%20spreadsheet_field_linking%0Aversion:%2019.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
-------

* arielbarreiros96

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

- `arielbarreiros96 <https://www.github.com/arielbarreiros96>`__

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/spreadsheet <https://github.com/OCA/spreadsheet/tree/19.0/spreadsheet_field_linking>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions spreadsheet_field_linking/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions spreadsheet_field_linking/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2026 arielbarreiros96
# License AGPL-3.0 or later (https://www.gnu.org/licenses/AGPL-3.0).
{
"name": "Spreadsheet Field Linking",
"version": "19.0.1.0.0",
"summary": "Link spreadsheet cells to record fields and write their values back",
"author": "arielbarreiros96, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/spreadsheet",
"license": "AGPL-3",
"category": "Productivity",
"depends": ["spreadsheet_oca"],
"data": [],
"assets": {
"spreadsheet.o_spreadsheet": [
"spreadsheet_field_linking/static/src/field_linking/**/*.js",
"spreadsheet_field_linking/static/src/field_linking/**/*.xml",
],
"web.assets_unit_tests": [
"spreadsheet_field_linking/static/tests/**/*",
],
},
"installable": True,
"application": False,
}
2 changes: 2 additions & 0 deletions spreadsheet_field_linking/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import spreadsheet_linkable
from . import spreadsheet_spreadsheet
Loading
Loading