diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index cab6b226479..b66d15cc165 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -123,6 +123,8 @@ class AccountFiscalPosition(models.Model): if not country_id: return False base_domain = [('auto_apply', '=', True), ('vat_required', '=', vat_required)] + if self.env.context.get('force_company'): + base_domain.append(('company_id', '=', self.env.context.get('force_company'))) null_state_dom = state_domain = [('state_ids', '=', False)] null_zip_dom = zip_domain = [('zip_from', '=', 0), ('zip_to', '=', 0)] null_country_dom = [('country_id', '=', False), ('country_group_id', '=', False)] diff --git a/addons/account/views/account_journal_dashboard_view.xml b/addons/account/views/account_journal_dashboard_view.xml index 3b6a77857e2..468a5b2c759 100644 --- a/addons/account/views/account_journal_dashboard_view.xml +++ b/addons/account/views/account_journal_dashboard_view.xml @@ -234,7 +234,7 @@
- Balance in Odoo + Balance in GL
diff --git a/addons/base_import/static/csv/database_import_test.sql b/addons/base_import/static/csv/database_import_test.sql index 1f79179145e..13a735d106d 100644 --- a/addons/base_import/static/csv/database_import_test.sql +++ b/addons/base_import/static/csv/database_import_test.sql @@ -2,12 +2,30 @@ -- PostgreSQL database dump -- +-- Dumped from database version 9.5.2 +-- Dumped by pg_dump version 9.5.2 + SET statement_timeout = 0; +SET lock_timeout = 0; SET client_encoding = 'UTF8'; -SET standard_conforming_strings = off; +SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; -SET escape_string_warning = off; +SET row_security = off; + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + SET search_path = public, pg_catalog; @@ -16,7 +34,7 @@ SET default_tablespace = ''; SET default_with_oids = false; -- --- Name: companies; Type: TABLE; Schema: public; Owner: fp; Tablespace: +-- Name: companies; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE companies ( @@ -25,38 +43,27 @@ CREATE TABLE companies ( ); -ALTER TABLE public.companies OWNER TO fp; - -- --- Name: companies_id_seq; Type: SEQUENCE; Schema: public; Owner: fp +-- Name: companies_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE companies_id_seq START WITH 1 INCREMENT BY 1 - NO MAXVALUE NO MINVALUE + NO MAXVALUE CACHE 1; -ALTER TABLE public.companies_id_seq OWNER TO fp; - -- --- Name: companies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: fp +-- Name: companies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE companies_id_seq OWNED BY companies.id; -- --- Name: companies_id_seq; Type: SEQUENCE SET; Schema: public; Owner: fp --- - -SELECT pg_catalog.setval('companies_id_seq', 3, true); - - --- --- Name: persons; Type: TABLE; Schema: public; Owner: fp; Tablespace: +-- Name: persons; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE persons ( @@ -66,52 +73,41 @@ CREATE TABLE persons ( ); -ALTER TABLE public.persons OWNER TO fp; - -- --- Name: persons_id_seq; Type: SEQUENCE; Schema: public; Owner: fp +-- Name: persons_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE persons_id_seq START WITH 1 INCREMENT BY 1 - NO MAXVALUE NO MINVALUE + NO MAXVALUE CACHE 1; -ALTER TABLE public.persons_id_seq OWNER TO fp; - -- --- Name: persons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: fp +-- Name: persons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE persons_id_seq OWNED BY persons.id; -- --- Name: persons_id_seq; Type: SEQUENCE SET; Schema: public; Owner: fp --- - -SELECT pg_catalog.setval('persons_id_seq', 4, true); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: fp +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY companies ALTER COLUMN id SET DEFAULT nextval('companies_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: fp +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY persons ALTER COLUMN id SET DEFAULT nextval('persons_id_seq'::regclass); -- --- Data for Name: companies; Type: TABLE DATA; Schema: public; Owner: fp +-- Data for Name: companies; Type: TABLE DATA; Schema: public; Owner: - -- COPY companies (id, company_name) FROM stdin; @@ -122,19 +118,33 @@ COPY companies (id, company_name) FROM stdin; -- --- Data for Name: persons; Type: TABLE DATA; Schema: public; Owner: fp +-- Name: companies_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('companies_id_seq', 3, true); + + +-- +-- Data for Name: persons; Type: TABLE DATA; Schema: public; Owner: - -- COPY persons (id, company_id, person_name) FROM stdin; 1 1 Fabien 2 1 Laurence 3 2 Eric -4 3 Ramsy +4 3 Ramzy \. -- --- Name: companies_pkey; Type: CONSTRAINT; Schema: public; Owner: fp; Tablespace: +-- Name: persons_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('persons_id_seq', 4, true); + + +-- +-- Name: companies_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY companies @@ -142,13 +152,23 @@ ALTER TABLE ONLY companies -- --- Name: persons_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: fp +-- Name: persons_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY persons ADD CONSTRAINT persons_company_id_fkey FOREIGN KEY (company_id) REFERENCES companies(id); +-- +-- Name: public; Type: ACL; Schema: -; Owner: - +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + -- -- PostgreSQL database dump complete -- diff --git a/addons/base_import/static/csv/o2m_purchase_order_lines.csv b/addons/base_import/static/csv/o2m_purchase_order_lines.csv index 4778b99cb81..744f13f8fab 100644 --- a/addons/base_import/static/csv/o2m_purchase_order_lines.csv +++ b/addons/base_import/static/csv/o2m_purchase_order_lines.csv @@ -1,10 +1,6 @@ -Order Date,Order Reference,Supplier,Destination,Pricelist,Order Lines / Product,Order Lines / Quantity -2012-12-15,PO00008,ASUSTeK,Stock,Default Purchase Pricelist,ADPT,20 -,,,,,CARD,30 -,,,,,C-Case,40 -2012-12-15,PO00009,Axelor,Stock,Default Purchase Pricelist,CD,5 -,,,,,CPUa8,15 -2012-12-15,PO000010,China Export,Stock,Default Purchase Pricelist,HDD SH-1,10 -,,,,,HDD SH-2,20 -,,,,,LAP-CUS,35 -,,,,,LAP-E5,40 +"Order Date","Order Reference",Vendor,"Order Lines / Product","Order Lines / Description","Order Lines / Quantity","Order Lines / Product Unit of Measure","Order Lines / Unit Price","Order Lines / Scheduled Date" +2016-12-15,PO00008,ASUSTeK,ADPT,ADPT,20.0,"Unit(s)",13.0,2016-12-15 +,,,CARD,CARD,30,"Unit(s)",876.0,2016-12-15 +,,,C-Case,C-Case,40,"Unit(s)",20.0,2016-12-15 +2016-12-15,PO00009,Camptocamp,CD,CD,5,"Unit(s)",18.4,2016-12-15 +,,,CPUa8,CPUa8,15,"Unit(s)",1910.0,2016-12-15 diff --git a/addons/base_import/static/csv/purchase.order_functional_error_line_cant_adpat.csv b/addons/base_import/static/csv/purchase.order_functional_error_line_cant_adpat.csv index 3b428763431..35c07c08257 100644 --- a/addons/base_import/static/csv/purchase.order_functional_error_line_cant_adpat.csv +++ b/addons/base_import/static/csv/purchase.order_functional_error_line_cant_adpat.csv @@ -1,6 +1,3 @@ -"Order Reference","Supplier","Destination","Pricelist","Order Lines / Product","Order Lines / Quantity" -"PO000020","ASUSTeK","Stock","Default Purchase Pricelist","ADPT",20 -,,,,"CARD",30 -,,,,"C-Case",40 -"PO000021","Axelor","Stock","Default Purchase Pricelist","CD",5 -,,,,"CPUa8",15 +"Order Reference","Vendor" +"PO000020","ASUSTeK" +"PO000021","Camptocamp" diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 091eddd18a6..72cdb2b0348 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -1372,6 +1372,30 @@ class calendar_event(osv.Model): ('user_id', '=', uid), ] + @api.multi + def _get_message_unread(self): + id_map = {x: calendar_id2real_id(x) for x in self.ids} + real = self.browse(set(id_map.values())) + super(calendar_event, real)._get_message_unread() + for event in self: + if event.id == id_map[event.id]: + continue + rec = self.browse(id_map[event.id]) + event.message_unread_counter = rec.message_unread_counter + event.message_unread = rec.message_unread + + @api.multi + def _get_message_needaction(self): + id_map = {x: calendar_id2real_id(x) for x in self.ids} + real = self.browse(set(id_map.values())) + super(calendar_event, real)._get_message_needaction() + for event in self: + if event.id == id_map[event.id]: + continue + rec = self.browse(id_map[event.id]) + event.message_needaction_counter = rec.message_needaction_counter + event.message_needaction = rec.message_needaction + @api.cr_uid_ids_context def message_post(self, cr, uid, thread_id, context=None, **kwargs): if isinstance(thread_id, basestring): diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index a154fe1c55b..44c2480416b 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -348,14 +348,17 @@ class PurchaseOrder(models.Model): # this product. We limit to 10 the number of suppliers for a product to avoid the mess that # could be caused for some generic products ("Miscellaneous"). for line in self.order_line: - if self.partner_id not in line.product_id.seller_ids.mapped('name') and len(line.product_id.seller_ids) <= 10: + # Do not add a contact as a supplier + partner = self.partner_id if not self.partner_id.parent_id else self.partner_id.parent_id + if partner not in line.product_id.seller_ids.mapped('name') and len(line.product_id.seller_ids) <= 10: + currency = partner.property_purchase_currency_id or self.env.user.company_id.currency_id supplierinfo = { - 'name': self.partner_id.id, + 'name': partner.id, 'sequence': max(line.product_id.seller_ids.mapped('sequence')) + 1 if line.product_id.seller_ids else 1, 'product_uom': line.product_uom.id, 'min_qty': 0.0, - 'price': line.price_unit, - 'currency_id': self.partner_id.currency_id.id, + 'price': self.currency_id.compute(line.price_unit, currency), + 'currency_id': currency.id, 'delay': 0, } vals = { diff --git a/addons/web/static/src/js/framework/mixins.js b/addons/web/static/src/js/framework/mixins.js index 40bdaeb51b4..05d4105e466 100644 --- a/addons/web/static/src/js/framework/mixins.js +++ b/addons/web/static/src/js/framework/mixins.js @@ -336,9 +336,8 @@ var PropertiesMixin = _.extend({}, EventDispatcherMixin, { // remove this, or move it elsewhere. Also, learn OO programming. if (key === 'value' && self.field && self.field.type === 'float' && tmp && val){ var digits = self.field.digits; - if (digits !== 0){ - digits = digits ? digits[1] : 2; - if (utils.float_is_zero(tmp - val, digits)) { + if (_.isArray(digits)) { + if (utils.float_is_zero(tmp - val, digits[1])) { return; } } @@ -366,4 +365,3 @@ return { }; }); - diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js index 87350573de1..cb6daf093ce 100644 --- a/addons/web/static/src/js/views/list_view.js +++ b/addons/web/static/src/js/views/list_view.js @@ -1156,7 +1156,7 @@ ListView.List = Class.extend( /** @lends instance.web.ListView.List# */{ record.set(column.id, names[0]); }); } - } else if (column.type === 'many2many' || column.type === 'one2many') { + } else if (column.type === 'many2many') { value = record.get(column.id); // non-resolved (string) m2m values are arrays if (value instanceof Array && !_.isEmpty(value) diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js index 62b1392cce9..438e5f28000 100644 --- a/addons/web_calendar/static/src/js/web_calendar.js +++ b/addons/web_calendar/static/src/js/web_calendar.js @@ -86,6 +86,9 @@ var CalendarView = View.extend({ this.title = (this.options.action)? this.options.action.name : ''; this.shown = $.Deferred(); + self.current_start = null; + self.current_end = null; + self.previous_ids = []; }, set_default_options: function(options) { @@ -730,11 +733,25 @@ var CalendarView = View.extend({ ); } } + + // read_slice is launched uncoditionally, when quickly + // changing the range in the calender view, all of + // these RPC calls will race each other. Because of + // this we keep track of the current range of the + // calendar view. + self.current_start = start; + self.current_end = end; self.dataset.read_slice(_.keys(self.fields), { offset: 0, domain: event_domain, context: context, }).done(function(events) { + // undo the read_slice if it the range has changed since it launched + if (self.current_start.getTime() != start.getTime() || self.current_end.getTime() != end.getTime()) { + self.dataset.ids = self.previous_ids; + return; + } + self.previous_ids = self.dataset.ids.slice(); if (self.dataset.index === null) { if (events.length) { self.dataset.index = 0; diff --git a/openerp/modules/loading.py b/openerp/modules/loading.py index 40cd1bbfd59..421ca5cb6b6 100644 --- a/openerp/modules/loading.py +++ b/openerp/modules/loading.py @@ -416,7 +416,10 @@ def load_modules(db, force_demo=False, status=None, update_module=False): t0 = time.time() t0_sql = openerp.sql_db.sql_counter if openerp.tools.config['test_enable']: - cr.execute("SELECT name FROM ir_module_module WHERE state='installed'") + if update_module: + cr.execute("SELECT name FROM ir_module_module WHERE state='installed' and name = ANY(%s)", (processed_modules,)) + else: + cr.execute("SELECT name FROM ir_module_module WHERE state='installed'") for module_name in cr.fetchall(): report.record_result(openerp.modules.module.run_unit_tests(module_name[0], cr.dbname, position=runs_post_install)) _logger.log(25, "All post-tested in %.2fs, %s queries", time.time() - t0, openerp.sql_db.sql_counter - t0_sql)