Merge lp:~sandi-dirntis/openerpsl/openerpsl_20140219_2 into lp:openerpsl/7.0

Proposed by Aleksander Dirntiš
Status: Merged
Merged at revision: 330
Proposed branch: lp:~sandi-dirntis/openerpsl/openerpsl_20140219_2
Merge into: lp:openerpsl/7.0
Diff against target: 744 lines (+368/-191)
16 files modified
account_tax_period/account_move_line.py (+19/-1)
purchase_landing_costs/product_template.py (+2/-2)
purchase_landing_costs/product_template_view.xml (+2/-2)
purchase_recalculation/account_invoice.py (+0/-3)
purchase_recalculation/stock_move.py (+13/-13)
sale_order_extensions/__init__.py (+2/-1)
sale_order_extensions/__openerp__.py (+4/-1)
sale_order_extensions/i18n/en_US.po (+16/-0)
sale_order_extensions/i18n/sale_order_extensions.pot (+16/-0)
sale_order_extensions/i18n/sl.po (+0/-161)
sale_order_extensions/i18n/sl_SI.po (+177/-0)
sale_order_extensions/product_product.py (+10/-0)
sale_order_extensions/product_product_view.xml (+20/-0)
sale_order_extensions/res_partner.py (+34/-0)
sale_order_extensions/res_partner_view.xml (+19/-0)
sale_order_extensions/sale_order.py (+34/-7)
To merge this branch: bzr merge lp:~sandi-dirntis/openerpsl/openerpsl_20140219_2
Reviewer Review Type Date Requested Status
Mentis Pending
Review via email: mp+207238@code.launchpad.net

Description of the change

[FIX] Fixed landing cost setting on product
[MOD] Disabled period check between stock move and supplier invoice
[ADD] Added Sale Price functionality on product

To post a comment you must log in.
331. By Aleksander Dirntiš

[FIX] Fixed landing cost setting on product
[MOD] Disabled period check between stock move and supplier invoice
[ADD] Added Sale Price functionality on product

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_tax_period/account_move_line.py'
2--- account_tax_period/account_move_line.py 2013-06-06 11:06:58 +0000
3+++ account_tax_period/account_move_line.py 2014-02-19 16:12:03 +0000
4@@ -31,12 +31,30 @@
5 result.append(line.id)
6 return result
7
8+ def _get_tax_period(self, cr, uid, context=None):
9+ """
10+ Return default account period value
11+ """
12+ context = context or {}
13+ if context.get('tax_period_id', False):
14+ return context['tax_period_id']
15+ account_period_obj = self.pool.get('account.period')
16+ ctx = dict(context, account_period_prefer_normal=True)
17+ ids = account_period_obj.find(cr, uid, context=ctx)
18+ tax_period_id = False
19+ if ids:
20+ tax_period_id = ids[0]
21+ return tax_period_id
22+
23 _columns = {
24- 'tax_period_id': fields.related('move_id', 'tax_period_id', string='Tax Period', type='many2one', relation='account.period', select=True,
25+ 'tax_period_id': fields.related('move_id', 'tax_period_id', string='Tax Period', type='many2one', relation='account.period', required=True, select=True,
26 store = {
27 'account.move': (_get_move_lines, ['tax_period_id'], 20)
28 }),
29
30 }
31+ _defaults = {
32+ 'tax_period_id': _get_tax_period
33+ }
34
35 account_move_line()
36\ No newline at end of file
37
38=== modified file 'purchase_landing_costs/product_template.py'
39--- purchase_landing_costs/product_template.py 2013-01-24 13:09:31 +0000
40+++ purchase_landing_costs/product_template.py 2014-02-19 16:12:03 +0000
41@@ -30,8 +30,8 @@
42 class product_template(osv.osv):
43 _inherit = "product.template"
44 _columns = {
45- 'landing_cost' : fields.boolean('Landing Cost', help="Used if this product is landing cost"),
46- 'landing_cost_calculate' : fields.boolean('Calculate Landing Costs', help="Check this if you want to use landing cost calculation for average price for this product"),
47+ 'landing_cost' : fields.boolean('Landing Cost', help="Used if this product is landing cost"),
48+ 'landing_cost_calculate': fields.boolean('Calculate Landing Costs', help="Check this if you want to use landing cost calculation for average price for this product"),
49 }
50 _defaults = {
51 'landing_cost': False,
52
53=== modified file 'purchase_landing_costs/product_template_view.xml'
54--- purchase_landing_costs/product_template_view.xml 2012-12-11 11:23:50 +0000
55+++ purchase_landing_costs/product_template_view.xml 2014-02-19 16:12:03 +0000
56@@ -8,8 +8,8 @@
57 <field name="arch" type="xml">
58 <field name="price_extra" position="after">
59 <group name="landing_costs" string="Landing Costs">
60- <field name="landing_cost" attrs="{'readonly':[('landing_cost_calculate','=',True)]}"/>
61- <field name="landing_cost_calculate" attrs="{'readonly':[('landing_cost','=',True)]}"/>
62+ <field name="landing_cost"/>
63+ <field name="landing_cost_calculate"/>
64 </group>
65 </field>
66 </field>
67
68=== modified file 'purchase_recalculation/account_invoice.py'
69--- purchase_recalculation/account_invoice.py 2014-01-19 16:54:08 +0000
70+++ purchase_recalculation/account_invoice.py 2014-02-19 16:12:03 +0000
71@@ -49,11 +49,8 @@
72 if len(_stock_move_ids) > 0:
73 _stock_moves = self.pool.get('stock.move').browse(cr, uid, _stock_move_ids, context)
74 for _stock_move in _stock_moves:
75- if not _stock_move._move_check_period(context, _invoice.company_id.id, _invoice.period_id.id):
76- raise osv.except_osv(_('Error!'), _('Invoiced stock moves are not in same period as invoice.'))
77 _quantity = _quantity + _stock_move.product_qty
78 _uom_id = _stock_move.product_uom.id
79-
80
81 if _line.uos_id.id == _uom_id:
82 if _quantity != _line.quantity:
83
84=== modified file 'purchase_recalculation/stock_move.py'
85--- purchase_recalculation/stock_move.py 2013-11-18 10:17:54 +0000
86+++ purchase_recalculation/stock_move.py 2014-02-19 16:12:03 +0000
87@@ -86,19 +86,19 @@
88 'credit': _move.product_qty * _move.price_unit})
89 return True
90
91- def _move_check_period(self, cr, uid, ids, context, company_id, period_id):
92- if context is None:
93- context = {}
94- period_obj = self.pool.get('account.period')
95- ctx = context.copy()
96- ctx.update({'company_id': company_id, 'account_period_prefer_normal': True})
97- _match = True
98- _moves = self.pool.get('stock.move').browse(cr, uid, ids, context)
99- for _move in _moves:
100- _move_period_id = period_obj.find(cr, uid, _move.date, context=ctx)[0]
101- if _move_period_id != period_id:
102- _match = False
103- return _match
104+# def _move_check_period(self, cr, uid, ids, context, company_id, period_id):
105+# if context is None:
106+# context = {}
107+# period_obj = self.pool.get('account.period')
108+# ctx = context.copy()
109+# ctx.update({'company_id': company_id, 'account_period_prefer_normal': True})
110+# _match = True
111+# _moves = self.pool.get('stock.move').browse(cr, uid, ids, context)
112+# for _move in _moves:
113+# _move_period_id = period_obj.find(cr, uid, _move.date, context=ctx)[0]
114+# if _move_period_id != period_id:
115+# _match = False
116+# return _match
117
118 def write(self, cr, uid, ids, vals, context=None):
119 if isinstance(ids, (int, long)):
120
121=== modified file 'sale_order_extensions/__init__.py'
122--- sale_order_extensions/__init__.py 2014-01-12 20:54:03 +0000
123+++ sale_order_extensions/__init__.py 2014-02-19 16:12:03 +0000
124@@ -23,4 +23,5 @@
125 import sale_shop
126 import sale_order
127 import sale_order_line
128-import product_product
129\ No newline at end of file
130+import product_product
131+import res_partner
132\ No newline at end of file
133
134=== modified file 'sale_order_extensions/__openerp__.py'
135--- sale_order_extensions/__openerp__.py 2014-01-12 20:54:03 +0000
136+++ sale_order_extensions/__openerp__.py 2014-02-19 16:12:03 +0000
137@@ -22,7 +22,7 @@
138
139 {
140 'name': 'Sale Order Extensions',
141- 'version': '1.4',
142+ 'version': '1.5',
143 'category': 'Sale',
144 'description': """
145 This module adds following extensions to Sale Order: \n
146@@ -35,10 +35,13 @@
147 - adds field shop_production on shop for filtering shops \n
148 - adds quotations view for quotations from production shop with less fields \n
149 - adds quantity returned on sale order line for automatic product returns \n
150+ - adds sale price functionality on partners and products \n
151 """,
152 'author': 'Mentis d.o.o.',
153 'depends': ['sale_stock'],
154 'data': [
155+ 'product_product_view.xml',
156+ 'res_partner_view.xml',
157 'sale_shop_view.xml',
158 'sale_order_view.xml',
159 'sale_order_workflow.xml'
160
161=== modified file 'sale_order_extensions/i18n/en_US.po'
162--- sale_order_extensions/i18n/en_US.po 2014-01-26 20:34:35 +0000
163+++ sale_order_extensions/i18n/en_US.po 2014-02-19 16:12:03 +0000
164@@ -153,3 +153,19 @@
165 #: model:ir.model,name:sale_order_extensions.model_sale_order_line
166 msgid "Sales Order Line"
167 msgstr ""
168+
169+#. module: sale_order_extensions
170+#: view:product.product:0
171+#: field:res.partner,sale_prices:0
172+msgid "Sale Prices"
173+msgstr ""
174+
175+#. module: sale_order_extensions
176+#: field:product.product,sale_price:0
177+msgid "Sale Price"
178+msgstr ""
179+
180+#. module: sale_order_extensions
181+#: field:product.product,sale_enabled:0
182+msgid "Sale Enabled"
183+msgstr ""
184
185=== modified file 'sale_order_extensions/i18n/sale_order_extensions.pot'
186--- sale_order_extensions/i18n/sale_order_extensions.pot 2014-01-26 20:34:35 +0000
187+++ sale_order_extensions/i18n/sale_order_extensions.pot 2014-02-19 16:12:03 +0000
188@@ -153,3 +153,19 @@
189 #: model:ir.model,name:sale_order_extensions.model_sale_order_line
190 msgid "Sales Order Line"
191 msgstr ""
192+
193+#. module: sale_order_extensions
194+#: view:product.product:0
195+#: field:res.partner,sale_prices:0
196+msgid "Sale Prices"
197+msgstr ""
198+
199+#. module: sale_order_extensions
200+#: field:product.product,sale_price:0
201+msgid "Sale Price"
202+msgstr ""
203+
204+#. module: sale_order_extensions
205+#: field:product.product,sale_enabled:0
206+msgid "Sale Enabled"
207+msgstr ""
208
209=== removed file 'sale_order_extensions/i18n/sl.po'
210--- sale_order_extensions/i18n/sl.po 2014-01-26 20:34:35 +0000
211+++ sale_order_extensions/i18n/sl.po 1970-01-01 00:00:00 +0000
212@@ -1,161 +0,0 @@
213-# Translation of OpenERP Server.
214-# This file contains the translation of the following modules:
215-# * sale_order_extensions
216-#
217-msgid ""
218-msgstr ""
219-"Project-Id-Version: OpenERP Server 7.0\n"
220-"Report-Msgid-Bugs-To: \n"
221-"POT-Creation-Date: 2014-01-21 16:41+0000\n"
222-"PO-Revision-Date: 2014-01-21 16:41+0000\n"
223-"Last-Translator: <>\n"
224-"Language-Team: \n"
225-"MIME-Version: 1.0\n"
226-"Content-Type: text/plain; charset=UTF-8\n"
227-"Content-Transfer-Encoding: \n"
228-"Plural-Forms: \n"
229-
230-#. module: sale_order_extensions
231-#: field:sale.shop,shop_production:0
232-msgid "Production Shop"
233-msgstr "Prodaja iz proizvodnje"
234-
235-#. module: sale_order_extensions
236-#: code:addons/sale_order_extensions/sale_order.py:141
237-#, python-format
238-msgid "Type \"service\" not set on next return products:"
239-msgstr "Izdelki za vračilo, ki niso vrste \"storitev\":"
240-
241-#. module: sale_order_extensions
242-#: model:ir.model,name:sale_order_extensions.model_product_product
243-msgid "Product"
244-msgstr "Izdelek"
245-
246-#. module: sale_order_extensions
247-#: model:ir.model,name:sale_order_extensions.model_sale_order
248-msgid "Sales Order"
249-msgstr "Prodajni nalog"
250-
251-#. module: sale_order_extensions
252-#: view:sale.order:0
253-msgid "Confirm Sale"
254-msgstr "Potrdi prodajo"
255-
256-#. module: sale_order_extensions
257-#: view:sale.order:0
258-msgid "Prepare"
259-msgstr "Pripravi"
260-
261-#. module: sale_order_extensions
262-#: selection:sale.order,state:0
263-msgid "Prepared for Confirm"
264-msgstr "Pripravljeno"
265-
266-#. module: sale_order_extensions
267-#: code:addons/sale_order_extensions/sale_order.py:133
268-#, python-format
269-msgid "Tax not set for next products:"
270-msgstr "Davek ni določen za izdelke:"
271-
272-#. module: sale_order_extensions
273-#: model:ir.actions.act_window,name:sale_order_extensions.action_surplus_quotations
274-#: model:ir.ui.menu,name:sale_order_extensions.menu_sale_surplus_quotations
275-msgid "Quotations - Surplus"
276-msgstr "Ponudbe - Viški"
277-
278-#. module: sale_order_extensions
279-#: model:ir.actions.act_window,name:sale_order_extensions.action_production_quotations
280-#: model:ir.ui.menu,name:sale_order_extensions.menu_sale_production_quotations
281-msgid "Quotations - Production"
282-msgstr "Ponudbe - Proizvodnja"
283-
284-#. module: sale_order_extensions
285-#: model:ir.actions.act_window,name:sale_order_extensions.action_surplus_orders
286-#: model:ir.ui.menu,name:sale_order_extensions.menu_sale_surplus_orders
287-msgid "Sales Orders - Surplus"
288-msgstr "Prodajni nalogi - Viški"
289-
290-#. module: sale_order_extensions
291-#: model:ir.actions.act_window,name:sale_order_extensions.action_production_orders
292-#: model:ir.ui.menu,name:sale_order_extensions.menu_sale_production_orders
293-msgid "Sales Orders - Production"
294-msgstr "Prodajni nalogi - Proizvodnja"
295-
296-#. module: sale_order_extensions
297-#: view:sale.order:0
298-msgid "Sales Order that haven't yet been confirmed"
299-msgstr "Nepotrjeni prodajni nalogi"
300-
301-#. module: sale_order_extensions
302-#: view:sale.order:0
303-msgid "Prepared"
304-msgstr "Pripravljeno"
305-
306-#. module: sale_order_extensions
307-#: code:addons/sale_order_extensions/sale_order.py:120
308-#: code:addons/sale_order_extensions/sale_order.py:128
309-#: code:addons/sale_order_extensions/sale_order.py:136
310-#: code:addons/sale_order_extensions/sale_order.py:144
311-#, python-format
312-msgid "Error!"
313-msgstr "Napaka!"
314-
315-#. module: sale_order_extensions
316-#: model:ir.actions.act_window,help:sale_order_extensions.action_production_quotations
317-#: model:ir.actions.act_window,help:sale_order_extensions.action_surplus_quotations
318-msgid "<p class=\"oe_view_nocontent_create\">\n"
319-" Click to create a quotation, the first step of a new sale.\n"
320-" </p><p>\n"
321-" OpenERP will help you handle efficiently the complete sale flow:\n"
322-" from the quotation to the sales order, the\n"
323-" delivery, the invoicing and the payment collection.\n"
324-" </p><p>\n"
325-" The social feature helps you organize discussions on each sales\n"
326-" order, and allow your customers to keep track of the evolution\n"
327-" of the sales order.\n"
328-" </p>\n"
329-" "
330-msgstr "<p class=\"oe_view_nocontent_create\">\n"
331-" Kliknite za izdelavo nove ponudbe.\n"
332-" </p><p>\n"
333-" OpenERP vam bo pomagal pri celotnem postopku prodaje:\n"
334-" od ponudbe do prodajnega naloga, dostave ter izdaje računa in plačil.\n"
335-" </p><p>\n"
336-" "
337-
338-#. module: sale_order_extensions
339-#: model:ir.model,name:sale_order_extensions.model_sale_shop
340-msgid "Sales Shop"
341-msgstr "Trgovina"
342-
343-#. module: sale_order_extensions
344-#: view:sale.order:0
345-msgid "Set to Draft"
346-msgstr "Vrni v pripravo"
347-
348-#. module: sale_order_extensions
349-#: code:addons/sale_order_extensions/sale_order.py:117
350-#, python-format
351-msgid "Price not set for next products:"
352-msgstr "Cena ni določena za izdelke:"
353-
354-#. module: sale_order_extensions
355-#: view:sale.order:0
356-msgid "context.get('shop_production', False)"
357-msgstr ""
358-
359-#. module: sale_order_extensions
360-#: view:sale.order:0
361-msgid "Quotations"
362-msgstr "Ponudbe"
363-
364-#. module: sale_order_extensions
365-#: code:addons/sale_order_extensions/sale_order.py:125
366-#, python-format
367-msgid "Quantity not set for next products:"
368-msgstr "Količina ni določena za izdelke:"
369-
370-#. module: sale_order_extensions
371-#: model:ir.model,name:sale_order_extensions.model_sale_order_line
372-msgid "Sales Order Line"
373-msgstr "Postavka prodajnega naloga"
374
375=== added file 'sale_order_extensions/i18n/sl_SI.po'
376--- sale_order_extensions/i18n/sl_SI.po 1970-01-01 00:00:00 +0000
377+++ sale_order_extensions/i18n/sl_SI.po 2014-02-19 16:12:03 +0000
378@@ -0,0 +1,177 @@
379+# Translation of OpenERP Server.
380+# This file contains the translation of the following modules:
381+# * sale_order_extensions
382+#
383+msgid ""
384+msgstr ""
385+"Project-Id-Version: OpenERP Server 7.0\n"
386+"Report-Msgid-Bugs-To: \n"
387+"POT-Creation-Date: 2014-01-21 16:41+0000\n"
388+"PO-Revision-Date: 2014-01-21 16:41+0000\n"
389+"Last-Translator: <>\n"
390+"Language-Team: \n"
391+"MIME-Version: 1.0\n"
392+"Content-Type: text/plain; charset=UTF-8\n"
393+"Content-Transfer-Encoding: \n"
394+"Plural-Forms: \n"
395+
396+#. module: sale_order_extensions
397+#: field:sale.shop,shop_production:0
398+msgid "Production Shop"
399+msgstr "Prodaja iz proizvodnje"
400+
401+#. module: sale_order_extensions
402+#: code:addons/sale_order_extensions/sale_order.py:141
403+#, python-format
404+msgid "Type \"service\" not set on next return products:"
405+msgstr "Izdelki za vračilo, ki niso vrste \"storitev\":"
406+
407+#. module: sale_order_extensions
408+#: model:ir.model,name:sale_order_extensions.model_product_product
409+msgid "Product"
410+msgstr "Izdelek"
411+
412+#. module: sale_order_extensions
413+#: model:ir.model,name:sale_order_extensions.model_sale_order
414+msgid "Sales Order"
415+msgstr "Prodajni nalog"
416+
417+#. module: sale_order_extensions
418+#: view:sale.order:0
419+msgid "Confirm Sale"
420+msgstr "Potrdi prodajo"
421+
422+#. module: sale_order_extensions
423+#: view:sale.order:0
424+msgid "Prepare"
425+msgstr "Pripravi"
426+
427+#. module: sale_order_extensions
428+#: selection:sale.order,state:0
429+msgid "Prepared for Confirm"
430+msgstr "Pripravljeno"
431+
432+#. module: sale_order_extensions
433+#: code:addons/sale_order_extensions/sale_order.py:133
434+#, python-format
435+msgid "Tax not set for next products:"
436+msgstr "Davek ni določen za izdelke:"
437+
438+#. module: sale_order_extensions
439+#: model:ir.actions.act_window,name:sale_order_extensions.action_surplus_quotations
440+#: model:ir.ui.menu,name:sale_order_extensions.menu_sale_surplus_quotations
441+msgid "Quotations - Surplus"
442+msgstr "Ponudbe - Viški"
443+
444+#. module: sale_order_extensions
445+#: model:ir.actions.act_window,name:sale_order_extensions.action_production_quotations
446+#: model:ir.ui.menu,name:sale_order_extensions.menu_sale_production_quotations
447+msgid "Quotations - Production"
448+msgstr "Ponudbe - Proizvodnja"
449+
450+#. module: sale_order_extensions
451+#: model:ir.actions.act_window,name:sale_order_extensions.action_surplus_orders
452+#: model:ir.ui.menu,name:sale_order_extensions.menu_sale_surplus_orders
453+msgid "Sales Orders - Surplus"
454+msgstr "Prodajni nalogi - Viški"
455+
456+#. module: sale_order_extensions
457+#: model:ir.actions.act_window,name:sale_order_extensions.action_production_orders
458+#: model:ir.ui.menu,name:sale_order_extensions.menu_sale_production_orders
459+msgid "Sales Orders - Production"
460+msgstr "Prodajni nalogi - Proizvodnja"
461+
462+#. module: sale_order_extensions
463+#: view:sale.order:0
464+msgid "Sales Order that haven't yet been confirmed"
465+msgstr "Nepotrjeni prodajni nalogi"
466+
467+#. module: sale_order_extensions
468+#: view:sale.order:0
469+msgid "Prepared"
470+msgstr "Pripravljeno"
471+
472+#. module: sale_order_extensions
473+#: code:addons/sale_order_extensions/sale_order.py:120
474+#: code:addons/sale_order_extensions/sale_order.py:128
475+#: code:addons/sale_order_extensions/sale_order.py:136
476+#: code:addons/sale_order_extensions/sale_order.py:144
477+#, python-format
478+msgid "Error!"
479+msgstr "Napaka!"
480+
481+#. module: sale_order_extensions
482+#: model:ir.actions.act_window,help:sale_order_extensions.action_production_quotations
483+#: model:ir.actions.act_window,help:sale_order_extensions.action_surplus_quotations
484+msgid "<p class=\"oe_view_nocontent_create\">\n"
485+" Click to create a quotation, the first step of a new sale.\n"
486+" </p><p>\n"
487+" OpenERP will help you handle efficiently the complete sale flow:\n"
488+" from the quotation to the sales order, the\n"
489+" delivery, the invoicing and the payment collection.\n"
490+" </p><p>\n"
491+" The social feature helps you organize discussions on each sales\n"
492+" order, and allow your customers to keep track of the evolution\n"
493+" of the sales order.\n"
494+" </p>\n"
495+" "
496+msgstr "<p class=\"oe_view_nocontent_create\">\n"
497+" Kliknite za izdelavo nove ponudbe.\n"
498+" </p><p>\n"
499+" OpenERP vam bo pomagal pri celotnem postopku prodaje:\n"
500+" od ponudbe do prodajnega naloga, dostave ter izdaje računa in plačil.\n"
501+" </p><p>\n"
502+" "
503+
504+#. module: sale_order_extensions
505+#: model:ir.model,name:sale_order_extensions.model_sale_shop
506+msgid "Sales Shop"
507+msgstr "Trgovina"
508+
509+#. module: sale_order_extensions
510+#: view:sale.order:0
511+msgid "Set to Draft"
512+msgstr "Vrni v pripravo"
513+
514+#. module: sale_order_extensions
515+#: code:addons/sale_order_extensions/sale_order.py:117
516+#, python-format
517+msgid "Price not set for next products:"
518+msgstr "Cena ni določena za izdelke:"
519+
520+#. module: sale_order_extensions
521+#: view:sale.order:0
522+msgid "context.get('shop_production', False)"
523+msgstr ""
524+
525+#. module: sale_order_extensions
526+#: view:sale.order:0
527+msgid "Quotations"
528+msgstr "Ponudbe"
529+
530+#. module: sale_order_extensions
531+#: code:addons/sale_order_extensions/sale_order.py:125
532+#, python-format
533+msgid "Quantity not set for next products:"
534+msgstr "Količina ni določena za izdelke:"
535+
536+#. module: sale_order_extensions
537+#: model:ir.model,name:sale_order_extensions.model_sale_order_line
538+msgid "Sales Order Line"
539+msgstr "Postavka prodajnega naloga"
540+
541+#. module: sale_order_extensions
542+#: view:product.product:0
543+#: field:res.partner,sale_prices:0
544+msgid "Sale Prices"
545+msgstr "Uporaba akcijskih cen"
546+
547+#. module: sale_order_extensions
548+#: field:product.product,sale_price:0
549+msgid "Sale Price"
550+msgstr "Akcijska cena"
551+
552+#. module: sale_order_extensions
553+#: field:product.product,sale_enabled:0
554+msgid "Sale Enabled"
555+msgstr "Akcija omogočena"
556
557=== modified file 'sale_order_extensions/product_product.py'
558--- sale_order_extensions/product_product.py 2014-01-06 20:29:28 +0000
559+++ sale_order_extensions/product_product.py 2014-02-19 16:12:03 +0000
560@@ -24,9 +24,19 @@
561 from openerp import netsvc
562 from tools.translate import _
563 from lxml import etree
564+import decimal_precision as dp
565
566 class product_product(osv.Model):
567 _inherit = 'product.product'
568+
569+ _columns = {
570+ 'sale_enabled': fields.boolean('Sale Enabled'),
571+ 'sale_price' : fields.float('Sale Price', digits_compute=dp.get_precision('Product Price'), ),
572+ }
573+ _defaults = {
574+ 'sale_enabled': False,
575+ 'sale_price': 0.0
576+ }
577
578 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
579 res = super(product_product, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
580
581=== added file 'sale_order_extensions/product_product_view.xml'
582--- sale_order_extensions/product_product_view.xml 1970-01-01 00:00:00 +0000
583+++ sale_order_extensions/product_product_view.xml 2014-02-19 16:12:03 +0000
584@@ -0,0 +1,20 @@
585+<?xml version="1.0" encoding="utf-8"?>
586+<openerp>
587+ <data>
588+
589+ <record id="product_sale_form_view" model="ir.ui.view">
590+ <field name="name">product.sale.form</field>
591+ <field name="model">product.product</field>
592+ <field name="inherit_id" ref="product.product_normal_form_view"/>
593+ <field name="arch" type="xml">
594+ <xpath expr="//page[@string='Sales']" position="inside">
595+ <group string="Sale Prices">
596+ <field name="sale_enabled"/>
597+ <field name="sale_price"/>
598+ </group>
599+ </xpath>
600+ </field>
601+ </record>
602+
603+ </data>
604+</openerp>
605\ No newline at end of file
606
607=== added file 'sale_order_extensions/res_partner.py'
608--- sale_order_extensions/res_partner.py 1970-01-01 00:00:00 +0000
609+++ sale_order_extensions/res_partner.py 2014-02-19 16:12:03 +0000
610@@ -0,0 +1,34 @@
611+# -*- coding: utf-8 -*-
612+##############################################################################
613+#
614+# OpenERP, Open Source Management Solution
615+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>).
616+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
617+#
618+# This program is free software: you can redistribute it and/or modify
619+# it under the terms of the GNU Affero General Public License as
620+# published by the Free Software Foundation, either version 3 of the
621+# License, or (at your option) any later version.
622+#
623+# This program is distributed in the hope that it will be useful,
624+# but WITHOUT ANY WARRANTY; without even the implied warranty of
625+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
626+# GNU Affero General Public License for more details.
627+#
628+# You should have received a copy of the GNU Affero General Public License
629+# along with this program. If not, see <http://www.gnu.org/licenses/>.
630+#
631+##############################################################################
632+
633+from osv import osv, fields
634+from tools.translate import _
635+
636+class res_partner(osv.osv):
637+ _inherit = 'res.partner'
638+
639+ _columns = {
640+ 'sale_prices': fields.boolean('Sale Prices'),
641+ }
642+ _defaults = {
643+ 'sale_prices': True,
644+ }
645\ No newline at end of file
646
647=== added file 'sale_order_extensions/res_partner_view.xml'
648--- sale_order_extensions/res_partner_view.xml 1970-01-01 00:00:00 +0000
649+++ sale_order_extensions/res_partner_view.xml 2014-02-19 16:12:03 +0000
650@@ -0,0 +1,19 @@
651+<?xml version="1.0" encoding="utf-8"?>
652+<openerp>
653+ <data>
654+
655+ <record id="view_partner_sale_form" model="ir.ui.view">
656+ <field name="name">res.partner.sale.form</field>
657+ <field name="model">res.partner</field>
658+ <field name="inherit_id" ref="base.view_partner_form"/>
659+ <field name="arch" type="xml">
660+ <xpath expr="//page[@string='Sales &amp; Purchases']/group" position="inside">
661+ <group>
662+ <field name="sale_prices"/>
663+ </group>
664+ </xpath>
665+ </field>
666+ </record>
667+
668+ </data>
669+</openerp>
670\ No newline at end of file
671
672=== modified file 'sale_order_extensions/sale_order.py'
673--- sale_order_extensions/sale_order.py 2014-01-27 21:03:32 +0000
674+++ sale_order_extensions/sale_order.py 2014-02-19 16:12:03 +0000
675@@ -79,16 +79,27 @@
676 }
677
678 def date_order_change(self, cr, uid, ids, order_lines=False, date_order=False, pricelist=False, partner=False, fiscal_position=False, context=None):
679+ if context is None:
680+ context = {}
681+
682 res = {}
683
684 if date_order:
685 self.pool.get('ir.values').set_default(cr, uid, 'sale.order', 'date_order', date_order, False, True, False)
686
687+ _partner_id = False
688+ if partner:
689+ _partner_id = self.pool.get('res.partner').browse(cr, uid, partner, context)
690+
691 _dp = self.pool.get('decimal.precision').precision_get(cr, uid, 'Product Price')
692-
693 if not ids:
694 for _line in order_lines:
695- if pricelist:
696+ _product_id = self.pool.get('product.product').browse(cr, uid, _line[2]['product_id'], context)
697+ if _product_id and _product_id.sale_enabled \
698+ and _partner_id and _partner_id.sale_prices:
699+ _price = _product_id.sale_price
700+ _line[2]['price_unit'] = round(_price, _dp)
701+ elif pricelist:
702 _price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
703 _line[2]['product_id'], _line[2]['product_uom_qty'] or 1.0, partner, {
704 'uom': _line[2]['product_uom'] or result.get('product_uom'),
705@@ -101,7 +112,12 @@
706 lines = []
707 for _order in self.browse(cr, uid, ids, context):
708 for _line in _order.order_line:
709- if pricelist:
710+ if _line.product_id.sale_enabled and _partner_id.sale_prices:
711+ _price = _line.product_id.sale_price
712+ res = {'price_unit': round(_price, _dp),
713+ 'price_subtotal': False}
714+ lines.append((1, _line.id, res))
715+ elif pricelist:
716 _price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
717 _line.product_id.id, _line.product_uom_qty or 1.0, partner, {
718 'uom': _line.product_uom.id or result.get('product_uom'),
719@@ -177,10 +193,21 @@
720
721 def _get_line_price(self, cr, uid, partner, pricelist, date_order, product, uom, uom_quantity):
722 _dp = self.pool.get('decimal.precision').precision_get(cr, uid, 'Product Price')
723- _price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], product, uom_quantity or 1.0, partner,
724- {'uom': uom or result.get('uom'),
725- 'date': date_order}
726- )[pricelist] or 0.0
727+
728+ _partner_id = False
729+ _product_id = False
730+ if partner and product:
731+ _partner_id = self.pool.get('res.partner').browse(cr, uid, partner, None)
732+ _product_id = self.pool.get('product.product').browse(cr, uid, product, None)
733+
734+ if _product_id and _product_id.sale_enabled \
735+ and _partner_id and _partner_id.sale_prices:
736+ _price = _product_id.sale_price
737+ else:
738+ _price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], product, uom_quantity or 1.0, partner,
739+ {'uom': uom or result.get('uom'),
740+ 'date': date_order}
741+ )[pricelist] or 0.0
742 return _price
743
744 sale_order()

Subscribers

People subscribed via source and target branches