diff --git a/addons/account/account.py b/addons/account/account.py index 997fe2b3c59..86d7ac16c68 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -179,7 +179,7 @@ class account_account(osv.osv): def __compute(self, cr, uid, ids, field_names, arg, context={}, query=''): #compute the balance/debit/credit accordingly to the value of field_name for the given account ids mapping = { - 'balance': "COALESCE(SUM(l.debit) - SUM(l.credit), 0) as balance ", + 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance ", 'debit': "COALESCE(SUM(l.debit), 0) as debit ", 'credit': "COALESCE(SUM(l.credit), 0) as credit " } diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 60b3d9c2920..c37b1e2b4c8 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -22,6 +22,7 @@ import operator from osv import osv, fields from osv.orm import intersect +import tools.sql from tools.translate import _ @@ -619,7 +620,7 @@ class account_analytic_account_summary_month(osv.osv): } def init(self, cr): - cr.drop_view_if_exists('account_analytic_analysis_summary_month') + tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_month') cr.execute('CREATE VIEW account_analytic_analysis_summary_month AS (' \ 'SELECT ' \ '(TO_NUMBER(TO_CHAR(d.month, \'YYYYMM\'), \'999999\') + (d.account_id * 1000000))::integer AS id, ' \ diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 46924169a37..442405afeed 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -98,7 +98,7 @@ class hr_analytic_timesheet(osv.osv): 'There is no expense account define ' \ 'for this product: "%s" (id:%d)' % \ (r.product_id.name, r.product_id.id,)) - amount = unit_amount * r.product_id.uom_id._compute_price(cr, uid, + amount = unit_amount * self.pool.get('product.uom')._compute_price(cr, uid, r.product_id.uom_id.id, r.product_id.standard_price, False) res ['value']['amount']= - round(amount, 2) res ['value']['general_account_id']= a diff --git a/addons/crm_configuration/report/crm_report.py b/addons/crm_configuration/report/crm_report.py index 772a5c3c7a8..4395973dc17 100644 --- a/addons/crm_configuration/report/crm_report.py +++ b/addons/crm_configuration/report/crm_report.py @@ -21,6 +21,8 @@ ############################################################################## from osv import fields,osv +import tools.sql + AVAILABLE_STATES = [ ('draft','Draft'), ('open','Open'), @@ -47,7 +49,7 @@ class report_crm_case_section_categ2(osv.osv): _order = 'category2_id, section_id' def init(self, cr): - cr.drop_view_if_exists("report_crm_case_section_categ2") + tools.sql.drop_view_if_exists(cr, "report_crm_case_section_categ2") cr.execute(""" create view report_crm_case_section_categ2 as ( select @@ -86,7 +88,7 @@ class report_crm_case_section_stage(osv.osv): _order = 'stage_id, section_id' def init(self, cr): - cr.drop_view_if_exists("report_crm_case_section_stage") + tools.sql.drop_view_if_exists(cr, "report_crm_case_section_stage") cr.execute(""" create view report_crm_case_section_stage as ( select @@ -123,7 +125,7 @@ class report_crm_case_section_categ_stage(osv.osv): _order = 'stage_id, section_id, categ_id' def init(self, cr): - cr.drop_view_if_exists("report_crm_case_section_categ_stage") + tools.sql.drop_view_if_exists(cr, "report_crm_case_section_categ_stage") cr.execute(""" create view report_crm_case_section_categ_stage as ( select @@ -161,7 +163,7 @@ class report_crm_case_section_categ_categ2(osv.osv): _order = 'section_id, categ_id, category2_id' def init(self, cr): - cr.drop_view_if_exists("report_crm_case_section_categ_categ2") + tools.sql.drop_view_if_exists(cr, "report_crm_case_section_categ_categ2") cr.execute(""" create view report_crm_case_section_categ_categ2 as ( select diff --git a/addons/l10n_be/l10n_be_wizard.xml b/addons/l10n_be/l10n_be_wizard.xml index e4b5a6d6fd9..12e38eba2ea 100644 --- a/addons/l10n_be/l10n_be_wizard.xml +++ b/addons/l10n_be/l10n_be_wizard.xml @@ -29,7 +29,7 @@ Generate Chart of Accounts from a Chart Template Generate Chart of Accounts from a Chart Template. You will be asked to pass the name of the company, the chart template to follow, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated. -This is the same wizard that runs from Financial Managament/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. +This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. diff --git a/addons/l10n_chart_uk_minimal/l10n_uk_wizard.xml b/addons/l10n_chart_uk_minimal/l10n_uk_wizard.xml index 2ba2fa7478a..b45012c87be 100644 --- a/addons/l10n_chart_uk_minimal/l10n_uk_wizard.xml +++ b/addons/l10n_chart_uk_minimal/l10n_uk_wizard.xml @@ -5,7 +5,7 @@ Generate Chart of Accounts from a Chart Template Generate Chart of Accounts from a Chart Template. You will be asked to pass the name of the company, the chart template to follow, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated. - This is the same wizard that runs from Financial Managament/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. + This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. open diff --git a/addons/l10n_fr/fr_wizard.xml b/addons/l10n_fr/fr_wizard.xml index b656642deb9..b6468872879 100755 --- a/addons/l10n_fr/fr_wizard.xml +++ b/addons/l10n_fr/fr_wizard.xml @@ -9,7 +9,7 @@ Generate Chart of Accounts from a Chart Template Generate Chart of Accounts from a Chart Template. You will be asked to pass the name of the company, the chart template to follow, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated. -This is the same wizard that runs from Financial Managament/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. +This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. diff --git a/addons/l10n_lu/l10n_lu_wizard.xml b/addons/l10n_lu/l10n_lu_wizard.xml index bb7da6a631f..6987cf931f5 100644 --- a/addons/l10n_lu/l10n_lu_wizard.xml +++ b/addons/l10n_lu/l10n_lu_wizard.xml @@ -5,7 +5,7 @@ Generate Chart of Accounts from a Chart Template Generate Chart of Accounts from a Chart Template. You will be asked to select the company, the chart template, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated. -This is the same wizard that runs from Financial Managament/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. +This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. diff --git a/addons/mrp_repair/report/order.rml b/addons/mrp_repair/report/order.rml index acc6a2aa437..4151811f0ea 100644 --- a/addons/mrp_repair/report/order.rml +++ b/addons/mrp_repair/report/order.rml @@ -67,22 +67,9 @@ - + -<<<<<<< TREE - - - - - - - - - - - -======= @@ -99,7 +86,6 @@ ->>>>>>> MERGE-SOURCE @@ -125,30 +111,7 @@ -<<<<<<< TREE - - - - - - - - - - - - - - - - - - - - - -======= - + @@ -161,7 +124,6 @@ ->>>>>>> MERGE-SOURCE @@ -315,32 +277,17 @@
-<<<<<<< TREE - - Operation Line(s) - -======= Operation Line(s) ->>>>>>> MERGE-SOURCE [[ repeatIn(o.operations,'line') ]]Add [[ ((line.type == 'add') or removeParentNode('para')) and '' ]] Remove [[ ((line.type == 'remove') or removeParentNode('para')) and '' ]] -<<<<<<< TREE - [[ line.name ]] - - - [[ ','.join(map( lambda x: x.name, line.tax_id)) or '0.00' ]] - - - [[ line.product_uom_qty or '0.00' ]] [[ line.product_uom.name ]] -======= [[ line.name ]][[ (line.to_invoice==True) or removeParentNode('tr') ]] @@ -348,7 +295,7 @@ [[ line.product_uom_qty or '0.00' ]] [[ line.product_uom.name ]] ->>>>>>> MERGE-SOURCE + [[ line.price_unit ]] @@ -359,30 +306,11 @@
-<<<<<<< TREE - Fees Line(s) - - - -======= Fees Line(s) ->>>>>>> MERGE-SOURCE -<<<<<<< TREE - [[ repeatIn(o.fees_lines,'fees') ]] - - - [[ fees.name ]] - - - [[ ','.join(map( lambda x: x.name, fees.tax_id)) or '0.00' ]] - - - [[ fees.product_uom_qty or '0.00' ]] [[ fees.product_uom.name ]] -======= [[ repeatIn(o.fees_lines,'fees') ]] @@ -393,7 +321,6 @@ [[ fees.product_uom_qty or '0.00' ]] [[ fees.product_uom.name ]] ->>>>>>> MERGE-SOURCE [[ fees.price_unit ]] @@ -403,92 +330,6 @@ -<<<<<<< TREE - - - - - - - - - - - - - - - - - - - Net Total : - - - [[ o.amount_untaxed or '0.00' ]] - - - [[ o.pricelist_id.currency_id.name ]] - - - - - - - - - - - - - - - - - - - - Taxes: - - - [[ o.amount_tax or '0.00']] - - - [[ o.pricelist_id.currency_id.name ]] - - - - - - - - - - - - - - - - - - - - Total : - - - [[ total(o) ]] - - - [[ o.pricelist_id.currency_id.name ]] - - - - - - - -======= @@ -549,7 +390,6 @@ ->>>>>>> MERGE-SOURCE @@ -559,12 +399,8 @@ -<<<<<<< TREE - -======= ->>>>>>> MERGE-SOURCE \ No newline at end of file diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot index 524c6a4549c..0b548ce2891 100644 --- a/addons/point_of_sale/i18n/point_of_sale.pot +++ b/addons/point_of_sale/i18n/point_of_sale.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0-rc1\n" +"Project-Id-Version: OpenERP Server 5.0.0_rc1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2008-11-28 17:09:36+0000\n" -"PO-Revision-Date: 2008-11-28 17:09:36+0000\n" +"POT-Creation-Date: 2008-12-20 19:51:31+0000\n" +"PO-Revision-Date: 2008-12-20 19:51:31+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -42,11 +42,22 @@ msgstr "" msgid "Discount :" msgstr "" +#. module: point_of_sale +#: wizard_field:pos.payment,ask_pay,payment_nb:0 +#: field:pos.payment,payment_nb:0 +msgid "Piece number" +msgstr "" + #. module: point_of_sale #: field:pos.order,name:0 msgid "Order Description" msgstr "" +#. module: point_of_sale +#: model:ir.actions.wizard,name:point_of_sale.pos_scan_product +msgid "Scan Product" +msgstr "" + #. module: point_of_sale #: rml:pos.invoice:0 msgid "Document" @@ -87,6 +98,11 @@ msgstr "" msgid "Base" msgstr "" +#. module: point_of_sale +#: wizard_view:pos.scan_product,init:0 +msgid "Scan product" +msgstr "" + #. module: point_of_sale #: field:pos.order.line,price_subtotal:0 msgid "Subtotal" @@ -112,6 +128,11 @@ msgstr "" msgid "Ok" msgstr "" +#. module: point_of_sale +#: wizard_view:pos.scan_product,init:0 +msgid "Scan gencod" +msgstr "" + #. module: point_of_sale #: field:pos.order,last_out_picking:0 msgid "Last output picking" @@ -152,6 +173,7 @@ msgid "Number of transaction" msgstr "" #. module: point_of_sale +#: model:ir.actions.act_window,name:point_of_sale.action_pos_order_line #: model:ir.actions.act_window,name:point_of_sale.action_pos_order_line_day msgid "Sale line" msgstr "" @@ -283,6 +305,26 @@ msgstr "" msgid "Sum of subtotals" msgstr "" +#. module: point_of_sale +#: wizard_field:pos.payment,ask_pay,payment_date:0 +#: field:pos.payment,payment_date:0 +msgid "Payment date" +msgstr "" + +#. module: point_of_sale +#: wizard_field:pos.payment,ask_pay,payment_name:0 +#: field:pos.payment,payment_name:0 +msgid "Payment name" +msgstr "" + +#. module: point_of_sale +#: selection:pos.payment,ask_pay,journal:0 +#: selection:pos.config.journal,init,default_journal_rebate:0 +#: selection:pos.config.journal,init,default_journal_gift:0 +#: selection:pos.config.journal,init,default_journal:0 +msgid "x Bank Journal" +msgstr "" + #. module: point_of_sale #: field:pos.order,lines:0 msgid "Order Lines" @@ -457,6 +499,16 @@ msgstr "" msgid "Disc :" msgstr "" +#. module: point_of_sale +#: wizard_field:pos.scan_product,init,gencod:0 +msgid "Gencod" +msgstr "" + +#. module: point_of_sale +#: wizard_button:pos.scan_product,init,add:0 +msgid "Add" +msgstr "" + #. module: point_of_sale #: selection:pos.order,state:0 msgid "Draft" @@ -487,6 +539,14 @@ msgstr "" msgid "E-mail :" msgstr "" +#. module: point_of_sale +#: selection:pos.payment,ask_pay,journal:0 +#: selection:pos.config.journal,init,default_journal_rebate:0 +#: selection:pos.config.journal,init,default_journal_gift:0 +#: selection:pos.config.journal,init,default_journal:0 +msgid "x Checks Journal" +msgstr "" + #. module: point_of_sale #: rml:pos.details_summary:0 #: rml:pos.details:0 @@ -679,6 +739,7 @@ msgstr "" #: wizard_button:pos.payment,ask_pay,end:0 #: wizard_button:pos.refund_order,init,end:0 #: wizard_button:pos.sale.get,init,end:0 +#: wizard_button:pos.scan_product,init,end:0 #: wizard_button:pos.config.journal,init,end:0 #: selection:pos.order,state:0 #: view:pos.order:0 @@ -863,6 +924,12 @@ msgstr "" msgid "Account Entry" msgstr "" +#. module: point_of_sale +#: wizard_field:pos.payment,ask_pay,payment_id:0 +#: field:pos.payment,payment_id:0 +msgid "Payment Term" +msgstr "" + #. module: point_of_sale #: rml:pos.invoice:0 #: wizard_field:pos.payment,ask_pay,amount:0 diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index d3f1e3a9b1b..18f37db8806 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -24,6 +24,7 @@ import time import netsvc from osv import fields, osv from mx import DateTime +from tools.translate import _ class pos_config_journal(osv.osv): @@ -408,18 +409,28 @@ class pos_order(osv.osv): return True - def add_payment(self, cr, uid, order_id, amount, journal, context=None): + def add_payment(self, cr, uid, order_id, data, context=None): """Create a new payment for the order""" order = self.browse(cr, uid, order_id, context) if order.invoice_wanted and not order.partner_id: raise osv.except_osv("Error", "Cannot create invoice without a partner.") - payment_id = self.pool.get('pos.payment').create(cr, uid, { + args = { 'order_id': order_id, - 'journal_id': journal, - 'amount': amount, - }) + 'journal_id': data['journal'], + 'amount': data['amount'], + 'payment_id': data['payment_id'], + } + + if 'payment_date' in data.keys(): + args['payment_date'] = data['payment_date'] + if 'payment_name' in data.keys(): + args['payment_name'] = data['payment_name'] + if 'payment_nb' in data.keys(): + args['payment_nb'] = data['payment_nb'] + + payment_id = self.pool.get('pos.payment').create(cr, uid, args ) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'pos.order', order_id, 'payment', cr) @@ -801,6 +812,52 @@ class pos_order_line(osv.osv): return False return super(pos_order_line, self).write(cr, user, ids, values, context) + def _scan_product(self, cr, uid, ean, qty, order): + # search pricelist_id + pricelist_id = self.pool.get('pos.order').read(cr, uid, [order], ['pricelist_id'] ) + if not pricelist_id: + return False + + new_line = True + + product_id = self.pool.get('product.product').search(cr, uid, [('ean13','=', ean)]) + if not product_id: + return false + + # search price product + product = self.pool.get('product.product').read(cr, uid, product_id) + product_name = product[0]['name'] + price = self.price_by_product(cr, uid, 0, pricelist_id[0]['pricelist_id'][0], product_id[0], 1) + + order_line_ids = self.search(cr, uid, [('name','=',product_name),('order_id','=',order)]) + if order_line_ids: + new_line = False + order_line_id = order_line_ids[0] + qty += self.read(cr, uid, order_line_ids[0], ['qty'])['qty'] + + if new_line: + vals = {'product_id': product_id[0], + 'price_unit': price, + 'qty': qty, + 'name': product_name, + 'order_id': order, + } + line_id = self.create(cr, uid, vals) + if not line_id: + raise wizard.except_wizard(_('Error'), _('Create line failed !')) + else: + vals = { + 'qty': qty, + 'price_unit': price + } + line_id = self.write(cr, uid, order_line_id, vals) + if not line_id: + raise wizard.except_wizard(_('Error'), _('Modify line failed !')) + line_id = order_line_id + + price_line = float(qty)*float(price) + return {'name': product_name, 'product_id': product_id[0], 'price': price, 'price_line': price_line ,'qty': qty } + pos_order_line() @@ -826,11 +883,16 @@ class pos_payment(osv.osv): 'name': fields.char('Description', size=64), 'order_id': fields.many2one('pos.order', 'Order Ref', required=True, ondelete='cascade'), 'journal_id': fields.many2one('account.journal', "Journal", required=True), + 'payment_id': fields.many2one('account.payment.term','Payment Term', select=True), + 'payment_nb': fields.char('Piece number', size=32), + 'payment_name': fields.char('Payment name', size=32), + 'payment_date': fields.date('Payment date', required=True), 'amount': fields.float('Amount', required=True), } _defaults = { 'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'pos.payment'), 'journal_id': _journal_default, + 'payment_date': lambda *a: time.strftime('%Y-%m-%d'), } def create(self, cr, user, vals, context={}): diff --git a/addons/point_of_sale/pos_view.xml b/addons/point_of_sale/pos_view.xml index 4c6510f4abb..68eb8ebf3ed 100644 --- a/addons/point_of_sale/pos_view.xml +++ b/addons/point_of_sale/pos_view.xml @@ -9,6 +9,8 @@
+ + @@ -73,15 +75,16 @@ - + + + + - -