Commit Graph

213 Commits

Author SHA1 Message Date
Goffin Simon 7f8cd01431 [FIX] product: Product field
"product.product" model inherits from "product.template"  model then
all the float fields in "product.product" include those from "product.template".
A list is used to conserve the order of the fields.

Fixes #2067
opw:639766
2015-06-01 09:11:22 +02:00
Nicolas Martinelli 46eb9e2639 [FIX] product: cut date to keep format '%Y-%m-%d'
Ensures the date format is '%Y-%m-%d', since it is the format of
pricelist.version_id.date_start/date_end.

opw-640436
2015-05-29 13:58:53 +02:00
Martin Trigaux 9e1100ae2f [FIX] product: pricelist specific to a product
Double list comprehension is a nice try but does not work in python.
prod_ids was a list containing only the first variant, so getting the
product-specific pricelists only for the first variant of the first template.
Fixes #2900
2015-04-23 10:38:48 +02:00
Martin Trigaux d84b5d35ac [FIX] product: pricelist on product to apply on template
If a product as only one variant, using the product.product or the
product.template in the pricelist configuration should have the same effect.
This is particulary important for the ecommerce where template without variants
do not show the product. Having a pricelist for that product had no effect on
the price used in the e-commerce.

Fixes #2900, opw 615153
2015-04-22 16:27:05 +02:00
Antony Lesuisse f090652c99 [FIX] product: allow active pricelist version copy
Always set active false when copy is used to prevent the overlapping
version constraint.

Closes #5822
2015-03-24 23:11:25 +01:00
Leonardo Donelli 017f346dd3 [FIX] product: keep partner to base pricelist
When a rule is based on another pricelist, the partner was not passed to the
base pricelist.
2015-03-04 14:33:06 +01:00
Olivier Dony da12f2b809 [FIX] product: pricelist: multiple corrections in UoM-related conversions
Pricelist computations need to consider 2 different Units
of Measure:
 - The default product UoM (product.uom_id), used as reference
   for the various quantities and amounts specified in each
   pricelist rules.
 - The `context UoM` is the UoM in which the result is requested,
   that is the list price UoM.

For example the 'price_min_margin' amount is meant for the unit
price of 1 x default UoM. When the context UoM is not the default
product UoM, it can be any UoM of the same UoM Category, and the
various quantities and amounts specified on the rule need to
be adapted accordingly:
  - min_quantity (expressed in terms of the default UoM)
  - price_surcharge (specified for 1 x default UoM)
  - price_min_margin (specified for 1 x default UoM)
  - price_max_margin (specified for 1 x default UoM)

The UoM corrections were not done consistently and resulted in
wrong prices when computing the price using a non-default UoM.
The cases were a conversion was needed or not were not properly
identified within the _price_rule_get_multi().

After this commit, the various code branches in _price_rule_get_multi
always ensures that:
 - price requested for: `qty` of `qty_uom_id`
 - `qty_in_product_uom` is the requested `qty` converted to default UoM
 - current (intermediary) price: `price` for  `price_uom_id`

Therefore `price` and `price_uom_id` are always in sync, and `price_uom_id`
can always be compared with `qty_uom_id' in order to know whether
a conversion is still needed.

This patch also corrects and extends the regression tests
introduced at revision 79ebe10.
2014-12-09 17:30:47 +01:00
sve-openerp b747b3d30b [IMP] product: usability improvement in pricelist
Explicitly specifiy that quantities are in product uom
2014-11-28 15:50:57 +01:00
David Monjoie 0c74b9d027 [FIX] product: pricelist shouldn't convert uom when not needed or incompatible uom types
Otherwise the Search More view will crash for example for sale order line because it will fetch the price of all products and then try to convert uoms for pricelist rule application without checking uom compatibility
2014-11-07 09:08:53 +01:00
David Monjoie 3629bfe64f [FIX] product: pricelists based on the supplier prices now return first supplier price if partner not in suppliers instead of returning 0
Without this, sale pricelists cannot be based on supplier prices as the partner is never a supplier so the price would be 0
Note: behavior change ok with fp
2014-11-05 12:22:36 +01:00
David Monjoie fd20241b0d [FIX] product: pricelist now consider the quantity in product uom qty for rule application purposes 2014-11-03 09:09:52 +01:00
Christophe Simonis 8e637bac92 [MERGE] forward port of branch saas-3 up to 21b1203 2014-10-29 19:33:02 +01:00
Martin Trigaux 9f5e989d5d Forward port of branch 7.0 up to 42bf0a5 2014-10-27 11:21:41 +01:00
Martin Trigaux 79ebe1060d [FIX] product: pricelist, uom and price_surcharge
The price_surcharge attribute must be computed based on the reference unit of measure (divided by the factor).
This is to make sure than 12 units and 1 dozen have the same price after pricelist computation (opw 599727).

Added test checking the correctness of pricelist computation based on unit of measures.
2014-10-24 17:21:42 +02:00
Denis Ledoux 342f7492c7 [FIX] product: price_rule_get_multi returns a dict with a dict with tuples 2014-10-15 18:52:38 +02:00
David Monjoie 2cde5596b9 [FIX] product_visible_discount: fix display of unit price according to rule base price like in 7.0 as requested by gab 2014-10-15 15:46:28 +02:00
rsi-odoo 6202918754 [IMP] product : Improve tooltip of pricelist on min_quantity field. 2014-09-09 14:16:38 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Fabien Pinckaers 5cc81dd64f Fixes 2014-07-02 18:18:29 +02:00
Jaydeep Barot 026e38b48f [REM] Unnecessary `size` parameters on char fields 2014-06-25 17:13:43 +02:00
Christophe Matthieu 43977deb71 [IMP] product: refactoring of product variant. The main view became the view of product template and the product product (or product variant) are created with the variant values combinaison. Bom is splitted into bom and bom line and can use the variant combinaison. 2014-05-27 09:42:52 +02:00
Denis Ledoux d8d312768c [FIX] product: overwritten name_search of product.pricelist ignored lang translations. It worked prior to saas-3 because the pricelist filter in the searchview used a selection widget, which did not care about translations
bzr revid: dle@openerp.com-20140317120126-qx4wrkqfdu3nr3sp
2014-03-17 13:01:26 +01:00
Denis Ledoux 74af3ac0fe [MERGE] Forward-port of latest saas-2 bugfixes, up to rev. 9144 revid:dle@openerp.com-20140310133913-465x5t3n1bo7fu98
bzr revid: dle@openerp.com-20140310143600-kz7qjfe4p63s0a34
2014-03-10 15:36:00 +01:00
Denis Ledoux c2ba11e72e [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9885 revid:dle@openerp.com-20140310114026-r0ijm0m36su19wn7
bzr revid: dle@openerp.com-20140310122101-gicombyc5ii0yz6a
2014-03-10 13:21:01 +01:00
Olivier Dony c43c308c33 [FIX] product: typo in previous commit
"The only man who makes no mistakes is the man who never does anything. ~T.R." ;-)

bzr revid: odo@openerp.com-20140306190906-k8wjr9urekpoy7ch
2014-03-06 20:09:06 +01:00
Martin Trigaux dc46ffd589 [FIX] use float rounding for pricelist instead of ceiling
bzr revid: mat@openerp.com-20140306162953-iu7k53i5zsllokdp
2014-03-06 17:29:53 +01:00
Martin Trigaux 1967b6ce19 [FIX] product: when converting unit of mesures, round above instead of mathematical rounding
bzr revid: mat@openerp.com-20140305171456-goo7on3ncfihu0wu
2014-03-05 18:14:56 +01:00
Denis Ledoux b38245d6cb [FIX] product: price_get_multi raise if there is no active pricelist version (same behavior than before the pricelist computation factoring)
bzr revid: dle@openerp.com-20140305110314-pgiotwksjmdt63zm
2014-03-05 12:03:14 +01:00
Denis Ledoux 65257c48b5 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9835 revid:launchpad_translations_on_behalf_of_openerp-20140213064742-xiotlx8wzfhexnhc
bzr revid: dle@openerp.com-20140210160759-oybxhdwgv2q4ma5a
bzr revid: odo@openerp.com-20140212122042-3m2tysmr31mtecnc
bzr revid: dle@openerp.com-20140212143044-0c94q4evxl4ltwr0
bzr revid: dle@openerp.com-20140213115951-h7c2o65lgg26aosv
2014-02-13 12:59:51 +01:00
Olivier Dony 652c574866 [FIX] product.pricelist: leftover undefined variable from pricelist refactoring at revid:fp@tinyerp.com-20131206221809-x1muf0wonl4ated0
bzr revid: odo@openerp.com-20140212175224-wd9etr8xyrg6l0oz
2014-02-12 18:52:24 +01:00
Olivier Dony bbd813e76e [MERGE] Forward-port of latest saas-2 (incl. 7.0) bugfixes, up to rev. 9127 odo@openerp.com-20140212122042-3m2tysmr31mtecnc
bzr revid: odo@openerp.com-20140212175141-i9yz8zlseglrk8sb
2014-02-12 18:51:41 +01:00
Martin Trigaux ebdb230699 [FIX] pricelist: correctly take into account uom when computing pricelists based on supplier price on product form (opw 595881)
The previous behaviour used the uom of product while it could be a different one selected (by default the purchase unit of measure for purchase orders).
This was an issue especially when having different uom with supplier info lines setting degressive prices. The price should be computed based on selected uom and not the product uom.

bzr revid: mat@openerp.com-20140211145703-9uut4hw9aqh7326o
2014-02-11 15:57:03 +01:00
Christophe Matthieu 6652856445 [FIX] website_sale: link; product: clean code and use product.template for supplierinfo
bzr revid: chm@openerp.com-20131209163254-k9dwxw48rcgz1hbs
2013-12-09 17:32:54 +01:00
Fabien Pinckaers 66e85ee1e0 [IMP] Product visible discount: discount is expressed based in Public Price
bzr revid: fp@tinyerp.com-20131209142203-20l555dfdyvb60xe
2013-12-09 15:22:03 +01:00
Fabien Pinckaers 20bbabc82b [IMP] Huge speed improvement in price computation on products: 162 to 39 queries to render /shop with 28 products. O(n)->O(1)
bzr revid: fp@tinyerp.com-20131206221809-x1muf0wonl4ated0
2013-12-06 23:18:09 +01:00
Denis Ledoux db84e912bd [MERGE] Forward-port of latest saas-1 bugfixes, up to rev. 8781 rev-id: dle@openerp.com-20130923165651-0jt823r5wy37enw6
bzr revid: dle@openerp.com-20130923171310-mav1riq3d2rebmv2
2013-09-23 19:13:10 +02:00
Denis Ledoux 274cf1e293 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9475 rev-id: dle@openerp.com-20130923162428-g0s3o9tid09ogfv3
bzr revid: dle@openerp.com-20130923165651-0jt823r5wy37enw6
2013-09-23 18:56:51 +02:00
Martin Trigaux 2a6419ea55 [FIX] product: avoid getting date=False in pricelist if wrong value in context, courtesy of Alexis de Lattre
bzr revid: mat@openerp.com-20130920144529-800nviktzebexwtt
2013-09-20 16:45:29 +02:00
Denis Ledoux 546a191f0a [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9459 rev-id: fva@openerp.com-20130918153347-fy4nuvbm82ngfb8x
bzr revid: mat@openerp.com-20130826135110-f9q4p65ds2aholcw
bzr revid: dle@openerp.com-20130828141129-ecxl2vlpb8vw0o9f
bzr revid: dle@openerp.com-20130828162659-n8a0ku9o3h01qaov
bzr revid: dle@openerp.com-20130830094205-q3itwd7x0246d9n6
bzr revid: dle@openerp.com-20130830133604-mfnfbscn5wdk4vi4
bzr revid: dle@openerp.com-20130902131244-v9uh0s8rg4889i7j
bzr revid: mat@openerp.com-20130903134105-68ziuaccreu6rs61
bzr revid: chs@openerp.com-20130906171851-jtfsf4au1k30wwlr
bzr revid: dle@openerp.com-20130909103120-k5oefxgebhyslac3
bzr revid: dle@openerp.com-20130909170047-pbzw4ernvcpivbhh
bzr revid: chs@openerp.com-20130910122113-171osvcukxffxcry
bzr revid: tde@openerp.com-20130912121059-k840pi4rwdzpez8g
bzr revid: dle@openerp.com-20130913085251-p906ci2divy82jur
bzr revid: tde@openerp.com-20130913092546-kzshg1a7sls566l8
bzr revid: mat@openerp.com-20130917122102-drf8fj9lrjj0fvju
bzr revid: mat@openerp.com-20130917161614-w8u2c1ayeb5kxm30
bzr revid: dle@openerp.com-20130918161305-7ep1642nxzyy3vhd
2013-09-18 18:13:05 +02:00
Christophe Simonis 3fa90321e1 [MERGE] forward port of branch saas-1 up to revid 8772 chs@openerp.com-20130910122113-171osvcukxffxcry
bzr revid: chs@openerp.com-20130910124803-wxkb8gkz1tub5qjf
2013-09-10 14:48:03 +02:00
Olivier Dony 6de0051315 [FIX] product: support string values for context `pricelist` key when computing prices
As of v7 search views will replace the value of any `self`
      literal in a @context attribute by the name of the
      record, whereas it used to be its ID.
      This means that the `Pricelist` filter used to display
      the product list with a specific pricelist would not
      work anymore.
      
      The fix requires a rather hackish name_search()
      override for product.pricelist because the display
      name of pricelists includes their currency, while
      that could be a valid name for a pricelist too.
      
      To avoid side-effects the name_search() override
      only picks up the special case used by the
      product.product._product_price() method when it
      tries to apply the context pricelist, that is
      with operator explicitly set to `=` and no extra
      domain `args`.

lp bug: https://launchpad.net/bugs/1178835 fixed

bzr revid: odo@openerp.com-20130906155047-7dmozy2jpe1ca1p2
2013-09-06 17:50:47 +02:00
Amit Bhavsar (Open ERP) b47a121f44 [Imp] Improve code for pricelists.
bzr revid: amb@tinyerp.com-20130712073654-1fowt1xojgx0pjdc
2013-07-12 13:06:54 +05:30
Amit Bhavsar (Open ERP) 1941b9c244 [Product Pricelist] Default value for based on price
bzr revid: amb@tinyerp.com-20130529135734-62rvtw3yocxvsmq1
2013-05-29 19:27:34 +05:30
Amit Bhavsar (Open ERP) 7c6f6e89b5 [MERGE] merge with latest trunk
bzr revid: vja@tinyerp.com-20130429093627-cpxq3uybwsssrqr5
bzr revid: vja@tinyerp.com-20130430115558-p1aw1zszcur21fj5
bzr revid: vja@tinyerp.com-20130517054712-9o7u266nfm8atgjv
bzr revid: amb@tinyerp.com-20130529122717-lpk7tn30qek2i5yt
2013-05-29 17:57:17 +05:30
Alexis de Lattre 8a36d55603 [FIX] product: if 'date' is passed as False in context of price_get_multi(), it should be set to current date and not False (Maintenance Case: 592247)
lp bug: https://launchpad.net/bugs/1175983 fixed

bzr revid: rgo@tinyerp.com-20130517070210-0dno7syscybo0h7j
2013-05-17 12:32:10 +05:30
Alexis de Lattre fd8add387e [FIX] product: if 'date' is passed as False in context of price_get_multi(), it should be set to current date and not False (Maintenance Case: 592247)
lp bug: https://launchpad.net/bugs/1175983 fixed

bzr revid: rgo@tinyerp.com-20130517065744-il8sfm61rlcu9h2f
2013-05-17 12:27:44 +05:30
Alexis de Lattre 1c91bb4b77 [FIX] product: if 'date' is passed as False in context of price_get_multi(), it should be set to current date and not False (Maintenance Case: 592247)
lp bug: https://launchpad.net/bugs/1175983 fixed

bzr revid: rgo@tinyerp.com-20130517063145-va41paqq3pw38x51
2013-05-17 12:01:45 +05:30
Quentin (OpenERP) 33f27b362b [MERGE] forward port of addons v7 up to revision 9045
bzr revid: qdp-launchpad@openerp.com-20130422153449-c62emljfa4a49758
2013-04-22 17:34:49 +02:00
Quentin (OpenERP) 27c3b6cc33 [MERGE][FIX] product: context propagating in res_currency.compute(). Courtesy of Yannick Vaucher @ Camptocamp. Thanks dude
bzr revid: qdp-launchpad@openerp.com-20130418141013-vukxknub32p7djqd
2013-04-18 16:10:13 +02:00
Vishmita Jadeja (openerp) fe128d7498 [Merge]Merge lp:openobject-addons
bzr revid: vja@tinyerp.com-20130418090337-51vfkhfl3lzg7mpf
2013-04-18 14:33:37 +05:30