-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.0.1.0.0][stock_picking_wave_picking_selection]
- Loading branch information
Showing
7 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
==================================== | ||
Stock Picking Wave Picking Selection | ||
==================================== | ||
|
||
This module adds searching criteria for picking wave. | ||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
1. Clone the branch 8.0 of the repository https://github.com/open-synergy/opnsynid-stock-logistics-workflow | ||
2. Add the path to this repository in your configuration (addons-path) | ||
3. Update the module list | ||
4. Go to menu *Setting -> Modules -> Local Modules* | ||
5. Search For *Stock Picking Wave Picking Selection* | ||
6. Install the module | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/open-synergy/opnsynid-stock-logistics-workflow/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. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Michael Viriyananda <viriyananda.michael@gmail.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://opensynergy-indonesia.com/logo.png | ||
:alt: OpenSynergy Indonesia | ||
:target: https://opensynergy-indonesia.com | ||
|
||
This module is maintained by the OpenSynergy Indonesia. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Automatic Picking Selection on Picking Wave", | ||
"version": "8.0.1.0.0", | ||
"category": "Stock Management", | ||
"website": "https://opensynergy-indonesia.com", | ||
"author": "OpenSynergy Indonesia", | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"depends": [ | ||
"stock_picking_wave", | ||
"stock_transport_multi_address" | ||
], | ||
"data": [ | ||
"views/stock_picking_wave_view.xml" | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import stock_picking_wave |
110 changes: 110 additions & 0 deletions
110
stock_picking_wave_picking_selection/models/stock_picking_wave.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp import models, fields, api, _ | ||
from openerp.exceptions import Warning as UserError | ||
|
||
|
||
class StockPickingWave(models.Model): | ||
_inherit = "stock.picking.wave" | ||
|
||
delivery_address_ids = fields.Many2many( | ||
string="Delivery Address", | ||
comodel_name="res.partner", | ||
relation="picking_wave_partner_rel", | ||
column1="wave_id", | ||
column2="partner_id", | ||
) | ||
picking_type_ids = fields.Many2many( | ||
string="Picking Type", | ||
comodel_name="stock.picking.type", | ||
relation="picking_wave_picking_type_rel", | ||
column1="wave_id", | ||
column2="picking_type_id", | ||
) | ||
scheduled_date_start = fields.Datetime( | ||
string="Scheduled Date Start" | ||
) | ||
scheduled_date_end = fields.Datetime( | ||
string="Scheduled Date End" | ||
) | ||
creation_date_start = fields.Datetime( | ||
string="Creation Date Start" | ||
) | ||
creation_date_end = fields.Datetime( | ||
string="Creation Date End" | ||
) | ||
|
||
@api.constrains( | ||
"scheduled_date_start", "scheduled_date_end") | ||
def _check_scheduled_date(self): | ||
strWarning = _( | ||
"Scheduled Date Start must be greater than Scheduled Date End") | ||
if self.scheduled_date_start and self.scheduled_date_end: | ||
if self.scheduled_date_start > self.scheduled_date_end: | ||
raise UserError(strWarning) | ||
|
||
@api.constrains( | ||
"creation_date_start", "creation_date_end") | ||
def _check_creation_date(self): | ||
strWarning = _( | ||
"Creation Date Start must be greater than Creation Date End") | ||
if self.creation_date_start and self.creation_date_end: | ||
if self.creation_date_start > self.creation_date_end: | ||
raise UserError(strWarning) | ||
|
||
@api.multi | ||
def _prepare_picking_search(self): | ||
self.ensure_one() | ||
criteria = [] | ||
|
||
scheduled_date_start = self.scheduled_date_start | ||
scheduled_date_end = self.scheduled_date_end | ||
creation_date_start = self.creation_date_start | ||
creation_date_end = self.creation_date_end | ||
delivery_address_ids = self.delivery_address_ids | ||
picking_type_ids = self.picking_type_ids | ||
|
||
if scheduled_date_start: | ||
criteria.append( | ||
("min_date", ">=", scheduled_date_start) | ||
) | ||
if scheduled_date_end: | ||
criteria.append( | ||
("min_date", "<=", scheduled_date_end) | ||
) | ||
if creation_date_start: | ||
criteria.append( | ||
("date", ">=", creation_date_start) | ||
) | ||
if creation_date_end: | ||
criteria.append( | ||
("date", "<=", creation_date_end) | ||
) | ||
if delivery_address_ids: | ||
criteria.append( | ||
("delivery_address_id", "in", delivery_address_ids.ids) | ||
) | ||
if picking_type_ids: | ||
criteria.append( | ||
("picking_type_id", "in", picking_type_ids.ids) | ||
) | ||
return criteria | ||
|
||
@api.multi | ||
def button_search_pickings(self): | ||
obj_stock_picking = self.env["stock.picking"] | ||
|
||
criteria = self._prepare_picking_search() | ||
criteria.append( | ||
("wave_id", "=", False) | ||
) | ||
criteria.append( | ||
("state", "not in", ("cancel", "done")) | ||
) | ||
picking_ids = obj_stock_picking.search(criteria) | ||
if picking_ids: | ||
self.picking_ids = [(6, 0, picking_ids.ids)] | ||
else: | ||
self.picking_ids = [(6, 0, [])] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
stock_picking_wave_picking_selection/views/stock_picking_wave_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
<record id="stock_picking_wave_view_form" model="ir.ui.view"> | ||
<field name="name">Inherit: Stock Picking Wave Picking Selection Form</field> | ||
<field name="model">stock.picking.wave</field> | ||
<field name="inherit_id" ref="stock_picking_wave.view_picking_wave_form"/> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<xpath expr="//field[@name='picking_ids']" position="before"> | ||
<group name="group_1"> | ||
<button | ||
name="button_search_pickings" | ||
type="object" | ||
string="Search" | ||
icon="gtk-find" | ||
attrs="{'invisible': [('state', 'not in', ('draft', 'in_progress'))]}" | ||
/> | ||
</group> | ||
<group name="group_2" colspan="4" col="2"> | ||
<group name="group_2_1" colspan="1" col="2"> | ||
<field name="scheduled_date_start" string="Schedule Date" attrs="{'invisible': [('state', 'not in', ('draft', 'in_progress'))]}"/> | ||
<field name="scheduled_date_end" attrs="{'invisible': [('state', 'not in', ('draft', 'in_progress'))]}"/> | ||
</group> | ||
<group name="group_2_2" colspan="1" col="2"> | ||
<field name="creation_date_start" attrs="{'invisible': [('state', 'not in', ('draft', 'in_progress'))]}"/> | ||
<field name="creation_date_end" attrs="{'invisible': [('state', 'not in', ('draft', 'in_progress'))]}"/> | ||
</group> | ||
</group> | ||
<group name="group_3" colspan="4" col="2"> | ||
<field name="delivery_address_ids" attrs="{'invisible': [('state', 'not in', ('draft', 'in_progress'))]}" widget="many2many_tags"/> | ||
<field name="picking_type_ids" attrs="{'invisible': [('state', 'not in', ('draft', 'in_progress'))]}" widget="many2many_tags"/> | ||
</group> | ||
</xpath> | ||
</data> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |