[MOV] sale: re-organise directory structure according to new API guidelines
This commit is contained in:
committed by
Yannick Tivisse
parent
dba1a641e3
commit
a33e808ca6
@@ -1,11 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import sale
|
||||
import sale_analytic
|
||||
import sale_layout
|
||||
import sales_team
|
||||
import res_partner
|
||||
import wizard
|
||||
import models
|
||||
import report
|
||||
import res_config
|
||||
import wizard
|
||||
|
||||
+20
-19
@@ -43,29 +43,30 @@ The Dashboard for the Sales Manager will include
|
||||
'website': 'https://www.odoo.com/page/crm',
|
||||
'depends': ['sales_team', 'account', 'procurement', 'report', 'web_tour'],
|
||||
'data': [
|
||||
'wizard/sale_make_invoice_advance.xml',
|
||||
'data/ir_sequence_data.xml',
|
||||
'data/sale_data.xml',
|
||||
'data/sale_layout_category_data.xml',
|
||||
'data/sale_tour.xml',
|
||||
'report/sale_report.xml',
|
||||
'data/mail_template_data.xml',
|
||||
'report/sale_report_views.xml',
|
||||
'report/sale_report_templates.xml',
|
||||
'report/invoice_report_templates.xml',
|
||||
'security/sale_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'sale_sequence.xml',
|
||||
'sale_report.xml',
|
||||
'sale_data.xml',
|
||||
'sale_layout_category_data.xml',
|
||||
'sale_view.xml',
|
||||
'sales_team_view.xml',
|
||||
'res_partner_view.xml',
|
||||
'tour_view.xml',
|
||||
'report/sale_report_view.xml',
|
||||
'data/mail_template_data.xml',
|
||||
'res_config_view.xml',
|
||||
'views/report_saleorder.xml',
|
||||
'views/sale.xml',
|
||||
'views/report_invoice_layouted.xml',
|
||||
'wizard/sale_make_invoice_advance_views.xml',
|
||||
'views/sale_views.xml',
|
||||
'views/sales_team_views.xml',
|
||||
'views/res_partner_views.xml',
|
||||
'views/sale_config_settings_views.xml',
|
||||
'views/sale_templates.xml',
|
||||
'views/sale_layout_category_view.xml',
|
||||
'sales_team_dashboard.xml',
|
||||
'views/sales_team_dashboard_views.xml',
|
||||
],
|
||||
'demo': [
|
||||
'data/sale_demo.xml',
|
||||
'data/product_product_demo.xml',
|
||||
],
|
||||
'demo': ['sale_demo.xml',
|
||||
'sale_product_demo.xml',
|
||||
],
|
||||
'css': ['static/src/css/sale.css'],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import res_partner
|
||||
import sale
|
||||
import sale_analytic
|
||||
import sale_config_settings
|
||||
import sale_layout
|
||||
import sales_team
|
||||
@@ -1,77 +0,0 @@
|
||||
-
|
||||
!python {model: ir.model.data, id: False} : |
|
||||
journal_id = self.env['account.journal'].search([('type', '=', 'sale')], limit=1).id
|
||||
account_recv_id = self.env['account.account'].search([('user_type_id', '=', ref('account.data_account_type_receivable'))], limit=1).id
|
||||
account_sale_id = self.env['account.account'].search([('user_type_id', '=', ref('account.data_account_type_revenue')), ('tag_ids', 'in', [ref('account.account_tag_operating')])], limit=1).id
|
||||
if not account_sale_id:
|
||||
account_sale_id = self.env['account.account'].search([('user_type_id', '=', ref('account.data_account_type_revenue'))], limit=1).id
|
||||
if journal_id and account_recv_id:
|
||||
vals = {
|
||||
'currency': ref('base.EUR'),
|
||||
'company_id': ref('base.main_company'),
|
||||
'partner_id': ref('base.res_partner_1'),
|
||||
'journal_id': journal_id,
|
||||
'team_id': ref('sales_team.team_sales_department'),
|
||||
'state': 'draft',
|
||||
'type': 'out_invoice',
|
||||
'account_id': account_recv_id,
|
||||
'name': 'Test invoice 1',
|
||||
}
|
||||
self._update('account.invoice', 'sale', vals, 'test_crm_sale_invoice_1')
|
||||
vals = {
|
||||
'currency': ref('base.EUR'),
|
||||
'company_id': ref('base.main_company'),
|
||||
'partner_id': ref('base.res_partner_1'),
|
||||
'journal_id': journal_id,
|
||||
'team_id': ref('sales_team.crm_team_1'),
|
||||
'state': 'draft',
|
||||
'type': 'out_invoice',
|
||||
'account_id': account_recv_id,
|
||||
'name': 'Test invoice 2',
|
||||
}
|
||||
self._update('account.invoice', 'sale', vals, 'test_crm_sale_invoice_2')
|
||||
if account_sale_id:
|
||||
vals = {
|
||||
'name': '',
|
||||
'product_id': ref('product.consu_delivery_03'),
|
||||
'invoice_id': ref('test_crm_sale_invoice_1'),
|
||||
'price_unit': 250,
|
||||
'quantity': 1,
|
||||
'account_id': account_sale_id,
|
||||
}
|
||||
self._update('account.invoice.line', 'sale', vals, 'test_crm_sale_invoice_1_line_1')
|
||||
vals = {
|
||||
'name': '',
|
||||
'product_id': ref('product.consu_delivery_02'),
|
||||
'invoice_id': ref('test_crm_sale_invoice_1'),
|
||||
'price_unit': 800,
|
||||
'quantity': 2,
|
||||
'account_id': account_sale_id,
|
||||
}
|
||||
self._update('account.invoice.line', 'sale', vals, 'test_crm_sale_invoice_1_line_2')
|
||||
vals = {
|
||||
'name': '',
|
||||
'product_id': ref('product.consu_delivery_01'),
|
||||
'invoice_id': ref('test_crm_sale_invoice_1'),
|
||||
'price_unit': 4800,
|
||||
'quantity': 4,
|
||||
'account_id': account_sale_id,
|
||||
}
|
||||
self._update('account.invoice.line', 'sale', vals, 'test_crm_sale_invoice_1_line_3')
|
||||
vals = {
|
||||
'name': '',
|
||||
'product_id': ref('product.consu_delivery_01'),
|
||||
'invoice_id': ref('test_crm_sale_invoice_2'),
|
||||
'price_unit': 500,
|
||||
'quantity': 1,
|
||||
'account_id': account_sale_id,
|
||||
}
|
||||
self._update('account.invoice.line', 'sale', vals, 'test_crm_sale_invoice_2_line_1')
|
||||
self.env['account.invoice'].browse(ref('test_crm_sale_invoice_1')).signal_workflow('invoice_open')
|
||||
self.env['account.invoice'].browse(ref('test_crm_sale_invoice_2')).signal_workflow('invoice_open')
|
||||
bank_journal_id = self.env['account.journal'].search([('type', '=', 'bank')], limit=1).id
|
||||
if bank_journal_id:
|
||||
bank_journal_id = bank_journal_id
|
||||
self.env['account.invoice'].browse(ref('test_crm_sale_invoice_1')).pay_and_reconcile(bank_journal_id[0], 1850)
|
||||
self.env['account.invoice'].browse(ref('test_crm_sale_invoice_2')).pay_and_reconcile(bank_journal_id[0], 500)
|
||||
-
|
||||
@@ -1,109 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- Resource: sale.order -->
|
||||
<record id="test_order_1" model="sale.order">
|
||||
<field model="product.pricelist" name="pricelist_id" search="[]"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field model="res.partner" name="partner_id" search="[]"/>
|
||||
<field model="res.partner" name="partner_invoice_id" search="[]"/>
|
||||
<field model="res.partner" name="partner_shipping_id" search="[]"/>
|
||||
</record>
|
||||
<!-- Resource: sale.order.line -->
|
||||
<record id="test_order_1_line_1" model="sale.order.line">
|
||||
<field name="order_id" ref="test_order_1"/>
|
||||
<field name="name">[PCSC234] PC Assemble SC234</field>
|
||||
<field name="product_id" ref="product.product_product_3"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="price_unit">450</field>
|
||||
<field name="product_uom_qty">2</field>
|
||||
</record>
|
||||
<record id="test_order_1_line_3" model="sale.order.line">
|
||||
<field name="order_id" ref="test_order_1"/>
|
||||
<field name="name">Switch, 24 ports</field>
|
||||
<field name="product_id" ref="product.product_delivery_01"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="price_unit">90</field>
|
||||
<field name="product_uom_qty">3</field>
|
||||
</record>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" severity="error" string="The amount of the sales order is correctly computed">
|
||||
<test expr="sum([l.price_subtotal for l in order_line]) == amount_untaxed"/>
|
||||
</assert>
|
||||
|
||||
<workflow action="order_confirm" model="sale.order" ref="test_order_1"/>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" string="the sales order is now in 'Manual in progress' state">
|
||||
<test expr="state">manual</test>
|
||||
</assert>
|
||||
|
||||
<workflow action="manual_invoice" model="sale.order" ref="test_order_1" uid="base.user_root"/>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" string="the sales order is now in progress">
|
||||
<test expr="state">progress</test>
|
||||
</assert>
|
||||
|
||||
<!-- Treat generated invoice -->
|
||||
<assert id="test_order_1" model="sale.order" severity="fatal" string="the sales order has now a corresponding invoice">
|
||||
<test expr="len(invoice_ids) == 1"/>
|
||||
</assert>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" severity="fatal" string="the sales order's has the same amount and is currently a draft">
|
||||
<test expr="invoice_ids[0].amount_untaxed == amount_untaxed"/>
|
||||
<test expr="invoice_ids[0].amount_total == amount_total"/>
|
||||
<test expr="invoice_ids[0].state">draft</test>
|
||||
</assert>
|
||||
|
||||
<workflow action="invoice_open" model="account.invoice">
|
||||
<value eval="obj(ref('test_order_1')).invoice_ids[0].id" model="sale.order"/>
|
||||
</workflow>
|
||||
|
||||
<function model="account.invoice" name="pay_and_reconcile">
|
||||
<value eval="[obj(ref('test_order_1')).invoice_ids[0].id]" model="sale.order"/>
|
||||
<value eval="ref('account.bank_journal')"/>
|
||||
</function>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" severity="fatal" string="the sales order's invoice is now paid">
|
||||
<test expr="invoice_ids[0].state">paid</test>
|
||||
</assert>
|
||||
|
||||
<!-- Treat generated picking -->
|
||||
<assert id="test_order_1" model="sale.order" severity="fatal" string="the sales order has now a correspending picking">
|
||||
<test expr="len(picking_ids) == 1"/>
|
||||
</assert>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" severity="error" string="the sales order's picking will be sent to the good address and is already confirmed">
|
||||
<test expr="picking_ids[0].partner_id == partner_shipping_id"/>
|
||||
<!-- test expr="picking_ids[0].state">confirmed</test # Desactivated because of MRP_JIT -->
|
||||
</assert>
|
||||
|
||||
<!-- Here we need to use the function tag because action_assign is a method of stock_picking and not part of the workflow -->
|
||||
<function model="stock.picking" name="action_assign">
|
||||
<value eval="[obj(ref('test_order_1')).picking_ids[0].id]" model="sale.order"/>
|
||||
</function>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" severity="fatal" string="the sales order's picking is now assigned">
|
||||
<test expr="picking_ids[0].state">assigned</test>
|
||||
</assert>
|
||||
|
||||
<!-- Do the same as in wizard_partial_picking lines 143-144 -->
|
||||
<function model="stock.picking" name="action_move">
|
||||
<value eval="[obj(ref('test_order_1')).picking_ids[0].id]" model="sale.order"/>
|
||||
</function>
|
||||
|
||||
<workflow action="button_done" model="stock.picking">
|
||||
<value eval="obj(ref('test_order_1')).picking_ids[0].id" model="sale.order"/>
|
||||
</workflow>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" string="the sales order's picking is now done">
|
||||
<test expr="picking_ids[0].state">done</test>
|
||||
</assert>
|
||||
|
||||
<!-- Run all schedulers -->
|
||||
<function model="procurement.order" name="run_scheduler"/>
|
||||
|
||||
<assert id="test_order_1" model="sale.order" string="the sales order is now done">
|
||||
<test expr="state">done</test>
|
||||
</assert>
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user