Commit Graph
67 Commits
Author SHA1 Message Date
Nicolas Lempereur 8aef2eb92d [FIX] sale_coupon: error only one of begin/end set
If a promotion program has a start date without a end date, or a end
date without a start date, there was an error of comparing string to
boolean

opw-775236
2017-10-04 19:12:40 +02:00
Yannick Tivisse 29a5de310e [FIX] sale_coupon: Remove old and buggy compute field (not stored)
Purpose
=======

Click on Generate Coupon gives traceback

Steps to reproduce issue :
>> install coupon.
>> total number of customers are more than 40.
>> debugger mode off.
>> now click on generate the coupon.

Specification
=============

Before the new char domain widget, we were forced to couple the domain Char field with a many2many computed field to display the partners.

Now it's not useful, and this is leading to a traceback if the records count is greater than 40.
2017-09-21 16:11:32 +02:00
Yannick Tivisse ce8b35ee1d [FIX] sale_coupon: Set a valid default value 2017-09-19 14:27:26 +02:00
Yannick Tivisse 1ebfbf3e86 [IMP] res_config: Update file names, xmlids, class names according to guidelines
Now that we only have one model (res.config.settings). Uniformize everything according to the guidelines.
2017-09-01 13:39:18 +02:00
Deep Patel 573dbfc17d [IMP] web,account,...: Regroup settings, add a nav and search bar
Purpose
=======

Settings are often way too long and hard to scan and sometimes you don't know where to find the settings you're looking for.
By adding a left navigation, you can already have an overview of the settings, and switch easily between them.

Specification
=============

- Add a search bar on all the apps that have settings which can search results from all the installed apps.
  (If i'm on sales settings,and I search anything then it shows results from sales settings and also shows
  all the other matching results from all the other apps such as, Inventory...etc) with app name.
- Able to activate feature from the current page results (no matter if the searched result is from another apps).
- Highlight searched word in results
- Delete the sheet, have a full white background
- Add left navigation bar on setting
- Left navigation bar fixed
- List displayed based on installed apps
- On right panel, by default display current app setting and change accordingly
- [Mobile] Left navigation bar displayed on top
- Add Breadcrumb on top of the page: have the name "Settings" + Save / discard CTA + Search
- Add General Settings on the nav bar
- remove "save this page..." notif in all settings
- Delete all recommanded apps section + all checkbox that install app should disappear:
        payroll: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrSkMzWVpuZ0ZoaFE/view?usp=drivesdk
        Events: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrYXlHMHd2NTM2blE/view?usp=drivesdk
        Manufacturing: Delete Repair - Quality Control - Maintenance - Product Lifecycle Management [LAP][ok]
        Timesheets: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrdFg5XzNydkd2TlU/view?usp=drivesdk
        project: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrraWo3NE04TktwcTQ/view?usp=drivesdk
        inventory: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrQkRaVUR5ekFQYTQ/view?usp=drivesdk
        recruitment: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrbDdqLWQweF80UkE/view?usp=drivesdk
        purchase: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrRlAyUDBnb0trQWs/view?usp=drivesdk
        email marketing: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrOUZONjhvX2k3Y2s/view?usp=drivesdk
        expenses: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrrR0JpN1ZpQmtxU3M/view?usp=drivesdk
        attendances: https://drive.google.com/a/odoo.com/file/d/0B1uIL9E_zXrralpjZ1VJclNpMWs/view?usp=drivesdk
- About duplicate settings:
        Docsaway: Delete from Sales + delete Default Print Provider
        Attributs & Variants: Delete from Purchases - Manufacturing
        Multi-currencies: delete from Sales
        Unit Of Measures: Delete from Purchase & Expenses
- Add a scroll bar on the left bar when there's too many apps
- Keep the navbar visible even when you search
- Move General Settings to the bottom of the list
- Update on Settings:
    - Accounting:
        - rename automatic rates
        - Anglo Saxon Account: Should be in technical feature
        - Place Accounting Reports section before Taxes section
    - CRM:
        - Phone Validation: Enforce international format becomes
        - Local Numbers: (2 radio buttons proposals) Add international prefix / No prefix
    - Fleet: typo " ... a new car if ..." + text is too long <br>
    - project: fix tooltip for colab pads
2017-09-01 13:39:18 +02:00
Christophe Simonis fd2b69b91e [MERGE] forward port branch saas-17 up to d5d92993c81 2017-08-24 15:20:44 +02:00
Olivier Dony 13ca39dd6d [FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.

All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.

Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.

Also removed some dead code or improved the API to remove unnecessary
conversions.
2017-08-18 18:48:17 +02:00
Xavier Morel 12492433e3 [FIX] P3: random token generation
.encode('hex') is not valid in Python 3, and it turns out the generation method was way overkill/messy.
2017-08-18 11:27:14 +02:00
Haresh Shyara cc5bb1450b [REF] crm,sale: Split the applications into 2 separate apps
Purpose
=======

You install CRM but you don't see CRM icon (except in English, as long as sales is not installed) -> confusing
The dashboard with salesteam is not obvious & not useful for simple users: what are those channel boxes about? why don't I see all my activities?, etc.

Specifications
==============

Split CRM & Sales + land in business views straight away

Default Entry Views
~~~~~~~~~~~~~~~~~~~

- New default view for CRM: Pipeline kanban
- New default view for Sales: Quotation list

Dashboards
~~~~~~~~~~

- Move sales teams dashboard to Reporting: Sales Channels.
- Remove the upper part of the sales team dashboard

Menuitems Structure
~~~~~~~~~~~~~~~~~~~

- CRM menu

Pipeline:
        - Leads (optional)
        - Pipeline (default menu, default filter "My Pipeline")
        - Next Activities -> to remove (now there is an icon in top bar for next activities)
        - Quotations (If sale_management installed)
Customers
Phone Calls (if voip, if not yet removed because there is a BE task to use next activities instead)
Leads Management:
        - Scoring Rules
        - Leads Assignation
        - Team Assignation
Reporting:
        - Leads
        - Scoring page views
        - Opp. Assignement
        - Patnerships
        - Pipeline
        - Activities
        - Phonecalls
        - Sales Channels
Configuration:
        - Settings
        - Sales Channels
        - Activity Types
        - Leads & Opportunities:
                - Lead Tags
                - Lost Reasons
        - Resellers
                - Partner Level
                - Partner Activations
- Sales menu:

Orders:
        - Quotations
        - Orders
        - Customers
Invoicing:
        - Orders to Invoice
        - Orders to Upsell
Catalog:
        - Products
        - Promotion Programs
        - Coupon Programs
Reporting:
        - Sales
        - Sales Channels
        - All channels sales orders
Configuration:
        - Settings
        - Sales Channels
        - Sales Orders:
                - Quotation templates
                - Payment acquirers
                - Delivery Methods

Settings
~~~~~~~~

- Split settings form
- Remove recommended apps section
- Remove Timesheets section
- Remove Inventory Management and move shipping connectors to Shipping section
- Remove Integrations section
        - Move Docsaway option to "Quotations & Orders", right after proforma
        - Autocomplete and asterix: move to CRM section
- Restructure and rename sections this way:
        - Product Catalog
        - Pricing
        - Quotations & Orders
        - Shipping
        - Invoicing
        - eBay (if installed)
- Remove all the "Save this page and come back here" when checking a box that installs a new module

- restructure a bit the CRM settings, with 3 sections:

Pipeline
        - Leads
Contacts
        - Phone Validation
        - Customer Autocomplete
Integrations
        - Google Calendar / Synchronize your calendar with Google Calendar (copy from general settings but don't show message "Save this page and come back here...".
        - Asterisk (VOIP)
2017-08-08 16:58:50 +02:00
Christophe Simonis eaefc5b7ba [MERGE] forward port branch saas-16 up to 15e36ad39dc 2017-07-20 16:29:40 +02:00
Pratima Gupta 6d342b79d0 [FIX] sale_coupon: Add default value to char domain field
Otherwise the required field is not validated at wizard validation
2017-07-17 12:54:57 +02:00
Christophe Simonis 4e39d9e1e7 [MERGE] forward port branch saas-16 up to 953ab630bfc 2017-07-07 13:20:31 +02:00
Christophe Simonis 4e897d727a [MERGE] forward port branch saas-15 up to f77ffa3fe5f 2017-07-05 11:40:53 +02:00
Christophe Simonis e9b3d1c623 [MERGE] forward port branch saas-14 up to 403b27428a4 2017-07-05 11:39:44 +02:00
Nicolas Martinelli bb5d999596 [FIX] sale_coupon: default invoicing policy
The default invoicing policy should always be by ordered quantity.
Otherwise, if the user changes the default invoicing policy to
"delivered quantity", coupon won't be applied to the invoice.

opw-749632
2017-06-30 14:17:44 +02:00
Christophe Simonis 786889511b [MERGE] forward port branch saas-16 up to 32396ec64e4 2017-06-27 14:23:37 +02:00
Christophe Simonis 4889fdb135 [MERGE] forward port branch saas-15 up to 6492adc3c4c 2017-06-27 13:45:01 +02:00
Christophe Simonis 4a1cf10843 [MERGE] forward port branch saas-14 up to 23d93a69581 2017-06-27 12:11:13 +02:00
Christophe Simonis a5bf3016bb [FIX] sale_coupon: remove useless @depends
Theses fields are now deprecated.
2017-06-21 17:32:22 +02:00
Yannick Tivisse 8f6ec58757 [FIX] sale_coupon: Don't update automatic rewards on the fly
Purpose
=======

Currently we are updating the coupon rewards on the fly when creating/modifying/deleting a sales order line.

To avoid multiple searches on res_partners and product to know whether the customer/product is valid on the sale coupon program, we store the applicable customers and products on the program according to the domain defined on it.

This brings 2 issues:
- The customers/products stored on the program are not updated (Was the original spec)
- The checks are numerous and maybe overkill for the given results

Specification
=============

- Don't recompute the reward lines on SO modifications. Add a button to compute the line by hand and make an automatic compute on the SO validation or on the page shop/payment.

- When recomputing the reward lines, make a search on the res_partners and products instead. Now that the action is not triggered so often we can afford to make a search.

- Don't use the fields rule_partners_domain and rule_products_domain. This should be removed in master.

- The field is_public_included is useless now. And we decided to make the coupon available for all the partners if they fit the domain on the program.
2017-06-21 15:55:27 +02:00
Yannick Tivisse 3ed9b783dc [FIX] sale_coupon: Prevent users to modify the reward line product
Purpose
=======

People doesn't understand that the reward line product is the product that will be used in the discount line, not the product the be rewarded

If they set another product before the program is created, the product they set will be renamed, which is wrong.

Specification
=============

- Don't display the field before it's set
- Make the field readonly on the program form view
2017-06-21 15:54:15 +02:00
Yannick Tivisse c32fb6e358 [FIX] sale_coupon: Display an explicit warning message if reward isn't encoded on SO 2017-06-21 15:54:15 +02:00
Yannick Tivisse 9eb48f8275 [FIX] sale_coupon: Display an explicit warning message if partner can't have the reward 2017-06-21 15:54:06 +02:00
Yannick Tivisse a8d084025d [FIX] sale_coupon: Allow coupon usage for non customers
Purpose
=======

On a sale coupon program, the allowed partners are the customers by default.

That way, users like the Administrator aren't allowed to use coupon on a fresh database

Specification
=============

Allow all the partners by default and the user restrict the partners as he wishes.

Before this commit:
Coupon Program: Only customers have access to rewards
Promotional Program: Only customers have access to reward and this can be retricted with a domain

After this commit:
Coupon Program: All partners have access to rewards
Promotional Program: All partners have access to reward and this can be retricted with a domain
2017-06-21 15:53:15 +02:00
Christophe Simonis c5b299aadd [MERGE] forward port branch saas-16 up to bba7db31386 2017-06-13 01:32:11 +02:00
Christophe Simonis 3832ad5582 [MERGE] forward port branch saas-15 up to 6d260dcf661 2017-06-12 19:53:45 +02:00
Christophe Simonis ae3a42963f [MERGE] forward port branch saas-14 up to b709816a511 2017-06-12 19:20:54 +02:00
Denis Ledoux be8d0cf716 [FIX] sale_coupon: unlink an empty set of order lines
This is possible that `unlink` is called without any record in self.
In the given case, this is because of
`self.env['sale.order.line'].search([('order_id', 'in', self.ids), ('is_delivery', '=', True)]).unlink()`
in the `undelivery_set` method of the module delivery.

`Unlink` on an empty set is supported, and it should therefore be the case here as well.
This is not because `self.order_id.no_code_promo_program_ids` expects a singleton
for the `self.order_id` part, and this is actually an empty set as `self` is an empty set.

Besides, it makes sense to loop on the lines passed to `self`,
as you could pass several lines, not all having the same
`product_id`, for the above line
`related_program = self.env['sale.coupon.program'].search([('discount_line_product_id', '=', self.product_id.id)])`

opw-746084
2017-06-07 17:25:12 +02:00
Yannick Tivisse 3856b7aa55 [FIX] sale_coupon: Correct xml_ids for 2 menuitems
The xml_ids of 2 parent menuitems have changed in community repo.
2017-05-19 12:34:19 +02:00
Kishan Gajjar 6aea627dce [IMP] various: Add kanban views for all menuitems used in mobile
Purpose
=======

Improve readability on mobile

Specification
=============

Activate Kanban view on those so it could be displayed by default on mobile instead of view list

List of impacted modules:

- crm_voip: kanban for phonecalls

- website_crm_score: kanban for scoring rules

- pos_loyalty: kanban for loyalty programs

- account_deferred_revenue : kanban for deferred revenues(reuse assets)

- account_deferred_revenue : kanban for deferred revenues(reuse asset types)

- quality: kanban for quality control points

- helpdesk: kanban for all tickets

- quality: kanban for quality alert stages

- mrp_plm : kanban for ECO stages

- print: kanban for print provider

- print: kanban for print orders

- sale_coupon: kanban for coupon program

- sale_coupon: kanban for promotion program(reuse Coupon Program)

- website_crm_score: kanban for Teams Assignation(Reuse the sale channels)

- quality: kanban for quality teams(reuse Quality Dashboard).

- mrp_plm : kanban for ECO Types(reuse PLM Dashboard)

- account_reports_followup: kanban for Follow up level
2017-05-11 11:41:53 +02:00
dbh 416a8c4905 [ADD] sale_management: Separate sales menu items from sale app
Purpose
=======

Don't display sales app icon in Odoo homepage when installing ecommerce (only website should be visible)
it's confusing to have sales icon  -> where do I manage my sales? In sales or in website? -> in website

Specfication
============

We need one new modules to add Sales menus to the homepage. Currently they come with "sale". So when installing "website_sale", we get them (because sale and account are dependencies of website_sale). We don't want that anymore. Along with that you need to replace modules in Apps menu:
sales menu items must be in the new sale_management module, no longer in sale

- create new app "sale_management"
- Currently 3 app icons when installing ecommerce (Sales, Invoicing, Website) -> too many icons, where to start? -> GOAL: Only 2 icons > Website, Invoicing
- new module to display Sales Icon (like account_accountant): "sale_management"
- move menu items to sale_management
- sale, sale_management: move app description, rewrite the manifest file
- sale, sale_management: move tour from sale > sale_management
- Changes in some dependency module "sale" > "sale_management" modules: event_sale, mrp_repair, pos_sale, report_intrastat, sale_crm, sale_expense, sale_stock, sale_timesheet, website_quote

Menu items to move 'sale' --> 'sale_management'
===============================================

Sales
	Quotations
        Sales Orders
Invoicing
	Orders to invoice
        Orders to Upsell
Catalog
	Products
        Product Variants
        Pricelists
Reporting
	sales
Configuration
	Settings
        Products -Attributes, Attribute Values, Internal Categories
2017-05-10 13:32:24 +02:00
xmo-odoo 1960ad2694 [FIX] list -> iterable builtins
Cf commit fffaf735f5

Closes #989
2017-05-10 09:41:05 +02:00
xmo-odoo c3ad67cef2 [FIX] implicitly relative imports 2017-04-28 09:07:28 +02:00
Fabrice Henrion 0c6cf23dc0 [FIX] sale_coupon: typo
Closes #860
2017-04-11 17:55:16 +02:00
Christophe Simonis 510f257067 [MERGE] forward port branch saas-14 up to 0cb17b4c531 2017-03-28 18:33:37 +02:00
Nicolas Martinelli 803c148769 [FIX] sale_coupon: incorrect view
This part of the view was supposed to be removed, only purpose was
debugging.

opw-725178
2017-03-22 13:07:09 +01:00
Christophe Simonis 3e4fb652dd [FIX] sale_coupon: really use a meaningful icon
Followup of b0d07503365c67a4ad02318c362864eeb7e02f16 and #851
2017-03-21 15:35:44 +01:00
Fabrice Henrion fcddfbac0e [IMP] sale_coupon: use meaningful icon
XING is a brand

Closes #851
2017-03-16 13:45:42 +01:00
Christophe Simonis 8e039974f7 [MERGE] forward port branch saas-14 up to 2a56f2187dd 2017-03-01 16:54:58 +01:00
Yannick Tivisse 3c6b48c7b6 [FIX] sale_coupon_delivery: Do not unlink reward line if 'free_shipping'
The methods delivery_set and delivery_unset are called everywhere (mostly on the ecommerce). The reasons for that is that we do not want several shipping lines on the same order. A better way to achieve this would have been to create the line if it doesn't exist or write on it to modify the 'price_unit' instead.

The side effect of that behavior is:
- A delivery line is set on the order.
- We apply a coupon to get a free shipping
- We go on the payment page. The method _cart_update is called, which calls delivery_set, so delivery_unset. The shipping line is unlinked to create again a new shipping line with the price updated. As the shipping line is removed, a recomputation of the reward lines is made. The program isn't applicable anymore as there's no shipping line on the order. The reward is thus removed.

That way, it's impossible to have a free shipping reward on the ecommerce and achieve the full checkout process.

What's done in this commit:

If a free shipping is applicable by code or if a free shipping can be automatically applied. It will be done with a price of 0.0 if there's no shipping line or the price_unit on the shipping line if set. If the shipping line is removed (every 2 seconds on a checkout process), the reward line is not unlinked and the price is set to 0.0.

That way, it's now possible to make a full flow.

NB: If a line is unlinked on an order, we unlink the reward line if it's the last one set on the order. This is to avoid free shipping line coming back on a new order in the ecommerce even if not applicable.
2017-02-24 11:01:23 +01:00
Yannick Tivisse 7390b3246d [FIX] sale_coupon: Set taxes on reward line if free product 2017-02-24 11:01:23 +01:00
Christophe Simonis 566d60f686 [MERGE] forward port branch saas-14 up to cf1e7902f32 2017-02-09 16:11:24 +01:00
Sagar Ahirrao 1ed9194827 [IMP] sales: rearrange menuitems and specify some groups on them
Purpose
=======

It's hard to find all the menu items dedicated to products & pricing:
- create a product
- set up a discount
- change the pricing
such recurring actions are related to each other but you need to go to different menus: e.g. to edit pricelists you have to go to settings while editing your pricing is a business operation.

Specification
=============

make one menu item like in ecommerce: CATALOG

Also clean reporting and configurion menus a bit...

Details
=======

Sales menu rearrangement :

Dashboard
Sales
Invoicing
    Orders to Invoice
    Orders to Upsell
Leads Management
Catalog (takes straight to products if no access to variant, pricelist or coupons)
    Products (move from Sales)
    Product Variants (move from Sales)
    Pricelists (move from Config)
    Promotion Programs (move from Config)
    Coupon Programs (move from Config)
Reporting (reorder items, from leads to sales)
    Leads
    Scoring Page Views
    Opp. Assignment Analysis
    Partnerships
    Pipeline
    Activities
    Phonecalls
    Sales
Configuration
    Settings
    Sales Channels (move up)
    Leads & Opportunities
    Sales
        Quotation Templates
        Report Layout Categories
        Payment Methods (if online quotation installed)
        Delivery Methods (move from Config > Delivery)
    Products
        Attributes
        Attribute Values
        Internal Categories (rename from Product Categories)
        Units of Measure
        Unit of Measure Categories
    Pricelists (remove)
    Delivery (remove)
2017-02-07 15:37:09 +01:00
Yannick Tivisse 74ebc34fea [FIX] sale_coupon: Trigger correctly the reward recomputation methods
Use Case
========

In the coupon module, a call to a write, a create or an unlink on a sales order line may trigger a write, a create or an unlink on another line. Example: I have a promotional offer "If you buy for more than 100 euros, you got a 10 percent discount on the sales order. On my sales order, I buy 2 imac at 999 euros. At that moment my total amount is over 1000 euros and I got another line, the discount. I write on the sales order line that I only buy one imac, a unlink is trigger on the reward line to remove it from the sales order.

Current Solution
================

At the beginning, I was overwriting the write, the create and the unlink methods on the sales order line to perform the correct actions according to the promotional offers that were still applicable, not applicable anymore of newly applicable. This solution was followed by side effects on the computed fields. For example, a write on the SO line that was triggering an unlink on another line was triggering a computed field that depended on the sales order line. In that case, the environment I received on the compute method was the environment before the line unlink. As the compute method was looping on the sales order line, it was taking values on a line that wasn't existing anymore and that way it was triggering an 'This record doesn't exist or has been deleted' error.

After a discussion with @rco-odoo, we realized that the only way to achieve this was to override the write method on a sales order to avoid quadratic computation loop when creating/editing/deleting sale order lines. As coupon are recorded as sale.order.line, it may effectively blow up.

We also overrode the create method on a sales order line to make an ORM command on the sales order instead of a simple create on the sales order. See: https://github.com/odoo/enterprise/blob/saas-14/sale_coupon/models/sale_order.py#L253

For the write and the unlink, this is a little more complicated because a write may trigger a write and an unlink may trigger an unlink, resulting in an infinite loop.

New Solution
============

Having a method _recompute_coupon_lines on sale.order. This method do nothing if there is a key coupon_recompute in the context.

```python
@multi
def _recompute_coupon_lines(self):
   if self.env.context.get('coupon_recompute'):
       return
   self = self.with_context(coupon_recompute=True)   # avoid loop
   [...do actual stuff...]
```

The create/write/unlink method on sale.order.line call super before calling the method _recompute_coupon_lines

```python
@multi
def write(self, values):
    result = super(SaleOrderLine, self).write(values)
    self.mapped('order_id')._recompute_coupon_lines()
    return result
```

In order (pun intended) to accelerate mass creation/edition of lines, the method create/write/unlink of sale.order should call recompute themself

```python
@mutli
def write(self, values):
    result = super(SaleOrder, self.with_context(coupon_recompute=True)).write(values)
    self._recompute_coupon_lines()
    return result
```
2017-02-02 10:47:51 +01:00
Yannick Tivisse 2af2f4f558 [FIX] sale_coupon: Allow the public users to use the coupon mechanism 2017-01-31 10:31:37 +01:00
Yannick Tivisse 76e691f0fe [FIX] sale_coupon: Apply immediate programs on order line creation 2017-01-30 15:45:38 +01:00
Yannick Tivisse a00ebcedcc [FIX] sale_coupon: Assign a generated coupon to the order customer 2017-01-30 14:38:03 +01:00
Yannick Tivisse 6dd52a01a2 [FIX] sale_coupon: Do not validate generated coupons on SO cancellation 2017-01-30 14:37:32 +01:00
Yannick Tivisse 9a9b2ba89a [FIX] sale_coupon: Fix 'Expected singleton' traceback 2017-01-30 14:37:32 +01:00
Yannick Tivisse 7d277ff950 [FIX] sale_coupon: Remove promo code on automatically applied programs 2017-01-30 14:37:32 +01:00