Tryton - Issues

 

Issue3805

Title Remove accounting from Products
Priority feature Status resolved
Superseder Nosy List Timitos, ced, ohuisman, pokoli, reviewbot, roundup-bot, semarie, udono
Type feature request Components account_product
Assigned To ced Keywords review
Reviews 45111002
View: 45111002

Created on 2014-03-29.00:28:30 by udono, last changed by ced.

Messages
msg41587 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-06-22.10:26:03
msg41585 is fixed by issue7526

PS: It is better to open new issue if it is not directly related to the feature.
msg41585 (view) Author: [hidden] (Timitos) Date: 2018-06-22.10:19:00
I get an error on upgrading an existing database:

4583 139638538114816 [2018-06-22 08:06:19,423] ERROR trytond.ir.model could not delete model: product.template-supplier-account.tax
Traceback (most recent call last):
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/ir/model.py", line 123, in clean
    cls.delete([cls(id_)])
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/model/modelsql.py", line 148, in wrapper
    return func(cls, *args, **kwargs)
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/model/modelsql.py", line 1162, in delete
    error_args=error_args)
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/error.py", line 74, in raise_user_error
    raise UserError(error)
UserError: Could not delete the records because they are used on field "Model" of "Rule group". - 

Traceback (most recent call last):
  File "/home/kpreisler/fab_venv/workon/trytondev/bin/trytond-admin-server.py", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/bin/trytond-admin", line 21, in <module>
    admin.run(options)
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/admin.py", line 54, in run
    activatedeps=options.activatedeps)
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/pool.py", line 162, in init
    lang=lang, activatedeps=activatedeps)
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/modules/__init__.py", line 406, in load_modules
    _load_modules(update)
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/modules/__init__.py", line 376, in _load_modules
    load_module_graph(graph, pool, update, lang)
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/modules/__init__.py", line 240, in load_module_graph
    ModelField.clean()
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/ir/model.py", line 296, in clean
    Model = pool.get(model)
  File "/home/kpreisler/fab_venv/projects/trytondev/trytond/trytond/pool.py", line 179, in get
    return self._pool[self.database_name][type][name]
KeyError: u'product.template-customer-account.tax'
New changeset bb642d8ed6b2 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/stock_supply/rev/bb642d8ed6b2
New changeset 2c78d8f6540f by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/stock_package_shipping_ups/rev/2c78d8f6540f
New changeset 9bf2c9307784 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/stock_package_shipping_dpd/rev/9bf2c9307784
New changeset 57aee1e3c5ce by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/stock_consignment/rev/57aee1e3c5ce
New changeset d9b7a97ee6af by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_supply_drop_shipment/rev/d9b7a97ee6af
New changeset bd0d4a377884 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_supply/rev/bd0d4a377884
New changeset f57c8ad9ac7c by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_subscription/rev/f57c8ad9ac7c
New changeset 74533736d315 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_stock_quantity/rev/74533736d315
New changeset f52abb364dba by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_shipment_tolerance/rev/f52abb364dba
New changeset 582b16326d5a by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_shipment_grouping/rev/582b16326d5a
New changeset 94a5a8d78495 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_shipment_cost/rev/94a5a8d78495
New changeset 0e27cde1ae6a by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_promotion_coupon/rev/0e27cde1ae6a
New changeset 97a01daf4be6 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_promotion/rev/97a01daf4be6
New changeset 9840bf44a15c by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_price_list/rev/9840bf44a15c
New changeset 2f101f1767fc by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_payment/rev/2f101f1767fc
New changeset 9300f4f37044 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_opportunity/rev/9300f4f37044
New changeset 38008477359b by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_invoice_grouping/rev/38008477359b
New changeset 92e2a384d936 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_extra/rev/92e2a384d936
New changeset 13a547154a88 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_credit_limit/rev/13a547154a88
New changeset a46a867d8d0d by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_complaint/rev/a46a867d8d0d
New changeset 5de5db8762e2 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale_advance_payment/rev/5de5db8762e2
New changeset de6837124423 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/sale/rev/de6837124423
New changeset 9d3a6d2dfd4f by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/purchase_shipment_cost/rev/9d3a6d2dfd4f
New changeset 1742db51365f by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/purchase_requisition/rev/1742db51365f
New changeset 5d2d50181b62 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/purchase_request_quotation/rev/5d2d50181b62
New changeset fa7ba0cf2ed3 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/purchase_request/rev/fa7ba0cf2ed3
New changeset 65c1336063ad by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/purchase_invoice_line_standalone/rev/65c1336063ad
New changeset a346358b0afd by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/purchase/rev/a346358b0afd
New changeset 0b8f1eb79fda by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/project_invoice/rev/0b8f1eb79fda
New changeset cd6430019dec by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/commission_waiting/rev/cd6430019dec
New changeset 0e9536413ea5 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/commission/rev/0e9536413ea5
New changeset 2c1ea3d93c37 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/carrier_weight/rev/2c1ea3d93c37
New changeset dc045fae1e42 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/carrier_percentage/rev/dc045fae1e42
New changeset 46b781993a95 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/analytic_sale/rev/46b781993a95
New changeset 45472d634920 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/analytic_purchase/rev/45472d634920
New changeset 5734121ceb33 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/analytic_invoice/rev/5734121ceb33
New changeset 61bcbee85e71 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/account_stock_landed_cost_weight/rev/61bcbee85e71
New changeset c86a3c857a87 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/account_stock_landed_cost/rev/c86a3c857a87
New changeset 6faecaae4628 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/account_stock_continental/rev/6faecaae4628
New changeset 747218c034ac by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/account_stock_anglo_saxon/rev/747218c034ac
New changeset eccc39fab316 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/account_product/rev/eccc39fab316
New changeset 67f528d5201c by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/account_invoice/rev/67f528d5201c
New changeset e2f8f278aa02 by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/account_dunning_fee/rev/e2f8f278aa02
New changeset 5a08a806b56b by Cédric Krier in branch 'default':
Remove accounts from products
https://hg.tryton.org/modules/account_asset/rev/5a08a806b56b
review45111002 updated at https://codereview.tryton.org/45111002/#ps100001
review45111002 updated at https://codereview.tryton.org/45111002/#ps80001
review45111002 updated at https://codereview.tryton.org/45111002/#ps60001
review45111002 updated at https://codereview.tryton.org/45111002/#ps40001
review45111002 updated at https://codereview.tryton.org/45111002/#ps20001
msg40706 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-05-16.21:51:43
I decided to not make any migration because the only possible migration would be to create a category for each product and this is not a good way. Instead I will put on the migration topic that prior to upgrade, the user must setup an accounting category for all products that were using accounts on product.
review45111002 updated at https://codereview.tryton.org/45111002/#ps1
msg40704 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-05-16.21:14:24
Here is review45111002
msg35603 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-09-08.19:57:27
Indeed I'm wondering if we should not remove the accounting fields from the product completely and use only accounting category.
The idea is that accounting properties should be set by accountant but other properties of a product are set by the product manager. So moving the accounting to only the category will allow to have an access to accounting category only.
The main difficulty is the migration of installations that are using definition on product. A possibility could be to create an accounting category for each product that has accounting properties.
msg16499 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2014-04-14.14:44:29
On 14 Apr 14:28, Udo Spallek wrote:
> Just trying to understand, do you think the actual implementation
> has a clean user experience and there is no issue in msg16492?

It is the best we can do.
msg16498 (view) Author: [hidden] (udono) Date: 2014-04-14.14:28:55
Just trying to understand, do you think the actual implementation
has a clean user experience and there is no issue in msg16492?
msg16497 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2014-04-14.14:20:06
On 14 Apr 14:13, Udo Spallek wrote:
> Proposal
> --------
> Add product configuration to set the defaults for:
> 
>    * for each product and product category:
> 
>      * accounts,
>      * taxes,
> 
>    * product:
> 
>      * Use Category's Account,
>      * Use Category's Taxes.
>   
>    * product category:
> 
>      * Use Parent's Accounts
>      * Use Parent's Taxes

Not possible because it doesn't work for roots.

> Make the account fields on product category required as long as
> "Use Parent's Accounts" is False.
> 
> What do you think?

Too much constraintful.
msg16496 (view) Author: [hidden] (udono) Date: 2014-04-14.14:19:20
Mon, 14 Apr 2014 12:38:44 +0200
Cédric Krier <issue_tracker@tryton.org>:
>Having such cross record integrity check is almost not possible to
>acheive nor to have a clean user experience.
>That's why such check is
>done when the property is used.
Yes, I am not sure about these in deep checks, either.
But for now the user experience is IMHO not clean, too.
The property as fall-back is a hidden feature, which can not be
controlled by non-admin users.

Proposal
--------
Add product configuration to set the defaults for:

   * for each product and product category:

     * accounts,
     * taxes,

   * product:

     * Use Category's Account,
     * Use Category's Taxes.

   * product category:

     * Use Parent's Accounts
     * Use Parent's Taxes

Make the account fields on product category required as long as
"Use Parent's Accounts" is False.

What do you think?
msg16495 (view) Author: [hidden] (udono) Date: 2014-04-14.14:13:20
Mon, 14 Apr 2014 12:38:44 +0200
Cédric Krier <issue_tracker@tryton.org>:
>Having such cross record integrity check is almost not possible to
>acheive nor to have a clean user experience.
>That's why such check is
>done when the property is used.
Yes, I am not sure about these in deep checks, either.
But for now the user experience is IMHO not clean, too.
The property as fall-back is a hidden feature, which can not be
controlled by non-admin users.

Proposal
--------
Add product configuration to set the defaults for:

   * for each product and product category:

     * accounts,
     * taxes,

   * product:

     * Use Category's Account,
     * Use Category's Taxes.
  
   * product category:

     * Use Parent's Accounts
     * Use Parent's Taxes

Make the account fields on product category required as long as
"Use Parent's Accounts" is False.

What do you think?
msg16493 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2014-04-14.12:38:44
Having such cross record integrity check is almost not possible to acheive nor to have a clean user experience.
That's why such check is done when the property is used.
msg16492 (view) Author: [hidden] (udono) Date: 2014-04-14.12:26:34
Scenario
--------
* Create a product category, save.
* Create a product

  * Check on product: Use Category's Account
  * Save Product

Expectation
-----------
I would expect one of the two behaviors:

1. Raise User Error: No accounts defined on product, product category or
   parent product category.
2. The product category has required fields for the accounts, if there is
   no parent category.

Issue
-----
The Product is saved, but should not, since accounts should be required
on products.

N.B. I think this issue is not release critical, since this behavior is
constant from version 1.0.
msg16343 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2014-03-29.01:39:48
1 - don't understand.
2 - no.
msg16341 (view) Author: [hidden] (udono) Date: 2014-03-29.00:28:29
Accounts on products are required. When check Use Category's Account, then the
accounts on category are no longer required.

1. Is it to hold the possibility for default accounts, or
   Why is it needed to choose a category when we do not want
   to set accounts directly?
2. Are the requirements missing on category accounts?

Thanks for clarification.
History
Date User Action Args
2018-06-22 10:26:03cedsetstatus: chatting -> resolved
messages: + msg41587
2018-06-22 10:19:00Timitossetstatus: resolved -> chatting
messages: + msg41585
2018-06-20 12:13:54roundup-botsetmessages: + msg41535
2018-06-20 12:13:49roundup-botsetmessages: + msg41534
2018-06-20 12:13:46roundup-botsetmessages: + msg41533
2018-06-20 12:13:38roundup-botsetmessages: + msg41532
2018-06-20 12:13:33roundup-botsetmessages: + msg41531
2018-06-20 12:13:29roundup-botsetmessages: + msg41530
2018-06-20 12:13:23roundup-botsetmessages: + msg41529
2018-06-20 12:13:13roundup-botsetmessages: + msg41528

Showing 10 items. Show all history (warning: this could be VERY long)