Merge lp:~openerp-dev/openobject-addons/trunk-remove-sale.shop-sgo into lp:openobject-addons

Proposed by Sanjay Gohel (Open ERP)
Status: Merged
Merged at revision: 8771
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-remove-sale.shop-sgo
Merge into: lp:openobject-addons
Diff against target: 1177 lines (+116/-283)
36 files modified
point_of_sale/point_of_sale.py (+17/-11)
point_of_sale/point_of_sale_view.xml (+13/-9)
point_of_sale/report/pos_order_report.py (+3/-3)
point_of_sale/report/pos_order_report_view.xml (+1/-1)
point_of_sale/report/pos_receipt.rml (+1/-1)
point_of_sale/security/ir.model.access.csv (+1/-1)
point_of_sale/static/src/js/models.js (+3/-3)
point_of_sale/wizard/pos_return.py (+3/-3)
portal_sale/security/ir.model.access.csv (+0/-1)
sale/report/sale_report.py (+0/-3)
sale/report/sale_report_view.xml (+0/-3)
sale/sale.py (+7/-34)
sale/sale_data.xml (+0/-14)
sale/sale_demo.xml (+0/-7)
sale/sale_unit_test.xml (+0/-1)
sale/sale_view.xml (+4/-58)
sale/security/ir.model.access.csv (+0/-4)
sale/security/sale_security.xml (+0/-7)
sale_analytic_plans/sale_analytic_plans.py (+0/-10)
sale_crm/test/sale_crm.yml (+0/-11)
sale_crm/wizard/crm_make_sale.py (+0/-7)
sale_crm/wizard/crm_make_sale_view.xml (+0/-1)
sale_margin/test/sale_margin.yml (+0/-1)
sale_mrp/test/sale_mrp.yml (+0/-1)
sale_stock/__openerp__.py (+0/-1)
sale_stock/report/sale_report.py (+3/-2)
sale_stock/report/sale_report_view.xml (+11/-0)
sale_stock/res_config.py (+0/-3)
sale_stock/res_config_view.xml (+0/-6)
sale_stock/sale_stock.py (+21/-11)
sale_stock/sale_stock_data.xml (+0/-11)
sale_stock/sale_stock_demo.xml (+17/-1)
sale_stock/sale_stock_view.xml (+9/-31)
sale_stock/test/picking_order_policy.yml (+2/-2)
stock/product.py (+0/-8)
stock_location/stock_location_demo_cpu1.xml (+0/-12)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-remove-sale.shop-sgo
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+168041@code.launchpad.net

This proposal supersedes a proposal from 2013-01-25.

Description of the change

Hello,

    Improved message string if any warehouse don't have current company.
Add warehouse group by in sales analysis.
and make warehouse field required true.

Thank You.
sanjay gohel

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'point_of_sale/point_of_sale.py'
2--- point_of_sale/point_of_sale.py 2013-06-14 09:19:24 +0000
3+++ point_of_sale/point_of_sale.py 2013-06-14 14:36:30 +0000
4@@ -51,7 +51,7 @@
5 'journal_ids' : fields.many2many('account.journal', 'pos_config_journal_rel',
6 'pos_config_id', 'journal_id', 'Available Payment Methods',
7 domain="[('journal_user', '=', True ), ('type', 'in', ['bank', 'cash'])]",),
8- 'shop_id' : fields.many2one('sale.shop', 'Shop',
9+ 'warehouse_id' : fields.many2one('stock.warehouse', 'Warehouse',
10 required=True),
11 'journal_id' : fields.many2one('account.journal', 'Sale Journal',
12 domain=[('type', '=', 'sale')],
13@@ -70,6 +70,7 @@
14 "to customize the reference numbers of your orders."),
15 'session_ids': fields.one2many('pos.session', 'config_id', 'Sessions'),
16 'group_by' : fields.boolean('Group Journal Items', help="Check this if you want to group the Journal Items by Product while closing a Session"),
17+ 'pricelist_id': fields.many2one('product.pricelist','Pricelist', required=True)
18 }
19
20 def _check_cash_control(self, cr, uid, ids, context=None):
21@@ -112,15 +113,21 @@
22 res = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale')], limit=1)
23 return res and res[0] or False
24
25- def _default_shop(self, cr, uid, context=None):
26- res = self.pool.get('sale.shop').search(cr, uid, [])
27+ def _default_warehouse(self, cr, uid, context=None):
28+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
29+ res = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context)
30+ return res and res[0] or False
31+
32+ def _default_pricelist(self, cr, uid, context=None):
33+ res = self.pool.get('product.pricelist').search(cr, uid, [('type', '=', 'sale')], limit=1, context=context)
34 return res and res[0] or False
35
36 _defaults = {
37 'state' : POS_CONFIG_STATE[0][0],
38- 'shop_id': _default_shop,
39+ 'warehouse_id': _default_warehouse,
40 'journal_id': _default_sale_journal,
41 'group_by' : True,
42+ 'pricelist_id': _default_pricelist
43 }
44
45 def set_active(self, cr, uid, ids, context=None):
46@@ -306,7 +313,7 @@
47 # the .xml files as the CoA is not yet installed.
48 jobj = self.pool.get('pos.config')
49 pos_config = jobj.browse(cr, uid, config_id, context=context)
50- context.update({'company_id': pos_config.shop_id.company_id.id})
51+ context.update({'company_id': pos_config.warehouse_id.company_id.id})
52 if not pos_config.journal_id:
53 jid = jobj.default_get(cr, uid, ['journal_id'], context=context)['journal_id']
54 if jid:
55@@ -333,7 +340,7 @@
56 bank_values = {
57 'journal_id' : journal.id,
58 'user_id' : uid,
59- 'company_id' : pos_config.shop_id.company_id.id
60+ 'company_id' : pos_config.warehouse_id.company_id.id
61 }
62 statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context)
63 bank_statement_ids.append(statement_id)
64@@ -594,7 +601,7 @@
65 _columns = {
66 'name': fields.char('Order Ref', size=64, required=True, readonly=True),
67 'company_id':fields.many2one('res.company', 'Company', required=True, readonly=True),
68- 'shop_id': fields.related('session_id', 'config_id', 'shop_id', relation='sale.shop', type='many2one', string='Shop', store=True, readonly=True),
69+ 'warehouse_id': fields.related('session_id', 'config_id', 'warehouse_id', relation='stock.warehouse', type='many2one', string='Warehouse', store=True, readonly=True),
70 'date_order': fields.datetime('Order Date', readonly=True, select=True),
71 'user_id': fields.many2one('res.users', 'Salesman', help="Person who uses the the cash register. It can be a reliever, a student or an interim employee."),
72 'amount_tax': fields.function(_amount_all, string='Taxes', digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
73@@ -638,8 +645,7 @@
74 session_ids = self._default_session(cr, uid, context)
75 if session_ids:
76 session_record = self.pool.get('pos.session').browse(cr, uid, session_ids, context=context)
77- shop = self.pool.get('sale.shop').browse(cr, uid, session_record.config_id.shop_id.id, context=context)
78- return shop.pricelist_id and shop.pricelist_id.id or False
79+ return session_record.config_id.pricelist_id and session_record.config_id.pricelist_id.id or False
80 return False
81
82 _defaults = {
83@@ -690,8 +696,8 @@
84 'auto_picking': True,
85 }, context=context)
86 self.write(cr, uid, [order.id], {'picking_id': picking_id}, context=context)
87- location_id = order.shop_id.warehouse_id.lot_stock_id.id
88- output_id = order.shop_id.warehouse_id.lot_output_id.id
89+ location_id = order.warehouse_id.lot_stock_id.id
90+ output_id = order.warehouse_id.lot_output_id.id
91
92 for line in order.lines:
93 if line.product_id and line.product_id.type == 'service':
94
95=== modified file 'point_of_sale/point_of_sale_view.xml'
96--- point_of_sale/point_of_sale_view.xml 2012-12-08 16:20:31 +0000
97+++ point_of_sale/point_of_sale_view.xml 2013-06-14 14:36:30 +0000
98@@ -84,7 +84,7 @@
99 <page string="Extra Info">
100 <group string="General Information">
101 <field name="company_id" groups="base.group_multi_company"/>
102- <field name="shop_id" widget="selection"/>
103+ <field name="warehouse_id" widget="selection" groups="stock.group_locations"/>
104 <field name="user_id"/>
105 <field name="pricelist_id" groups="product.group_sale_pricelist" domain="[('type','=','sale')]"/>
106 <field name="picking_id" readonly="1"/>
107@@ -769,12 +769,16 @@
108 </header>
109
110 <sheet>
111- <group>
112- <field name="name"/>
113- <field name="shop_id" widget="selection" groups="stock.group_locations" />
114- <field name="journal_id" widget="selection" />
115- <field name="sequence_id" readonly="1" groups="base.group_no_one" />
116- <field name="group_by" groups="account.group_account_user" />
117+ <label for="name" class="oe_edit_only"/>
118+ <h1>
119+ <field name="name"/>
120+ </h1>
121+ <group col="4">
122+ <field name="warehouse_id" widget="selection" groups="stock.group_locations" />
123+ <field name="pricelist_id" groups="product.group_sale_pricelist"/>
124+ <field name="journal_id" widget="selection"/>
125+ <field name="group_by" groups="account.group_account_user"/>
126+ <field name="sequence_id" readonly="1" groups="base.group_no_one"/>
127 </group>
128 <separator string="Available Payment Methods" colspan="4"/>
129 <field name="journal_ids" colspan="4" nolabel="1">
130@@ -809,7 +813,7 @@
131 <field name="arch" type="xml">
132 <tree string="Point of Sale Configuration" colors="grey:state == 'inactive'">
133 <field name="name" />
134- <field name="shop_id" />
135+ <field name="warehouse_id" groups="stock.group_locations"/>
136 <field name="state" />
137 </tree>
138 </field>
139@@ -823,7 +827,7 @@
140 <field name="name" />
141 <filter string="Active" domain="[('state', '=', 'active')]" />
142 <filter string="Inactive" domain="[('state', '=', 'inactive')]" />
143- <field name="shop_id" />
144+ <field name="warehouse_id" groups="stock.group_locations" />
145 </search>
146 </field>
147 </record>
148
149=== modified file 'point_of_sale/report/pos_order_report.py'
150--- point_of_sale/report/pos_order_report.py 2013-04-15 10:23:49 +0000
151+++ point_of_sale/report/pos_order_report.py 2013-06-14 14:36:30 +0000
152@@ -41,7 +41,7 @@
153 'price_total':fields.float('Total Price', readonly=True),
154 'total_discount':fields.float('Total Discount', readonly=True),
155 'average_price': fields.float('Average Price', readonly=True,group_operator="avg"),
156- 'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True),
157+ 'warehouse_id':fields.many2one('stock.warehouse', 'Warehouse', readonly=True),
158 'company_id':fields.many2one('res.company', 'Company', readonly=True),
159 'nbr':fields.integer('# of Lines', readonly=True),
160 'product_qty':fields.integer('# of Qty', readonly=True),
161@@ -69,7 +69,7 @@
162 s.partner_id as partner_id,
163 s.state as state,
164 s.user_id as user_id,
165- s.shop_id as shop_id,
166+ s.warehouse_id as warehouse_id,
167 s.company_id as company_id,
168 s.sale_journal as journal_id,
169 l.product_id as product_id
170@@ -80,7 +80,7 @@
171 group by
172 to_char(s.date_order, 'dd-MM-YYYY'),to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),
173 to_char(s.date_order, 'YYYY-MM-DD'), s.partner_id,s.state,
174- s.user_id,s.shop_id,s.company_id,s.sale_journal,l.product_id,s.create_date
175+ s.user_id,s.warehouse_id,s.company_id,s.sale_journal,l.product_id,s.create_date
176 having
177 sum(l.qty * u.factor) != 0)""")
178
179
180=== modified file 'point_of_sale/report/pos_order_report_view.xml'
181--- point_of_sale/report/pos_order_report_view.xml 2012-11-29 22:26:45 +0000
182+++ point_of_sale/report/pos_order_report_view.xml 2013-06-14 14:36:30 +0000
183@@ -13,7 +13,7 @@
184 <field name="month" invisible="1"/>
185 <field name="partner_id" invisible="1"/>
186 <field name="product_id" invisible="1"/>
187- <field name="shop_id" invisible="1"/>
188+ <field name="warehouse_id" invisible="1"/>
189 <!--<field name="journal_id" invisible="1"/>-->
190 <field name="company_id" invisible="1" groups="base.group_multi_company"/>
191 <field name="nbr" sum="# of Lines"/>
192
193=== modified file 'point_of_sale/report/pos_receipt.rml'
194--- point_of_sale/report/pos_receipt.rml 2012-11-29 22:26:45 +0000
195+++ point_of_sale/report/pos_receipt.rml 2013-06-14 14:36:30 +0000
196@@ -75,7 +75,7 @@
197 <para style="terp_default_Centre_9">[[ address and display_address(address)]]</para>
198 <para style="terp_default_Centre_9">Tel : [[ address and address.phone ]]</para>
199 <para style="terp_default_Centre_9">User : [[ o.user_id.name ]]</para>
200- <para style="terp_default_Centre_9">Shop : [[ o.shop_id.name ]]</para>
201+ <para style="terp_default_Centre_9">Warehouse : [[ o.warehouse_id.name ]]</para>
202 <para style="terp_default_Centre_9">Date : [[ o.date_order ]]</para>
203 <para style="P4">
204 <font color="white"> </font>
205
206=== modified file 'point_of_sale/security/ir.model.access.csv'
207--- point_of_sale/security/ir.model.access.csv 2012-11-29 22:26:45 +0000
208+++ point_of_sale/security/ir.model.access.csv 2013-06-14 14:36:30 +0000
209@@ -8,7 +8,7 @@
210 access_account_move_pos_user,account.move pos_user,account.model_account_move,group_pos_user,1,1,1,0
211 access_account_account_pos_user,account.account pos_user,account.model_account_account,group_pos_user,1,0,0,0
212 access_stock_picking_pos_user,stock.picking pos_user,stock.model_stock_picking,group_pos_user,1,1,1,1
213-access_sale_shop_pos_user,sale.shop pos_user,sale.model_sale_shop,group_pos_user,1,0,0,0
214+access_stock_warehouse_pos_user,stock.warehouse pos_user,stock.model_stock_warehouse,group_pos_user,1,0,0,0
215 access_pos_order_stock_worker,pos.order stock_worker,model_pos_order,stock.group_stock_user,1,0,0,0
216 access_stock_move_pos_user,stock.move pos_user,stock.model_stock_move,group_pos_user,1,1,1,1
217 access_report_sales_by_user_pos,report.sales.by.user.pos,model_report_sales_by_user_pos,group_pos_user,1,0,0,0
218
219=== modified file 'point_of_sale/static/src/js/models.js'
220--- point_of_sale/static/src/js/models.js 2013-05-17 07:17:38 +0000
221+++ point_of_sale/static/src/js/models.js 2013-06-14 14:36:30 +0000
222@@ -142,7 +142,7 @@
223
224 return self.fetch(
225 'pos.config',
226- ['name','journal_ids','shop_id','journal_id',
227+ ['name','journal_ids','warehouse_id','journal_id','pricelist_id',
228 'iface_self_checkout', 'iface_led', 'iface_cashdrawer',
229 'iface_payment_terminal', 'iface_electronic_scale', 'iface_barscan', 'iface_vkeyboard',
230 'iface_print_via_proxy','iface_cashdrawer','state','sequence_id','session_ids'],
231@@ -157,7 +157,7 @@
232 self.iface_self_checkout = !!pos_config.iface_self_checkout;
233 self.iface_cashdrawer = !!pos_config.iface_cashdrawer;
234
235- return self.fetch('sale.shop',[],[['id','=',pos_config.shop_id[0]]]);
236+ return self.fetch('stock.warehouse',[],[['id','=',pos_config.warehouse_id[0]]]);
237 }).then(function(shops){
238 self.set('shop',shops[0]);
239
240@@ -174,7 +174,7 @@
241 ['name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13',
242 'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description'],
243 [['sale_ok','=',true],['available_in_pos','=',true]],
244- {pricelist: self.get('shop').pricelist_id[0]} // context for price
245+ {pricelist: self.get('pos_config').pricelist_id[0]} // context for price
246 );
247 }).then(function(products){
248 self.db.add_products(products);
249
250=== modified file 'point_of_sale/wizard/pos_return.py'
251--- point_of_sale/wizard/pos_return.py 2013-04-15 10:23:49 +0000
252+++ point_of_sale/wizard/pos_return.py 2013-06-14 14:36:30 +0000
253@@ -112,7 +112,7 @@
254 source_stock_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
255 cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
256 "WHERE w.lot_stock_id=s.id AND w.id=%s ",
257- (order_id.shop_id.warehouse_id.id,))
258+ (order_id.warehouse_id.id,))
259 res = cr.fetchone()
260 location_id = res and res[0] or None
261 new_picking = picking_obj.copy(cr, uid, order_id.picking_id.id, {'name':'%s (return)' % order_id.name,
262@@ -205,7 +205,7 @@
263 stock_dest_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
264 cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
265 "WHERE w.lot_stock_id=s.id AND w.id=%s ",
266- (order_id.shop_id.warehouse_id.id,))
267+ (order_id.warehouse_id.id,))
268 res=cr.fetchone()
269 location_id=res and res[0] or None
270 prod_id=prod_obj.browse(cr, uid, prod, context=context)
271@@ -268,7 +268,7 @@
272 stock_dest_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
273 cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
274 " WHERE w.lot_stock_id=s.id AND w.id=%s ",
275- (order_id.shop_id.warehouse_id.id,))
276+ (order_id.warehouse_id.id,))
277 res=cr.fetchone()
278 location_id=res and res[0] or None
279
280
281=== modified file 'portal_sale/security/ir.model.access.csv'
282--- portal_sale/security/ir.model.access.csv 2012-12-05 14:40:51 +0000
283+++ portal_sale/security/ir.model.access.csv 2013-06-14 14:36:30 +0000
284@@ -11,7 +11,6 @@
285 access_account_move_line,account.move.line,account.model_account_move_line,portal.group_portal,1,0,0,0
286 access_account_move_reconcile,account.move.reconcile,account.model_account_move_reconcile,portal.group_portal,1,0,0,0
287 access_account_fiscalyear,account.sequence.fiscalyear,account.model_account_sequence_fiscalyear,portal.group_portal,1,0,0,0
288-access_sale_shop,sale.shop,sale.model_sale_shop,portal.group_portal,1,0,0,0
289 access_product_list,product.pricelist,product.model_product_pricelist,portal.group_portal,1,0,0,0
290 access_res_partner,res.partner,base.model_res_partner,portal.group_portal,1,0,0,0
291 access_account_tax,account.tax,account.model_account_tax,portal.group_portal,1,0,0,0
292
293=== modified file 'sale/report/sale_report.py'
294--- sale/report/sale_report.py 2013-04-15 10:23:49 +0000
295+++ sale/report/sale_report.py 2013-06-14 14:36:30 +0000
296@@ -40,7 +40,6 @@
297 'product_uom_qty': fields.float('# of Qty', readonly=True),
298
299 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
300- 'shop_id': fields.many2one('sale.shop', 'Shop', readonly=True),
301 'company_id': fields.many2one('res.company', 'Company', readonly=True),
302 'user_id': fields.many2one('res.users', 'Salesperson', readonly=True),
303 'price_total': fields.float('Total Price', readonly=True),
304@@ -79,7 +78,6 @@
305 to_char(s.date_order, 'YYYY-MM-DD') as day,
306 s.partner_id as partner_id,
307 s.user_id as user_id,
308- s.shop_id as shop_id,
309 s.company_id as company_id,
310 extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
311 s.state,
312@@ -103,7 +101,6 @@
313 s.date_confirm,
314 s.partner_id,
315 s.user_id,
316- s.shop_id,
317 s.company_id,
318 s.state,
319 s.pricelist_id,
320
321=== modified file 'sale/report/sale_report_view.xml'
322--- sale/report/sale_report_view.xml 2012-11-29 22:26:45 +0000
323+++ sale/report/sale_report_view.xml 2013-06-14 14:36:30 +0000
324@@ -13,7 +13,6 @@
325 <field name="year" invisible="1"/>
326 <field name="day" invisible="1"/>
327 <field name="month" invisible="1"/>
328- <field name="shop_id" invisible="1"/>
329 <field name="company_id" invisible="1" groups="base.group_multi_company"/>
330 <field name="partner_id" invisible="1"/>
331 <field name="product_id" invisible="1"/>
332@@ -58,7 +57,6 @@
333 <field name="product_id"/>
334 <field name="user_id"/>
335 <group expand="0" string="Extended Filters...">
336- <field name="shop_id"/>
337 <field name="categ_id"/>
338 <field name="company_id" groups="base.group_multi_company"/>
339 </group>
340@@ -70,7 +68,6 @@
341 <filter string="Category of Product" icon="terp-stock_symbol-selection" name="Category" context="{'group_by':'categ_id'}"/>
342 <filter string="Analytic Account" icon="terp-folder-green" context="{'group_by':'analytic_account_id'}" groups="analytic.group_analytic_accounting"/>
343 <filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
344- <filter string="Shop" icon="terp-go-home" context="{'group_by':'shop_id'}"/>
345 <filter string="Company" icon="terp-go-home" groups="base.group_multi_company" context="{'group_by':'company_id'}"/>
346 <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Ordered date of the sales order"/>
347 <filter string="Month" name="order_month" icon="terp-go-month" context="{'group_by':'month'}" help="Ordered month of the sales order"/>
348
349=== modified file 'sale/sale.py'
350--- sale/sale.py 2013-06-14 09:19:24 +0000
351+++ sale/sale.py 2013-06-14 14:36:30 +0000
352@@ -28,21 +28,6 @@
353 import openerp.addons.decimal_precision as dp
354 from openerp import netsvc
355
356-class sale_shop(osv.osv):
357- _name = "sale.shop"
358- _description = "Sales Shop"
359- _columns = {
360- 'name': fields.char('Shop Name', size=64, required=True),
361- 'payment_default_id': fields.many2one('account.payment.term', 'Default Payment Term', required=True),
362- 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist'),
363- 'project_id': fields.many2one('account.analytic.account', 'Analytic Account', domain=[('parent_id', '!=', False)]),
364- 'company_id': fields.many2one('res.company', 'Company', required=False),
365- }
366- _defaults = {
367- 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'sale.shop', context=c),
368- }
369-
370-
371 class sale_order(osv.osv):
372 _name = "sale.order"
373 _inherit = ['mail.thread', 'ir.needaction_mixin']
374@@ -54,16 +39,6 @@
375 },
376 }
377
378- def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
379- v = {}
380- if shop_id:
381- shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
382- if shop.project_id.id:
383- v['project_id'] = shop.project_id.id
384- if shop.pricelist_id.id:
385- v['pricelist_id'] = shop.pricelist_id.id
386- return {'value': v}
387-
388 def copy(self, cr, uid, id, default=None, context=None):
389 if not default:
390 default = {}
391@@ -176,17 +151,15 @@
392 result[line.order_id.id] = True
393 return result.keys()
394
395- def _get_default_shop(self, cr, uid, context=None):
396- company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
397- shop_ids = self.pool.get('sale.shop').search(cr, uid, [('company_id','=',company_id)], context=context)
398- if not shop_ids:
399- raise osv.except_osv(_('Error!'), _('There is no default shop for the current user\'s company!'))
400- return shop_ids[0]
401+ def _get_default_company(self, cr, uid, context=None):
402+ company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
403+ if not company_id:
404+ raise osv.except_osv(_('Error!'), _('There is no default company for the current user!'))
405+ return company_id
406
407 _columns = {
408 'name': fields.char('Order Reference', size=64, required=True,
409 readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, select=True),
410- 'shop_id': fields.many2one('sale.shop', 'Shop', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}),
411 'origin': fields.char('Source Document', size=64, help="Reference of the document that generated this sales order request."),
412 'client_order_ref': fields.char('Customer Reference', size=64),
413 'state': fields.selection([
414@@ -246,16 +219,16 @@
415 'invoice_quantity': fields.selection([('order', 'Ordered Quantities')], 'Invoice on', help="The sales order will automatically create the invoice proposition (draft invoice).", required=True, readonly=True, states={'draft': [('readonly', False)]}),
416 'payment_term': fields.many2one('account.payment.term', 'Payment Term'),
417 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
418- 'company_id': fields.related('shop_id','company_id',type='many2one',relation='res.company',string='Company',store=True,readonly=True)
419+ 'company_id': fields.many2one('res.company', 'Company'),
420 }
421 _defaults = {
422 'date_order': fields.date.context_today,
423 'order_policy': 'manual',
424+ 'company_id': _get_default_company,
425 'state': 'draft',
426 'user_id': lambda obj, cr, uid, context: uid,
427 'name': lambda obj, cr, uid, context: '/',
428 'invoice_quantity': 'order',
429- 'shop_id': _get_default_shop,
430 'partner_invoice_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['invoice'])['invoice'],
431 'partner_shipping_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['delivery'])['delivery'],
432 'note': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.sale_note
433
434=== modified file 'sale/sale_data.xml'
435--- sale/sale_data.xml 2013-03-12 14:18:38 +0000
436+++ sale/sale_data.xml 2013-06-14 14:36:30 +0000
437@@ -19,20 +19,6 @@
438 <field name="object">sale.order</field>
439 </record>
440
441- <!-- Resource: sale.shop -->
442- <record id="sale_shop_1" model="sale.shop">
443- <field name="company_id" ref="base.main_company"/>
444- <field name="payment_default_id" ref="account.account_payment_term_net"/>
445- <field name="pricelist_id" ref="product.list0"/>
446-
447- <!-- Copy the name of any company. Without demo data this will yield
448- the main company name, which is correct. With demo data it will
449- be random, but it does not matter much -->
450- <field model="res.company" name="name" search="[]" use="name"/>
451- </record>
452-
453- <function eval="('default',False,'shop_id', [('sale.order', False)], sale_shop_1, True, False, False, False, True)" id="sale_default_set" model="ir.values" name="set"/>
454-
455 <!-- notify all employees of module installation -->
456 <record model="mail.message" id="module_install_notification">
457 <field name="model">mail.group</field>
458
459=== modified file 'sale/sale_demo.xml'
460--- sale/sale_demo.xml 2013-04-19 10:36:00 +0000
461+++ sale/sale_demo.xml 2013-06-14 14:36:30 +0000
462@@ -6,7 +6,6 @@
463 <field name="partner_id" ref="base.res_partner_2"/>
464 <field name="partner_invoice_id" ref="base.res_partner_2"/>
465 <field name="partner_shipping_id" ref="base.res_partner_2"/>
466- <field name="shop_id" ref="sale_shop_1"/>
467 <field name="user_id" ref="base.user_demo"/>
468 <field name="pricelist_id" ref="product.list0"/>
469 </record>
470@@ -45,7 +44,6 @@
471 <field name="partner_id" ref="base.res_partner_7"/>
472 <field name="partner_invoice_id" ref="base.res_partner_address_13"/>
473 <field name="partner_shipping_id" ref="base.res_partner_address_13"/>
474- <field name="shop_id" ref="sale_shop_1"/>
475 <field name="user_id" ref="base.user_root"/>
476 <field name="pricelist_id" ref="product.list0"/>
477 <field name="order_policy">manual</field>
478@@ -75,7 +73,6 @@
479 <field name="partner_id" ref="base.res_partner_14"/>
480 <field name="partner_invoice_id" ref="base.res_partner_14"/>
481 <field name="partner_shipping_id" ref="base.res_partner_14"/>
482- <field name="shop_id" ref="sale_shop_1"/>
483 <field name="user_id" ref="base.user_root"/>
484 <field name="pricelist_id" ref="product.list0"/>
485 <field name="order_policy">manual</field>
486@@ -105,7 +102,6 @@
487 <field name="partner_id" ref="base.res_partner_15"/>
488 <field name="partner_invoice_id" ref="base.res_partner_address_25"/>
489 <field name="partner_shipping_id" ref="base.res_partner_address_25"/>
490- <field name="shop_id" ref="sale_shop_1"/>
491 <field name="user_id" ref="base.user_root"/>
492 <field name="pricelist_id" ref="product.list0"/>
493 </record>
494@@ -154,7 +150,6 @@
495 <field name="partner_id" ref="base.res_partner_2"/>
496 <field name="partner_invoice_id" ref="base.res_partner_2"/>
497 <field name="partner_shipping_id" ref="base.res_partner_2"/>
498- <field name="shop_id" ref="sale_shop_1"/>
499 <field name="user_id" ref="base.user_demo"/>
500 <field name="pricelist_id" ref="product.list0"/>
501 </record>
502@@ -193,7 +188,6 @@
503 <field name="partner_id" ref="base.res_partner_18"/>
504 <field name="partner_invoice_id" ref="base.res_partner_18"/>
505 <field name="partner_shipping_id" ref="base.res_partner_18"/>
506- <field name="shop_id" ref="sale_shop_1"/>
507 <field name="user_id" ref="base.user_root"/>
508 <field name="pricelist_id" ref="product.list0"/>
509 </record>
510@@ -261,7 +255,6 @@
511 <field name="partner_id" ref="base.res_partner_15"/>
512 <field name="partner_invoice_id" ref="base.res_partner_address_25"/>
513 <field name="partner_shipping_id" ref="base.res_partner_address_25"/>
514- <field name="shop_id" ref="sale_shop_1"/>
515 <field name="user_id" ref="base.user_demo"/>
516 <field name="pricelist_id" ref="product.list0"/>
517 <field name="order_policy">manual</field>
518
519=== modified file 'sale/sale_unit_test.xml'
520--- sale/sale_unit_test.xml 2012-11-29 22:26:45 +0000
521+++ sale/sale_unit_test.xml 2013-06-14 14:36:30 +0000
522@@ -3,7 +3,6 @@
523 <data>
524 <!-- Resource: sale.order -->
525 <record id="test_order_1" model="sale.order">
526- <field name="shop_id" ref="sale_shop_1"/>
527 <field model="product.pricelist" name="pricelist_id" search="[]"/>
528 <field name="user_id" ref="base.user_root"/>
529 <field model="res.partner" name="partner_id" search="[]"/>
530
531=== modified file 'sale/sale_view.xml'
532--- sale/sale_view.xml 2013-06-05 06:16:51 +0000
533+++ sale/sale_view.xml 2013-06-14 14:36:30 +0000
534@@ -13,59 +13,6 @@
535
536 <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/>
537
538-
539- <record id="view_shop_form" model="ir.ui.view">
540- <field name="name">sale.shop</field>
541- <field name="model">sale.shop</field>
542- <field name="arch" type="xml">
543- <form string="Sales Shop" version="7.0">
544- <label for="name" class="oe_edit_only"/>
545- <h1><field name="name"/></h1>
546- <group name="shop">
547- <group>
548- <field name="payment_default_id"/>
549- <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist"/>
550- </group>
551- <group>
552- <field name="project_id" groups="analytic.group_analytic_accounting"/>
553- <field name="company_id" widget="selection" groups="base.group_multi_company"/>
554- </group>
555- </group>
556- </form>
557- </field>
558- </record>
559-
560- <record id="view_shop_tree" model="ir.ui.view">
561- <field name="name">sale.shop</field>
562- <field name="model">sale.shop</field>
563- <field name="arch" type="xml">
564- <tree string="Sales Shop">
565- <field name="name"/>
566- <field name="pricelist_id" groups="product.group_sale_pricelist"/>
567- <field name="project_id" groups="analytic.group_analytic_accounting"/>
568- </tree>
569- </field>
570- </record>
571-
572- <record id="action_shop_form" model="ir.actions.act_window">
573- <field name="name">Shop</field>
574- <field name="type">ir.actions.act_window</field>
575- <field name="res_model">sale.shop</field>
576- <field name="view_type">form</field>
577- <field name="view_mode">tree,form</field>
578- <field name="view_id" ref="view_shop_tree"/>
579- <field name="help" type="html">
580- <p class="oe_view_nocontent_create">
581- Click to define a new sale shop.
582- </p><p>
583- Each quotation or sales order must be linked to a shop. The
584- shop also defines the warehouse from which the products will be
585- delivered for each particular sales.
586- </p>
587- </field>
588- </record>
589-
590-
591 <record id="view_sale_order_calendar" model="ir.ui.view">
592 <field name="name">sale.order.calendar</field>
593 <field name="model">sale.order</field>
594@@ -160,7 +107,6 @@
595 </group>
596 <group>
597 <field name="date_order"/>
598- <field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, context)" widget="selection"/>
599 <field name="client_order_ref"/>
600 <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
601 <field name="currency_id" invisible="1"/>
602@@ -178,13 +124,13 @@
603 <group>
604 <field name="state" invisible="1" />
605 <field name="product_id"
606- context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
607+ context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
608 groups="base.group_user"
609 on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
610 <label for="product_uom_qty"/>
611 <div>
612 <field
613- context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
614+ context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
615 name="product_uom_qty" class="oe_inline"
616 on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)"/>
617 <field name="product_uom" groups="product.group_uom" class="oe_inline oe_no_button"
618@@ -222,12 +168,12 @@
619 <field name="state" invisible="1"/>
620 <field name="th_weight" invisible="1"/>
621 <field name="product_id"
622- context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
623+ context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
624 groups="base.group_user"
625 on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
626 <field name="name"/>
627 <field name="product_uom_qty"
628- context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
629+ context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
630 on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)"/>
631 <field name="product_uom"
632 on_change="product_uom_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, context)"
633
634=== modified file 'sale/security/ir.model.access.csv'
635--- sale/security/ir.model.access.csv 2012-11-29 22:26:45 +0000
636+++ sale/security/ir.model.access.csv 2013-06-14 14:36:30 +0000
637@@ -1,5 +1,4 @@
638 id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
639-access_sale_shop,sale.shop,model_sale_shop,base.group_user,1,0,0,0
640 access_sale_order,sale.order,model_sale_order,base.group_sale_salesman,1,1,1,0
641 access_sale_order_line,sale.order.line,model_sale_order_line,base.group_sale_salesman,1,1,1,1
642 access_sale_order_line_accountant,sale.order.line accountant,model_sale_order_line,account.group_account_user,1,1,0,0
643@@ -19,7 +18,6 @@
644 access_res_partner_sale_manager,res.partner.sale.manager,base.model_res_partner,base.group_sale_manager,1,1,1,0
645 access_product_template_sale_user,product.template sale use,product.model_product_template,base.group_sale_salesman,1,0,0,0
646 access_product_product_sale_user,product.product sale use,product.model_product_product,base.group_sale_salesman,1,0,0,0
647-access_sale_shop_manager,account.journal sale order.user,model_sale_shop,base.group_sale_manager,1,1,1,1
648 access_account_fiscalyear_user,account.fiscalyear.user,account.model_account_fiscalyear,base.group_sale_salesman,1,0,0,0
649 access_account_tax_user,account.tax.user,account.model_account_tax,base.group_sale_salesman,1,0,0,0
650 access_ir_attachment_sales,ir.attachment.sales,base.model_ir_attachment,base.group_sale_salesman,1,1,1,0
651@@ -29,8 +27,6 @@
652 access_product_uom_user,product.uom.user,product.model_product_uom,base.group_sale_salesman,1,0,0,0
653 access_product_pricelist_sale_user,product.pricelist.sale.user,product.model_product_pricelist,base.group_sale_salesman,1,0,0,0
654 access_account_account_salesman,account_account salesman,account.model_account_account,base.group_sale_salesman,1,0,0,0
655-access_sale_shop_sale_user,sale.shop.sale.user,model_sale_shop,base.group_sale_salesman,1,0,0,0
656-access_sale_shop_sale_manager,sale.shop.sale.manager,model_sale_shop,base.group_sale_manager,1,1,1,1
657 access_product_uom_categ_sale_manager,product.uom.categ salemanager,product.model_product_uom_categ,base.group_sale_manager,1,1,1,1
658 access_product_uom_sale_manager,product.uom salemanager,product.model_product_uom,base.group_sale_manager,1,1,1,1
659 access_product_ul_sale_manager,product.ul salemanager,product.model_product_ul,base.group_sale_manager,1,1,1,1
660
661=== modified file 'sale/security/sale_security.xml'
662--- sale/security/sale_security.xml 2012-12-21 16:48:08 +0000
663+++ sale/security/sale_security.xml 2013-06-14 14:36:30 +0000
664@@ -78,13 +78,6 @@
665 <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
666 </record>
667
668- <record model="ir.rule" id="sale_shop_comp_rule">
669- <field name="name">Sale Shop multi-company</field>
670- <field name="model_id" ref="model_sale_shop"/>
671- <field name="global" eval="True"/>
672- <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
673- </record>
674-
675 <!-- Multi - Salesmen sales order assignation rules -->
676
677 <record id="sale_order_personal_rule" model="ir.rule">
678
679=== modified file 'sale_analytic_plans/sale_analytic_plans.py'
680--- sale_analytic_plans/sale_analytic_plans.py 2013-04-15 10:23:49 +0000
681+++ sale_analytic_plans/sale_analytic_plans.py 2013-06-14 14:36:30 +0000
682@@ -38,14 +38,4 @@
683 return create_ids
684
685
686-class sale_order(osv.osv):
687- _inherit = "sale.order"
688-
689- def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
690- # Remove the project_id from the result of super() call, if any, as this field is not in the view anymore
691- res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shop_id, context=context)
692- if res.get('value',{}).get('project_id'):
693- del(res['value']['project_id'])
694- return res
695-
696 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
697
698=== modified file 'sale_crm/test/sale_crm.yml'
699--- sale_crm/test/sale_crm.yml 2012-11-29 22:26:45 +0000
700+++ sale_crm/test/sale_crm.yml 2013-06-14 14:36:30 +0000
701@@ -1,15 +1,4 @@
702 -
703- Make sure the main company has at least one shop.
704--
705- !python {model: sale.shop}: |
706- company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
707- shop_ids = self.search(cr, uid, [('company_id', '=', company_id)])
708- if not shop_ids:
709- # take a shop, and assign it to the user's company
710- shop_ids = self.search(cr, uid, [])
711- if shop_ids:
712- self.write(cr, uid, [shop_ids[0]], {'company_id': company_id})
713--
714 I open the wizard "Make sales".
715 -
716 !record {model: crm.make.sale, id: crm_make_sale_0}:
717
718=== modified file 'sale_crm/wizard/crm_make_sale.py'
719--- sale_crm/wizard/crm_make_sale.py 2013-06-14 09:19:24 +0000
720+++ sale_crm/wizard/crm_make_sale.py 2013-06-14 14:36:30 +0000
721@@ -95,7 +95,6 @@
722 'origin': _('Opportunity: %s') % str(case.id),
723 'section_id': case.section_id and case.section_id.id or False,
724 'categ_ids': [(6, 0, [categ_id.id for categ_id in case.categ_ids])],
725- 'shop_id': make.shop_id.id,
726 'partner_id': partner.id,
727 'pricelist_id': pricelist,
728 'partner_invoice_id': partner_addr['invoice'],
729@@ -140,18 +139,12 @@
730 }
731 return value
732
733- def _get_shop_id(self, cr, uid, ids, context=None):
734- cmpny_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
735- shop = self.pool.get('sale.shop').search(cr, uid, [('company_id', '=', cmpny_id)])
736- return shop and shop[0] or False
737
738 _columns = {
739- 'shop_id': fields.many2one('sale.shop', 'Shop', required=True),
740 'partner_id': fields.many2one('res.partner', 'Customer', required=True, domain=[('customer','=',True)]),
741 'close': fields.boolean('Mark Won', help='Check this to close the opportunity after having created the sales order.'),
742 }
743 _defaults = {
744- 'shop_id': _get_shop_id,
745 'close': False,
746 'partner_id': _selectPartner,
747 }
748
749=== modified file 'sale_crm/wizard/crm_make_sale_view.xml'
750--- sale_crm/wizard/crm_make_sale_view.xml 2012-11-29 22:26:45 +0000
751+++ sale_crm/wizard/crm_make_sale_view.xml 2013-06-14 14:36:30 +0000
752@@ -10,7 +10,6 @@
753 <form string="Convert to Quotation" version="7.0">
754 <group col="4">
755 <field name="partner_id" required="1"/>
756- <field name="shop_id" required="1" widget="selection" groups="stock.group_locations"/>
757 <field name="close"/>
758 </group>
759 <footer>
760
761=== modified file 'sale_margin/test/sale_margin.yml'
762--- sale_margin/test/sale_margin.yml 2012-11-29 22:26:45 +0000
763+++ sale_margin/test/sale_margin.yml 2013-06-14 14:36:30 +0000
764@@ -23,7 +23,6 @@
765 partner_invoice_id: base.res_partner_address_7
766 partner_shipping_id: base.res_partner_address_7
767 pricelist_id: product.list0
768- shop_id: sale.sale_shop_1
769 -
770 I confirm the sale order
771 -
772
773=== modified file 'sale_mrp/test/sale_mrp.yml'
774--- sale_mrp/test/sale_mrp.yml 2013-03-21 13:18:24 +0000
775+++ sale_mrp/test/sale_mrp.yml 2013-06-14 14:36:30 +0000
776@@ -83,7 +83,6 @@
777 partner_shipping_id: base.res_partner_address_7
778 picking_policy: direct
779 pricelist_id: product.list0
780- shop_id: sale.sale_shop_1
781 -
782 I confirm the sale order
783 -
784
785=== modified file 'sale_stock/__openerp__.py'
786--- sale_stock/__openerp__.py 2012-11-22 09:22:14 +0000
787+++ sale_stock/__openerp__.py 2013-06-14 14:36:30 +0000
788@@ -57,7 +57,6 @@
789 'report/sale_report_view.xml',
790 'process/sale_stock_process.xml',
791 ],
792- 'data': ['sale_stock_data.xml'],
793 'demo_xml': ['sale_stock_demo.xml'],
794 'test': ['test/cancel_order_sale_stock.yml',
795 'test/picking_order_policy.yml',
796
797=== modified file 'sale_stock/report/sale_report.py'
798--- sale_stock/report/sale_report.py 2013-04-15 10:23:49 +0000
799+++ sale_stock/report/sale_report.py 2013-06-14 14:36:30 +0000
800@@ -27,6 +27,7 @@
801 _columns = {
802 'shipped': fields.boolean('Shipped', readonly=True),
803 'shipped_qty_1': fields.integer('Shipped', readonly=True),
804+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse',readonly=True),
805 'state': fields.selection([
806 ('draft', 'Quotation'),
807 ('waiting_date', 'Waiting Schedule'),
808@@ -57,8 +58,8 @@
809 to_char(s.date_order, 'YYYY-MM-DD') as day,
810 s.partner_id as partner_id,
811 s.user_id as user_id,
812- s.shop_id as shop_id,
813 s.company_id as company_id,
814+ s.warehouse_id as warehouse_id,
815 extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
816 s.state,
817 t.categ_id as categ_id,
818@@ -83,7 +84,7 @@
819 s.date_confirm,
820 s.partner_id,
821 s.user_id,
822- s.shop_id,
823+ s.warehouse_id,
824 s.company_id,
825 s.state,
826 s.shipped,
827
828=== modified file 'sale_stock/report/sale_report_view.xml'
829--- sale_stock/report/sale_report_view.xml 2012-10-11 13:08:51 +0000
830+++ sale_stock/report/sale_report_view.xml 2013-06-14 14:36:30 +0000
831@@ -7,9 +7,20 @@
832 <field name="inherit_id" ref="sale.view_order_product_tree"/>
833 <field name="arch" type="xml">
834 <field name="product_uom_qty" position="after">
835+ <field name="warehouse_id" invisible="1"/>
836 <field name="shipped_qty_1" sum="Shipped"/>
837 </field>
838 </field>
839 </record>
840+ <record id="view_order_product_search_sale_stock_inherit" model="ir.ui.view">
841+ <field name="name">sale.report.search.sale.stock</field>
842+ <field name="model">sale.report</field>
843+ <field name="inherit_id" ref="sale.view_order_product_search"/>
844+ <field name="arch" type="xml">
845+ <xpath expr="//group/filter[@string='Status']" position="after">
846+ <filter string="Warehouse" context="{'group_by':'warehouse_id'}"/>
847+ </xpath>
848+ </field>
849+ </record>
850 </data>
851 </openerp>
852\ No newline at end of file
853
854=== modified file 'sale_stock/res_config.py'
855--- sale_stock/res_config.py 2013-03-27 13:00:26 +0000
856+++ sale_stock/res_config.py 2013-06-14 14:36:30 +0000
857@@ -50,9 +50,6 @@
858 'group_mrp_properties': fields.boolean('Product properties on order lines',
859 implied_group='sale.group_mrp_properties',
860 help="Allows you to tag sales order lines with properties."),
861- 'group_multiple_shops': fields.boolean("Manage multiple shops",
862- implied_group='stock.group_locations',
863- help="This allows to configure and use multiple shops."),
864 'module_project_timesheet': fields.boolean("Project Timesheet"),
865 'module_project_mrp': fields.boolean("Project MRP"),
866 }
867
868=== modified file 'sale_stock/res_config_view.xml'
869--- sale_stock/res_config_view.xml 2012-10-12 05:51:52 +0000
870+++ sale_stock/res_config_view.xml 2013-06-14 14:36:30 +0000
871@@ -59,12 +59,6 @@
872 <label for="group_mrp_properties"/>
873 </div>
874 </div>
875- <xpath expr="//div[@name='module_sale_margin']" position="before">
876- <div>
877- <field name="group_multiple_shops" class="oe_inline"/>
878- <label for="group_multiple_shops"/>
879- </div>
880- </xpath>
881 <field name="group_invoice_so_lines" position="replace">
882 <field name="group_invoice_so_lines" on_change="onchange_invoice_methods(group_invoice_so_lines, group_invoice_deli_orders)" class="oe_inline"/>
883 </field>
884
885=== modified file 'sale_stock/sale_stock.py'
886--- sale_stock/sale_stock.py 2013-06-13 18:15:03 +0000
887+++ sale_stock/sale_stock.py 2013-06-14 14:36:30 +0000
888@@ -27,13 +27,6 @@
889 import pytz
890 from openerp import SUPERUSER_ID
891
892-class sale_shop(osv.osv):
893- _inherit = "sale.shop"
894- _columns = {
895- 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
896- }
897-
898-
899 class sale_order(osv.osv):
900 _inherit = "sale.order"
901
902@@ -70,9 +63,16 @@
903 vals.update({'invoice_quantity': 'order'})
904 if vals['order_policy'] == 'picking':
905 vals.update({'invoice_quantity': 'procurement'})
906- order = super(sale_order, self).create(cr, uid, vals, context=context)
907+ order = super(sale_order, self).create(cr, uid, vals, context=context)
908 return order
909
910+ def _get_default_warehouse(self, cr, uid, context=None):
911+ company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
912+ warehouse_ids = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', company_id)], context=context)
913+ if not warehouse_ids:
914+ raise osv.except_osv(_('Error!'), _('There is no warehouse defined for current company.'))
915+ return warehouse_ids[0]
916+
917 # This is False
918 def _picked_rate(self, cr, uid, ids, name, arg, context=None):
919 if not ids:
920@@ -140,11 +140,13 @@
921 'picking_ids': fields.one2many('stock.picking.out', 'sale_id', 'Related Picking', readonly=True, help="This is a list of delivery orders that has been generated for this sales order."),
922 'shipped': fields.boolean('Delivered', readonly=True, help="It indicates that the sales order has been delivered. This field is updated only after the scheduler(s) have been launched."),
923 'picked_rate': fields.function(_picked_rate, string='Picked', type='float'),
924+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True),
925 'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on',
926 help="The sales order will automatically create the invoice proposition (draft invoice).\
927 You have to choose if you want your invoice based on ordered ", required=True, readonly=True, states={'draft': [('readonly', False)]}),
928 }
929 _defaults = {
930+ 'warehouse_id': _get_default_warehouse,
931 'picking_policy': 'direct',
932 'order_policy': 'manual',
933 'invoice_quantity': 'order',
934@@ -162,6 +164,14 @@
935
936 return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
937
938+ def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context=None):
939+ val = {}
940+ if warehouse_id:
941+ warehouse = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context=context)
942+ if warehouse.company_id:
943+ val['company_id'] = warehouse.company_id.id
944+ return {'value': val}
945+
946 def action_view_delivery(self, cr, uid, ids, context=None):
947 '''
948 This function returns an action that display existing delivery orders of given sales order ids. It can either be a in a list or in a form view, if there is only one delivery order to show.
949@@ -297,7 +307,7 @@
950 or line.product_uom_qty,
951 'product_uos': (line.product_uos and line.product_uos.id)\
952 or line.product_uom.id,
953- 'location_id': order.shop_id.warehouse_id.lot_stock_id.id,
954+ 'location_id': order.warehouse_id.lot_stock_id.id,
955 'procure_method': line.type,
956 'move_id': move_id,
957 'company_id': order.company_id.id,
958@@ -305,8 +315,8 @@
959 }
960
961 def _prepare_order_line_move(self, cr, uid, order, line, picking_id, date_planned, context=None):
962- location_id = order.shop_id.warehouse_id.lot_stock_id.id
963- output_id = order.shop_id.warehouse_id.lot_output_id.id
964+ location_id = order.warehouse_id.lot_stock_id.id
965+ output_id = order.warehouse_id.lot_output_id.id
966 return {
967 'name': line.name,
968 'picking_id': picking_id,
969
970=== removed file 'sale_stock/sale_stock_data.xml'
971--- sale_stock/sale_stock_data.xml 2012-09-20 13:17:11 +0000
972+++ sale_stock/sale_stock_data.xml 1970-01-01 00:00:00 +0000
973@@ -1,11 +0,0 @@
974-<?xml version="1.0" encoding="utf-8"?>
975-<openerp>
976- <data noupdate="1">
977-
978- <!-- Resource: sale.shop -->
979- <record id="sale.sale_shop_1" model="sale.shop">
980- <field name="warehouse_id" ref="stock.warehouse0"/>
981- </record>
982-
983- </data>
984-</openerp>
985\ No newline at end of file
986
987=== modified file 'sale_stock/sale_stock_demo.xml'
988--- sale_stock/sale_stock_demo.xml 2012-09-09 10:11:56 +0000
989+++ sale_stock/sale_stock_demo.xml 2013-06-14 14:36:30 +0000
990@@ -3,21 +3,37 @@
991 <data noupdate="1">
992
993 <record id="sale.sale_order_1" model="sale.order">
994+ <field name="warehouse_id" ref="stock.warehouse0"/>
995 <field name="order_policy">prepaid</field>
996 </record>
997-
998+
999+ <record id="sale.sale_order_2" model="sale.order">
1000+ <field name="warehouse_id" ref="stock.warehouse0"/>
1001+ </record>
1002+
1003+ <record id="sale.sale_order_3" model="sale.order">
1004+ <field name="warehouse_id" ref="stock.warehouse0"/>
1005+ </record>
1006+
1007 <record id="sale.sale_order_4" model="sale.order">
1008+ <field name="warehouse_id" ref="stock.warehouse0"/>
1009 <field name="order_policy">prepaid</field>
1010 </record>
1011
1012 <record id="sale.sale_order_5" model="sale.order">
1013+ <field name="warehouse_id" ref="stock.warehouse0"/>
1014 <field name="order_policy">picking</field>
1015 </record>
1016
1017 <record id="sale.sale_order_6" model="sale.order">
1018+ <field name="warehouse_id" ref="stock.warehouse0"/>
1019 <field name="order_policy">picking</field>
1020 </record>
1021
1022+ <record id="sale.sale_order_8" model="sale.order">
1023+ <field name="warehouse_id" ref="stock.warehouse0"/>
1024+ </record>
1025+
1026 <!-- Confirm some Sale Orders-->
1027 <workflow action="order_confirm" model="sale.order" ref="sale.sale_order_1"/>
1028 <workflow action="order_confirm" model="sale.order" ref="sale.sale_order_5"/>
1029
1030=== modified file 'sale_stock/sale_stock_view.xml'
1031--- sale_stock/sale_stock_view.xml 2013-03-14 11:27:40 +0000
1032+++ sale_stock/sale_stock_view.xml 2013-06-14 14:36:30 +0000
1033@@ -2,31 +2,6 @@
1034 <openerp>
1035 <data>
1036
1037- <record id="view_sale_shop_form_inherit" model="ir.ui.view">
1038- <field name="name">sale.shop.inherit.form</field>
1039- <field name="model">sale.shop</field>
1040- <field name="inherit_id" ref="sale.view_shop_form"/>
1041- <field name="arch" type="xml">
1042- <xpath expr="//group[@name='shop']" position="before">
1043- <label for="warehouse_id" class="oe_edit_only"/>
1044- <h2><field name="warehouse_id" required="1"/></h2>
1045- </xpath>
1046- </field>
1047- </record>
1048-
1049- <record id="view_shop_tree_inherit" model="ir.ui.view">
1050- <field name="name">sale.shop.sale.stock</field>
1051- <field name="model">sale.shop</field>
1052- <field name="inherit_id" ref="sale.view_shop_tree"/>
1053- <field name="arch" type="xml">
1054- <field name="name" position="after">
1055- <field name="warehouse_id"/>
1056- </field>
1057- </field>
1058- </record>
1059-
1060- <menuitem action="sale.action_shop_form" id="menu_action_shop_form" parent="base.menu_base_config" sequence="35" groups="stock.group_locations"/>
1061-
1062 <record id="view_order_form_inherit" model="ir.ui.view">
1063 <field name="name">sale.order.form.sale.stock</field>
1064 <field name="model">sale.order</field>
1065@@ -48,17 +23,20 @@
1066 <field name="state" position="replace">
1067 <field name="state" widget="statusbar" statusbar_visible="draft,sent,progress,invoiced,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
1068 </field>
1069- <field name="shop_id" position="replace">
1070- <field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="stock.group_locations"/>
1071- </field>
1072+ <field name="company_id" position="replace">
1073+ <field name="company_id" readonly="True"/>
1074+ </field>
1075+ <field name="fiscal_position" position="after">
1076+ <field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" widget="selection" groups="stock.group_locations"/>
1077+ </field>
1078 <field name="product_id" position="replace">
1079 <field name="product_id"
1080- context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
1081+ context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
1082 groups="base.group_user"
1083 on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position, False, context)"/>
1084 </field>
1085 <field name="product_uom_qty" position="replace">
1086- <field context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
1087+ <field context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
1088 name="product_uom_qty" class="oe_inline"
1089 on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, True, context)"/>
1090 </field>
1091@@ -78,7 +56,7 @@
1092 groups="sale.group_mrp_properties"/>
1093 </xpath>
1094 <xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='tax_id']" position="before">
1095- <field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging" />
1096+ <field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging" />
1097 </xpath>
1098 <xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/div/field[@name='invoice_lines']" position="after">
1099 <label for="move_ids"/>
1100
1101=== modified file 'sale_stock/test/picking_order_policy.yml'
1102--- sale_stock/test/picking_order_policy.yml 2013-04-22 15:34:49 +0000
1103+++ sale_stock/test/picking_order_policy.yml 2013-06-14 14:36:30 +0000
1104@@ -63,8 +63,8 @@
1105 assert picking.note == sale_order.note,"Note is not correspond with sale order."
1106 assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice policy is not correspond with sale order."
1107 assert len(picking.move_lines) == len(sale_order.order_line), "Total move of delivery order are not corresposning with total sale order lines."
1108- location_id = sale_order.shop_id.warehouse_id.lot_stock_id.id
1109- output_id = sale_order.shop_id.warehouse_id.lot_output_id.id
1110+ location_id = sale_order.warehouse_id.lot_stock_id.id
1111+ output_id = sale_order.warehouse_id.lot_output_id.id
1112 for move in picking.move_lines:
1113 order_line = move.sale_line_id
1114 sale_order_date = self.date_to_datetime(cr, uid, sale_order.date_order, context)
1115
1116=== modified file 'stock/product.py'
1117--- stock/product.py 2013-04-18 09:41:47 +0000
1118+++ stock/product.py 2013-06-14 14:36:30 +0000
1119@@ -205,7 +205,6 @@
1120
1121 location_obj = self.pool.get('stock.location')
1122 warehouse_obj = self.pool.get('stock.warehouse')
1123- shop_obj = self.pool.get('sale.shop')
1124
1125 states = context.get('states',[])
1126 what = context.get('what',())
1127@@ -215,11 +214,6 @@
1128 if not ids:
1129 return res
1130
1131- if context.get('shop', False):
1132- warehouse_id = shop_obj.read(cr, uid, int(context['shop']), ['warehouse_id'])['warehouse_id'][0]
1133- if warehouse_id:
1134- context['warehouse'] = warehouse_id
1135-
1136 if context.get('warehouse', False):
1137 lot_id = warehouse_obj.read(cr, uid, int(context['warehouse']), ['lot_stock_id'])['lot_stock_id'][0]
1138 if lot_id:
1139@@ -372,7 +366,6 @@
1140 "In a context with a single Warehouse, this includes "
1141 "goods stored in the Stock Location of this Warehouse, or any "
1142 "of its children.\n"
1143- "In a context with a single Shop, this includes goods "
1144 "stored in the Stock Location of the Warehouse of this Shop, "
1145 "or any of its children.\n"
1146 "Otherwise, this includes goods stored in any Stock Location "
1147@@ -387,7 +380,6 @@
1148 "In a context with a single Warehouse, this includes "
1149 "goods stored in the Stock Location of this Warehouse, or any "
1150 "of its children.\n"
1151- "In a context with a single Shop, this includes goods "
1152 "stored in the Stock Location of the Warehouse of this Shop, "
1153 "or any of its children.\n"
1154 "Otherwise, this includes goods stored in any Stock Location "
1155
1156=== modified file 'stock_location/stock_location_demo_cpu1.xml'
1157--- stock_location/stock_location_demo_cpu1.xml 2013-04-29 14:01:42 +0000
1158+++ stock_location/stock_location_demo_cpu1.xml 2013-06-14 14:36:30 +0000
1159@@ -75,17 +75,5 @@
1160 <field name="product_id" ref="product.product_product_9"/>
1161 </record>
1162
1163- <record id="sale_shop2" model="sale.shop">
1164- <field name="name">Chicago Shop</field>
1165- <field name="warehouse_id" ref="stock.stock_warehouse_shop0"/>
1166- <field name="company_id" ref="stock.res_company_1"/>
1167- <field model="account.payment.term" name="payment_default_id" search="[]"/>
1168- </record>
1169- <record id="sale_shop3" model="sale.shop">
1170- <field name="name">Birmingham shop</field>
1171- <field name="warehouse_id" ref="stock.stock_warehouse_shop1"/>
1172- <field name="company_id" ref="stock.res_company_2"/>
1173- <field model="account.payment.term" name="payment_default_id" search="[]"/>
1174- </record>
1175 </data>
1176 </openerp>
1177\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: