Merge lp:~gbaconnier-c2c/openobject-addons/extra-6.0-c2c-magento-improvements into lp:openobject-addons/extra-6.0

Proposed by Guewen Baconnier @ Camptocamp
Status: Rejected
Rejected by: Guewen Baconnier @ Camptocamp
Proposed branch: lp:~gbaconnier-c2c/openobject-addons/extra-6.0-c2c-magento-improvements
Merge into: lp:openobject-addons/extra-6.0
Diff against target: 70 lines (+20/-1) (has conflicts)
2 files modified
base_sale_multichannels/sale.py (+18/-1)
base_sale_multichannels/sale_view.xml (+2/-0)
Text conflict in base_sale_multichannels/sale.py
To merge this branch: bzr merge lp:~gbaconnier-c2c/openobject-addons/extra-6.0-c2c-magento-improvements
Reviewer Review Type Date Requested Status
OpenERP Committers Pending
Review via email: mp+59336@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

5353. By Guewen Baconnier @ CampToCamp <email address hidden>

[FIX] base_sale_payment_type: returns the good payment's settings when multiple codes match

5351. By Lorenzo Battistini

[FIX] AgileBG authors

5350. By Jordi Esteve (www.zikzakmedia.com)

[IMP+FIX] Internet Domain:
- Domain Report (rml)
- Example webservice or send email expiration
- [FIX] Duplicity emails when run_mail_scheduler
- Redesing wizard osv_memory

5349. By Launchpad Translations on behalf of openerp-commiter

Launchpad automatic translations update.

5348. By Raphaël Valyi - http://www.akretion.com

[FIX] kettle_connector: fixed issue with param replacement

5347. By Lorenzo Battistini

[FIX] product_pricelist_fixed_price translation

5346. By Launchpad Translations on behalf of openerp-commiter

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_sale_multichannels/sale.py'
2--- base_sale_multichannels/sale.py 2011-04-20 11:34:11 +0000
3+++ base_sale_multichannels/sale.py 2011-04-28 09:28:28 +0000
4@@ -289,6 +289,7 @@
5 }
6
7 def payment_code_to_payment_settings(self, cr, uid, payment_code, context=None):
8+<<<<<<< TREE
9 pay_type_obj = self.pool.get('base.sale.payment.type')
10 payment_setting_ids = pay_type_obj.search(cr, uid, [['name', 'like', payment_code]])
11 payment_setting_id = False
12@@ -296,6 +297,18 @@
13 if payment_code in [x.strip() for x in type['name'].split(';')]:
14 payment_setting_id = type['id']
15 return payment_setting_id and pay_type_obj.browse(cr, uid, payment_setting_id, context) or False
16+=======
17+ payment_setting_ids = self.pool.get('base.sale.payment.type').search(cr, uid, [['name', 'ilike', payment_code]])
18+ # it can happens that a payment_code match 2 payment types like: bank and bankcr.
19+ # in such case, we have to search which one is the good one by splitting the payment types and search for the exact match
20+ if len(payment_setting_ids) > 1:
21+ for payment_setting_id in payment_setting_ids[:]:
22+ name = self.pool.get('base.sale.payment.type').read(cr, uid, payment_setting_id, ['name'])['name']
23+ if payment_code.lower() in [exact_payment_name.strip().lower() for exact_payment_name in name.split(';')]:
24+ payment_setting_ids = [payment_setting_id]
25+ break
26+ return payment_setting_ids and self.pool.get('base.sale.payment.type').browse(cr, uid, payment_setting_ids[0], context) or False
27+>>>>>>> MERGE-SOURCE
28
29 def generate_payment_with_pay_code(self, cr, uid, payment_code, partner_id, amount, payment_ref, entry_name, date, paid, context):
30 payment_settings = self.payment_code_to_payment_settings(cr, uid, payment_code, context)
31@@ -341,7 +354,10 @@
32 order = self.browse(cr, uid, order_id, context)
33 payment_settings = self.payment_code_to_payment_settings(cr, uid, order.ext_payment_method, context)
34
35- if payment_settings:
36+ if payment_settings:
37+ if payment_settings.payment_term_id:
38+ self.write(cr, uid, order.id, {'payment_term': payment_settings.payment_term_id.id})
39+
40 if payment_settings.check_if_paid and not paid:
41 if order.state == 'draft' and datetime.strptime(order.date_order, '%Y-%m-%d') < datetime.now() - relativedelta(days=payment_settings.days_before_order_cancel or 30):
42 wf_service.trg_validate(uid, 'sale.order', order.id, 'cancel', cr)
43@@ -444,6 +460,7 @@
44 'check_if_paid': fields.boolean('Check if Paid?'),
45 'days_before_order_cancel': fields.integer('Days Delay before Cancel', help='number of days before an unpaid order will be cancelled at next status update from Magento'),
46 'invoice_date_is_order_date' : fields.boolean('Force Invoice Date?', help="If it's check the invoice date will be the same as the order date"),
47+ 'payment_term_id': fields.many2one('account.payment.term', 'Payment Term'),
48 }
49
50 _defaults = {
51
52=== modified file 'base_sale_multichannels/sale_view.xml'
53--- base_sale_multichannels/sale_view.xml 2011-04-15 20:07:38 +0000
54+++ base_sale_multichannels/sale_view.xml 2011-04-28 09:28:28 +0000
55@@ -97,6 +97,7 @@
56 <field name="picking_policy"/>
57 <field name="order_policy"/>
58 <field name="invoice_quantity"/>
59+ <field name="payment_term_id"/>
60 <separator string="Worflow Option" colspan="4" />
61 <field name="validate_order"/>
62 <field name="validate_picking"/>
63@@ -124,6 +125,7 @@
64 <field name="picking_policy"/>
65 <field name="order_policy"/>
66 <field name="invoice_quantity"/>
67+ <field name="payment_term_id"/>
68 <field name="is_auto_reconcile"/>
69 <field name="validate_order"/>
70 <field name="validate_payment"/>