Remove module purchase_date_planned_update (PO lines can now be edited after confirmation, which updates the date on the stock move)

This commit is contained in:
Alexis de Lattre
2018-05-25 11:18:05 +02:00
parent a29384b817
commit 567e7f1f6e
9 changed files with 0 additions and 580 deletions

View File

@@ -1,3 +0,0 @@
# -*- coding: utf-8 -*-
from . import wizard

View File

@@ -1,47 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Purchase Date Planned Update module for Odoo
# Copyright (C) 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Purchase Date Planned Update',
'version': '0.1',
'category': 'Purchase',
'license': 'AGPL-3',
'summary': "Update of date planned on PO line updates date on stock move",
'description': """
Purchase Date Planned Update
============================
This module adds a wizard on confirmed purchase orders to update the date planned on one or several purchase order lines: it will update the scheduled date of the purchase order lines and the expected date of the related stock moves that are not already received.
This module has been written by Alexis de Lattre from Akretion
<alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['purchase'],
'data': [
'wizard/purchase_date_planned_update_view.xml',
'purchase_view.xml',
],
'installable': False,
}

View File

@@ -1,147 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_date_planned_update
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-18 08:46+0000\n"
"PO-Revision-Date: 2016-03-18 08:46+0000\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_date_planned_update
#: code:addons/purchase_date_planned_update/wizard/purchase_date_planned_update.py:55
#, python-format
msgid "All purchase order lines have been fully received."
msgstr "Toutes les lignes du bon de commande fournisseur ont été réceptionnées."
#. module: purchase_date_planned_update
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
msgid "Cancel"
msgstr "Annuler"
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,create_uid:0
#: field:purchase.line.date.planned.update,create_uid:0
msgid "Created by"
msgstr "Created by"
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,create_date:0
#: field:purchase.line.date.planned.update,create_date:0
msgid "Created on"
msgstr "Created on"
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,name:0
msgid "Description"
msgstr "Description"
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,id:0
#: field:purchase.line.date.planned.update,id:0
msgid "ID"
msgstr "ID"
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,write_uid:0
#: field:purchase.line.date.planned.update,write_uid:0
msgid "Last Updated by"
msgstr "Last Updated by"
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,write_date:0
#: field:purchase.line.date.planned.update,write_date:0
msgid "Last Updated on"
msgstr "Last Updated on"
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,line_ids:0
msgid "Lines"
msgstr "Lignes"
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,date_planned:0
msgid "New Scheduled Date For All Lines"
msgstr "Nouvelle date prévue pour toutes les lignes"
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,parent_id:0
msgid "Parent"
msgstr "Parent"
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,product_id:0
msgid "Product"
msgstr "Article"
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,product_uom:0
msgid "Product Unit of Measure"
msgstr "Unité de mesure"
#. module: purchase_date_planned_update
#: model:ir.model,name:purchase_date_planned_update.model_purchase_line_date_planned_update
msgid "Purchase Line Date Planned Update"
msgstr "Mettre à jour la date prévue sur les lignes d'achat"
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,purchase_line_id:0
msgid "Purchase Order Line"
msgstr "Lignes d'achat"
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,product_qty:0
msgid "Quantity"
msgstr "Quantité"
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,date_planned:0
msgid "Scheduled Date"
msgstr "Date prévue"
#. module: purchase_date_planned_update
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
msgid "The purchase order lines that are already fully received are not listed below."
msgstr "Les lignes d'achat qui ont déjà été réceptionnées en totalité ne sont pas listées ci-dessous."
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,price_unit:0
msgid "Unit Price"
msgstr "Prix unitaire"
#. module: purchase_date_planned_update
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
msgid "Update"
msgstr "Mettre à jour"
#. module: purchase_date_planned_update
#: model:ir.model,name:purchase_date_planned_update.model_purchase_date_planned_update
msgid "Update Scheduled Date on PO"
msgstr "Mettre à jour la date prévue sur le bon de commande"
#. module: purchase_date_planned_update
#: model:ir.actions.act_window,name:purchase_date_planned_update.purchase_date_planned_update_action
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
#: view:purchase.order:purchase_date_planned_update.purchase_order_form
msgid "Update Scheduled Dates"
msgstr "Mettre à jour la date prévue"
#. module: purchase_date_planned_update
#: code:addons/purchase_date_planned_update/purchase.py:43
#: code:addons/purchase_date_planned_update/wizard/purchase_date_planned_update.py:72
#, python-format
msgid "Updated Scheduled Date of line <b>%s</b> from %s to <b>%s</b>"
msgstr "Mise à jour de la date prévue de la ligne <b>%s</b> du %s au <b>%s</b>"
#. module: purchase_date_planned_update
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
msgid "You can update all the lines at once or update only selected lines."
msgstr "Vous pouvez mettre à jour toutes les lignes d'un coup ou mettre à jour seulement certaines lignes."

View File

@@ -1,147 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_date_planned_update
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-18 08:46+0000\n"
"PO-Revision-Date: 2016-03-18 08:46+0000\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_date_planned_update
#: code:addons/purchase_date_planned_update/wizard/purchase_date_planned_update.py:55
#, python-format
msgid "All purchase order lines have been fully received."
msgstr ""
#. module: purchase_date_planned_update
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
msgid "Cancel"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,create_uid:0
#: field:purchase.line.date.planned.update,create_uid:0
msgid "Created by"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,create_date:0
#: field:purchase.line.date.planned.update,create_date:0
msgid "Created on"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,name:0
msgid "Description"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,id:0
#: field:purchase.line.date.planned.update,id:0
msgid "ID"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,write_uid:0
#: field:purchase.line.date.planned.update,write_uid:0
msgid "Last Updated by"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,write_date:0
#: field:purchase.line.date.planned.update,write_date:0
msgid "Last Updated on"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,line_ids:0
msgid "Lines"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.date.planned.update,date_planned:0
msgid "New Scheduled Date For All Lines"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,parent_id:0
msgid "Parent"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,product_id:0
msgid "Product"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,product_uom:0
msgid "Product Unit of Measure"
msgstr ""
#. module: purchase_date_planned_update
#: model:ir.model,name:purchase_date_planned_update.model_purchase_line_date_planned_update
msgid "Purchase Line Date Planned Update"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,purchase_line_id:0
msgid "Purchase Order Line"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,product_qty:0
msgid "Quantity"
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,date_planned:0
msgid "Scheduled Date"
msgstr ""
#. module: purchase_date_planned_update
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
msgid "The purchase order lines that are already fully received are not listed below."
msgstr ""
#. module: purchase_date_planned_update
#: field:purchase.line.date.planned.update,price_unit:0
msgid "Unit Price"
msgstr ""
#. module: purchase_date_planned_update
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
msgid "Update"
msgstr ""
#. module: purchase_date_planned_update
#: model:ir.model,name:purchase_date_planned_update.model_purchase_date_planned_update
msgid "Update Scheduled Date on PO"
msgstr ""
#. module: purchase_date_planned_update
#: model:ir.actions.act_window,name:purchase_date_planned_update.purchase_date_planned_update_action
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
#: view:purchase.order:purchase_date_planned_update.purchase_order_form
msgid "Update Scheduled Dates"
msgstr ""
#. module: purchase_date_planned_update
#: code:addons/purchase_date_planned_update/purchase.py:43
#: code:addons/purchase_date_planned_update/wizard/purchase_date_planned_update.py:72
#, python-format
msgid "Updated Scheduled Date of line <b>%s</b> from %s to <b>%s</b>"
msgstr ""
#. module: purchase_date_planned_update
#: view:purchase.date.planned.update:purchase_date_planned_update.purchase_date_planned_update_form
msgid "You can update all the lines at once or update only selected lines."
msgstr ""

View File

@@ -1,53 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Purchase Date Planned Update module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Sébastien Beau <sebastien.beau@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import orm
from openerp.tools.translate import _
from openerp import SUPERUSER_ID
class PurchaseOrderLine(orm.Model):
_inherit = 'purchase.order.line'
def write(self, cr, uid, ids, vals, context=None):
if vals.get('date_planned'):
if not isinstance(ids, list):
ids = [ids]
polines = self.browse(cr, uid, ids, context=context)
move_ids = []
for poline in polines:
# Add msg in chatter
poline.order_id.message_post(_(
"Updated Scheduled Date of line <b>%s</b> from %s "
"to <b>%s</b>"
% (poline.name, poline.date_planned,
vals['date_planned'])))
move_ids += [
sm.id for sm in poline.move_ids if sm.state != 'done']
if move_ids:
# update related stock move
self.pool['stock.move'].write(cr, SUPERUSER_ID, move_ids, {
'date_expected': vals['date_planned'],
}, context=context)
return super(PurchaseOrderLine, self).write(
cr, uid, ids, vals, context=context)

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015-2016 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="purchase_order_form" model="ir.ui.view">
<field name="name">date_planned_update.purchase.order.form</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<button name="view_invoice" position="after">
<button name="%(purchase_date_planned_update_action)d" type="action"
string="Update Scheduled Dates"
states="confirmed,approved,except_picking,except_invoice"/>
</button>
</field>
</record>
</data>
</openerp>

View File

@@ -1,3 +0,0 @@
# -*- coding: utf-8 -*-
from . import purchase_date_planned_update

View File

@@ -1,105 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Purchase Date Planned Update module for Odoo
# Copyright (C) 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api, _
from openerp.exceptions import Warning as UserError
import openerp.addons.decimal_precision as dp
class PurchaseDatePlannedUpdate(models.TransientModel):
_name = 'purchase.date.planned.update'
_description = 'Update Scheduled Date on PO'
date_planned = fields.Date(string='New Scheduled Date For All Lines')
line_ids = fields.One2many(
'purchase.line.date.planned.update', 'parent_id', string="Lines")
@api.model
def default_get(self, fields):
res = super(PurchaseDatePlannedUpdate, self).default_get(fields)
po = self.env['purchase.order'].browse(self._context['active_id'])
lines = []
for line in po.order_line:
if line.move_ids:
if all([move.state == 'done' for move in line.move_ids]):
continue
lines.append({
'purchase_line_id': line.id,
'product_id': line.product_id.id,
'name': line.name,
'product_qty': line.product_qty,
'date_planned': line.date_planned,
'product_uom': line.product_uom.id,
'price_unit': line.price_unit,
})
if not lines:
raise UserError(_(
"All purchase order lines have been fully received."))
res.update(line_ids=lines)
return res
@api.onchange('date_planned')
def date_planned_change(self):
if self.date_planned:
for line in self.line_ids:
line.date_planned = self.date_planned
@api.multi
def run(self):
self.ensure_one()
for wline in self.line_ids:
if wline.date_planned != wline.purchase_line_id.date_planned:
pline = wline.purchase_line_id
pline.order_id.message_post(_(
"Updated Scheduled Date of line <b>%s</b> from %s "
"to <b>%s</b>")
% (pline.name, pline.date_planned, wline.date_planned))
# Update PO line
pline.date_planned = wline.date_planned
# Update move lines
if pline.move_ids:
moves = pline.move_ids.filtered(
lambda x: x.state != 'done')
moves.write({'date_expected': wline.date_planned})
return True
class PurchaseLineDatePlannedUpdate(models.TransientModel):
_name = 'purchase.line.date.planned.update'
_description = 'Purchase Line Date Planned Update'
parent_id = fields.Many2one(
'purchase.date.planned.update', string='Parent')
purchase_line_id = fields.Many2one(
'purchase.order.line', string='Purchase Order Line', readonly=True)
product_id = fields.Many2one(
'product.product', string='Product', readonly=True)
name = fields.Text('Description', readonly=True)
product_qty = fields.Float(
string='Quantity', digits=dp.get_precision('Product Unit of Measure'),
readonly=True)
date_planned = fields.Date(string='Scheduled Date', required=True)
product_uom = fields.Many2one(
'product.uom', string='Product Unit of Measure', readonly=True)
price_unit = fields.Float(
string='Unit Price', readonly=True,
digits=dp.get_precision('Product Price'))

View File

@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015-2016 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="purchase_date_planned_update_form" model="ir.ui.view">
<field name="name">purchase_date_planned_update_form</field>
<field name="model">purchase.date.planned.update</field>
<field name="arch" type="xml">
<form string="Update Scheduled Dates">
<group name="main">
<label string="You can update all the lines at once or update only selected lines." colspan="2"/>
<label string="The purchase order lines that are already fully received are not listed below." colspan="2"/>
<field name="date_planned"/>
<field name="line_ids" colspan="2" nolabel="1">
<tree editable="bottom">
<field name="purchase_line_id" invisible="1"/>
<field name="product_id"/>
<field name="name"/>
<field name="date_planned"/>
<field name="product_qty"/>
<field name="product_uom" groups="product.group_uom"/>
<field name="price_unit"/>
</tree>
</field>
</group>
<footer>
<button name="run" type="object" string="Update"
class="oe_highlight"/>
<button special="cancel" string="Cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>
<record id="purchase_date_planned_update_action" model="ir.actions.act_window">
<field name="name">Update Scheduled Dates</field>
<field name="res_model">purchase.date.planned.update</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>