-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
sale_project_fixed_price_task_completed_invoicing/data/sale_project_fixed_price_demo.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,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data noupdate="1"> | ||
<record id="product.service_order_01" model="product.product"> | ||
<field name="track_service">timesheet</field> | ||
</record> | ||
<record id="product.product_product_2" model="product.product"> | ||
<field name="name">Support Contract (on timesheet)</field> | ||
<field name="track_service">timesheet</field> | ||
</record> | ||
|
||
<record id="line_services" model="sale.order.line"> | ||
<field name="order_id" ref="sale.sale_order_3"/> | ||
<field name="name">Advance</field> | ||
<field name="product_id" ref="sale.advance_product_0"/> | ||
<field name="product_uom" ref="product.product_uom_day"/> | ||
<field name="price_unit">150.0</field> | ||
<field name="product_uom_qty">5.0</field> | ||
</record> | ||
|
||
<record id="project_GAP" model="project.project"> | ||
<field name="date_start" eval="time.strftime('%Y-%m-01 10:00:00')"/> | ||
<field name="name">Internal - GAP Analysis</field> | ||
<field name="color">2</field> | ||
<field name="privacy_visibility">employees</field> | ||
<field name="alias_model">project.task</field> | ||
<field name="type_ids" eval="[(4, ref('project.project_stage_0')) ,(4,ref('project.project_stage_1')) ,(4,ref('project.project_stage_2')) ,(4,ref('project.project_stage_3'))]"/> | ||
</record> | ||
|
||
<record id="product.product_product_fixed_price" model="product.product"> | ||
<field name="track_service">task</field> | ||
<field name="project_id" ref="project_GAP"/> | ||
</record> | ||
</data> | ||
</odoo> |
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,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from . sale_project_fixed_price |
36 changes: 36 additions & 0 deletions
36
sale_project_fixed_price_task_completed_invoicing/tests/sale_project_fixed_price.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,36 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
from odoo.addons.sale.tests.test_sale_common import TestSale | ||
|
||
|
||
class TestSaleProjectFixedPrice(TestSale): | ||
|
||
def test_sale_project_fixed_price(self): | ||
prod_task = self.env.ref('product.product_product_fixed_price') | ||
so_vals = { | ||
'partner_id': self.partner.id, | ||
'partner_invoice_id': self.partner.id, | ||
'partner_shipping_id': self.partner.id, | ||
'order_line': [(0, 0, {'name': prod_task.name, | ||
'product_id': prod_task.id, | ||
'product_uom_qty': 1, | ||
'product_uom': prod_task.uom_id.id, | ||
'price_unit': prod_task.list_price})], | ||
'pricelist_id': self.env.ref('product.list0').id, | ||
} | ||
so = self.env['sale.order'].create(so_vals) | ||
so.action_confirm() | ||
|
||
# check task creation | ||
project = self.env.ref('sale_timesheet.project_GAP') | ||
task = project.task_ids.filtered( | ||
lambda t: t.name == '%s:%s' % (so.name, prod_task.name)) | ||
self.assertTrue(task, 'Sale Service: task is not created') | ||
self.assertEqual(task.partner_id, so.partner_id, | ||
'Sale Service: customer should be the same on task ' | ||
'and on SO') | ||
# validate the task | ||
task.toggle_invoiceable() | ||
line = so.order_line | ||
self.assertTrue(line.product_uom_qty == line.qty_delivered, | ||
'Sale Service: line should be invoiced completely') |