-
-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
170 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,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# | ||
# Author: Kitti U. <kittiu@gmail.com> | ||
# Copyright 2015 Ecosoft | ||
# | ||
# 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 . import model |
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,47 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# | ||
# Author: Kitti U. <kittiu@gmail.com> | ||
# Copyright 2015 Ecosoft | ||
# | ||
# 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': 'Sales Expected Delivery Date', | ||
'version': '1.0', | ||
'author': "Ecosoft, Odoo Community Association (OCA)", | ||
'category': 'Sale', | ||
'license': 'AGPL-3', | ||
'complexity': 'easy', | ||
'images': [], | ||
'website': "http://www.ecosoft.co.th", | ||
'description': """ | ||
This module provides "Expected Delivery Date" in Sales Order. | ||
This date will be used for DO's Scheduled Time instead of standard use of Product's customer lead time (will be ignored). | ||
""", | ||
'depends': ['sale', | ||
'sale_stock' | ||
], | ||
'demo': [], | ||
'data': ['view/sale_view.xml', | ||
], | ||
'auto_install': False, | ||
'test': [ | ||
'test/sale_expected_delivery_date.yml', | ||
], | ||
'installable': True, | ||
} | ||
|
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,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# | ||
# Author: Kitti U. <kittiu@gmail.com> | ||
# Copyright 2015 Ecosoft | ||
# | ||
# 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 . import sale |
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,41 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# | ||
# Author: Kitti U. <kittiu@gmail.com> | ||
# Copyright 2015 Ecosoft | ||
# | ||
# 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 datetime import datetime | ||
|
||
class SaleOrder(models.Model): | ||
_inherit = 'sale.order' | ||
|
||
date_expected = fields.Date( | ||
string='Expected Delivery Date', | ||
required=True, | ||
readonly=True, | ||
states={'draft': [('readonly', False)]}, | ||
default=lambda *a: datetime.now().strftime('%Y-%m-%d'), | ||
) | ||
|
||
@api.v7 | ||
def _get_date_planned(self, cr, uid, order, line, start_date, context=None): | ||
# Overwrite with this date | ||
return order.date_expected | ||
|
||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
23 changes: 23 additions & 0 deletions
23
sale_expected_delivery_date/test/sale_expected_delivery_date.yml
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,23 @@ | ||
- | ||
In order to test that expected delivery date will be used as scheduled date in delivery order | ||
I create a Quotation | ||
- | ||
!record {model: sale.order, id: sale_order_expected_delivery_01}: | ||
partner_id: base.res_partner_2 | ||
order_policy: 'picking' | ||
date_expected: '2015-06-28' | ||
order_line: | ||
- product_id: stock.product_icecream_product_template | ||
product_uom_qty: 1 | ||
|
||
- | ||
I confirm the Quotation with "On Delivery Order" order policy. | ||
- | ||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_expected_delivery_01} | ||
|
||
- | ||
I check Delivery Order being created, and check if it is using expected delivery date as scheduled date | ||
- | ||
!python {model: sale.order}: | | ||
order = self.browse(cr, uid, ref('sale_order_expected_delivery_01')) | ||
assert order.picking_ids[0].min_date[:10] == order.date_expected, "Delivery Order is not using Sales Order's Expected Delivery Date" |
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,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
<record id="view_order_form_ext" model="ir.ui.view"> | ||
<field name="name">view.order.form.ext</field> | ||
<field name="model">sale.order</field> | ||
<field name="type">form</field> | ||
<field name="inherit_id" ref="sale.view_order_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="date_order" position="after"> | ||
<field name='date_expected'/> | ||
</field> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |