2
0

[MIG] account_move_line_purchase_info: Migration to 14.0

This commit is contained in:
ps-tubtim 2021-08-04 15:49:35 +07:00 committed by Andrea Stirpe
parent 05af695b1d
commit f850348167
9 changed files with 63 additions and 34 deletions

View File

@ -14,13 +14,13 @@ Account Move Line Purchase Info
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/13.0/account_move_line_purchase_info :target: https://github.com/OCA/account-financial-tools/tree/14.0/account_move_line_purchase_info
:alt: OCA/account-financial-tools :alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_move_line_purchase_info :target: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_move_line_purchase_info
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/92/13.0 :target: https://runbot.odoo-community.org/runbot/92/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -52,7 +52,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_move_line_purchase_info%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_move_line_purchase_info%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. Do not contact contributors directly about support or help with technical issues.
@ -69,6 +69,7 @@ Contributors
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com> * Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
* Héctor Villarreal <hector.villarreal@forgeflow.com> * Héctor Villarreal <hector.villarreal@forgeflow.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -83,6 +84,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/13.0/account_move_line_purchase_info>`_ project on GitHub. This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/14.0/account_move_line_purchase_info>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -5,9 +5,9 @@
{ {
"name": "Account Move Line Purchase Info", "name": "Account Move Line Purchase Info",
"summary": "Introduces the purchase order line to the journal items", "summary": "Introduces the purchase order line to the journal items",
"version": "13.0.1.1.0", "version": "14.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)", "author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://www.github.com/OCA/account-financial-tools", "website": "https://github.com/OCA/account-financial-tools",
"category": "Generic", "category": "Generic",
"depends": ["purchase_stock"], "depends": ["purchase_stock"],
"license": "AGPL-3", "license": "AGPL-3",

View File

@ -1,13 +0,0 @@
# Copyright 2020 ForgeFlow (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
pos = (
env["account.move.line"]
.search([("purchase_id", "!=", False), ("move_id.type", "=", "entry")])
.mapped("purchase_id")
)
pos._compute_invoice()

View File

@ -0,0 +1,26 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
"""
Column `purchase_id` of table `account_move_line` has been renamed to `purchase_order_id`
because `purchase_order_id` is now in the core.
"""
old_purchase_column = "purchase_id"
new_purchase_column = "purchase_order_id"
if not openupgrade.column_exists(env.cr, "account_move_line", new_purchase_column):
openupgrade.rename_fields(
env,
[
(
"account.move.line",
"account_move_line",
old_purchase_column,
new_purchase_column,
),
],
)

View File

@ -6,13 +6,10 @@ from odoo import fields, models
class AccountMoveLine(models.Model): class AccountMoveLine(models.Model):
_inherit = "account.move.line" _inherit = "account.move.line"
purchase_id = fields.Many2one( purchase_order_id = fields.Many2one(
comodel_name="purchase.order", comodel_name="purchase.order",
related="purchase_line_id.order_id",
string="Purchase Order",
store=True, store=True,
index=True, index=True,
) )

View File

@ -1,2 +1,3 @@
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com> * Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
* Héctor Villarreal <hector.villarreal@forgeflow.com> * Héctor Villarreal <hector.villarreal@forgeflow.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Account Move Line Purchase Info</title> <title>Account Move Line Purchase Info</title>
<style type="text/css"> <style type="text/css">
@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_move_line_purchase_info"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_move_line_purchase_info"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/92/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/14.0/account_move_line_purchase_info"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_move_line_purchase_info"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/92/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module will add the purchase order line to journal items.</p> <p>This module will add the purchase order line to journal items.</p>
<p>The ultimate goal is to establish the purchase order line as one of the key <p>The ultimate goal is to establish the purchase order line as one of the key
fields to reconcile the Goods Received Not Invoiced accrual account.</p> fields to reconcile the Goods Received Not Invoiced accrual account.</p>
@ -399,7 +399,7 @@ order line is copied to the account move line.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_move_line_purchase_info%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_move_line_purchase_info%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -415,6 +415,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<ul class="simple"> <ul class="simple">
<li>Jordi Ballester Alomar &lt;<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>&gt;</li> <li>Jordi Ballester Alomar &lt;<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>&gt;</li>
<li>Héctor Villarreal &lt;<a class="reference external" href="mailto:hector.villarreal&#64;forgeflow.com">hector.villarreal&#64;forgeflow.com</a>&gt;</li> <li>Héctor Villarreal &lt;<a class="reference external" href="mailto:hector.villarreal&#64;forgeflow.com">hector.villarreal&#64;forgeflow.com</a>&gt;</li>
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@ -424,7 +425,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_move_line_purchase_info">OCA/account-financial-tools</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/14.0/account_move_line_purchase_info">OCA/account-financial-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="quantity" position="before"> <field name="quantity" position="before">
<field <field
name="purchase_id" name="purchase_order_id"
groups="account_move_line_purchase_info.group_account_move_purchase_info" groups="account_move_line_purchase_info.group_account_move_purchase_info"
/> />
<field <field
@ -24,11 +24,13 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="partner_id" position="after"> <field name="partner_id" position="after">
<field <field
name="purchase_id" name="purchase_order_id"
optional="show"
groups="account_move_line_purchase_info.group_account_move_purchase_info" groups="account_move_line_purchase_info.group_account_move_purchase_info"
/> />
<field <field
name="purchase_line_id" name="purchase_line_id"
optional="hide"
groups="account_move_line_purchase_info.group_account_move_purchase_info" groups="account_move_line_purchase_info.group_account_move_purchase_info"
/> />
</field> </field>
@ -41,7 +43,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="partner_id" position="after"> <field name="partner_id" position="after">
<field <field
name="purchase_id" name="purchase_order_id"
groups="account_move_line_purchase_info.group_account_move_purchase_info" groups="account_move_line_purchase_info.group_account_move_purchase_info"
/> />
<field <field
@ -54,7 +56,7 @@
name="group_by_purchase_order" name="group_by_purchase_order"
string="Purchase Order" string="Purchase Order"
domain="[]" domain="[]"
context="{'group_by':'purchase_id'}" context="{'group_by':'purchase_order_id'}"
groups="account_move_line_purchase_info.group_account_move_purchase_info" groups="account_move_line_purchase_info.group_account_move_purchase_info"
/> />
<filter <filter
@ -82,7 +84,21 @@
groups="account_move_line_purchase_info.group_account_move_purchase_info" groups="account_move_line_purchase_info.group_account_move_purchase_info"
/> />
<field <field
name="purchase_id" name="purchase_order_id"
groups="account_move_line_purchase_info.group_account_move_purchase_info"
/>
</xpath>
<xpath
expr="//field[@name='line_ids']/form//field[@name='partner_id']"
position="after"
>
<field
name="purchase_line_id"
context="{'po_line_info': True}"
groups="account_move_line_purchase_info.group_account_move_purchase_info"
/>
<field
name="purchase_order_id"
groups="account_move_line_purchase_info.group_account_move_purchase_info" groups="account_move_line_purchase_info.group_account_move_purchase_info"
/> />
</xpath> </xpath>