Ajay Chauhan(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-addons17_purchase-cha into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons17_purchase-cha/+merge/130336
Hello,
I have changed the code to solve the issues of addons17 related to purchase.
Thanks,
Ajay Chauhan
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons17_purchase-cha/+merge/130336
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-addons17_purchase-cha.
=== modified file 'crm/crm_phonecall_menu.xml'
--- crm/crm_phonecall_menu.xml 2012-09-28 12:31:04 +0000
+++ crm/crm_phonecall_menu.xml 2012-10-18 13:07:47 +0000
@@ -2,14 +2,6 @@
<openerp>
<data>
- <act_window
- id="crm_case_categ_phone_create_partner"
- name="Schedule a Call"
- res_model="crm.phonecall"
- view_mode="tree,form,calendar"
- context="{'search_default_partner_id': active_id, 'default_duration': 1.0, 'default_partner_id': active_id}"
- groups="base.group_sale_salesman"
- />
<!-- TO CONFIRM: This is fine -->
<!-- act_window
=== modified file 'crm/res_partner_view.xml'
--- crm/res_partner_view.xml 2012-10-08 14:26:19 +0000
+++ crm/res_partner_view.xml 2012-10-18 13:07:47 +0000
@@ -115,7 +115,7 @@
name="%(base_calendar.action_crm_meeting)d"
context="{'search_default_partner_ids': active_id, 'default_partner_ids' : [active_id]}"/>
<button type="action" string="Calls"
- name="%(crm.crm_case_categ_phone_create_partner)d"
+ name="%(crm.crm_case_categ_phone_incoming0)d"
context="{'search_default_partner_id': active_id, 'default_duration': 1.0}" />
<button type="action" string="Opportunities" attrs="{'invisible': [('customer', '=', False)]}"
name="%(crm.crm_case_category_act_oppor11)d" context="{'search_default_partner_id': active_id}"/>
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py 2012-10-11 14:23:08 +0000
+++ purchase/purchase.py 2012-10-18 13:07:47 +0000
@@ -888,16 +888,7 @@
account_fiscal_position = self.pool.get('account.fiscal.position')
account_tax = self.pool.get('account.tax')
- # - check for the presence of partner_id and pricelist_id
- if not pricelist_id:
- raise osv.except_osv(_('No Pricelist !'), _('Select a price list for a supplier in the purchase form to choose a product.'))
- if not partner_id:
- raise osv.except_osv(_('No Partner!'), _('Select a partner in purchase order to choose a product.'))
-
- # - determine name and notes based on product in partner lang.
- lang = res_partner.browse(cr, uid, partner_id).lang
- context_partner = {'lang': lang, 'partner_id': partner_id}
- product = product_product.browse(cr, uid, product_id, context=context_partner)
+ product = product_product.browse(cr, uid, product_id, context=context)
name = product.name
if product.description_purchase:
name += '\n' + product.description_purchase
@@ -918,11 +909,36 @@
res['value'].update({'product_uom': uom_id})
- # - determine product_qty and date_planned based on seller info
+ qty = qty or 1.0
+
if not date_order:
date_order = fields.date.context_today(self,cr,uid,context=context)
- qty = qty or 1.0
+ dt = datetime.strptime(date_order, DEFAULT_SERVER_DATE_FORMAT).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+ res['value'].update({'date_planned': date_planned or dt, 'product_qty': qty})
+
+ # - determine price_unit and taxes_id
+ price = product.standard_price
+
+ taxes = account_tax.browse(cr, uid, map(lambda x: x.id, product.supplier_taxes_id))
+ fpos = fiscal_position_id and account_fiscal_position.browse(cr, uid, fiscal_position_id, context=context) or False
+ taxes_ids = account_fiscal_position.map_tax(cr, uid, fpos, taxes)
+ res['value'].update({'price_unit': price, 'taxes_id': taxes_ids})
+
+ # - check for the presence of partner_id and pricelist_id
+ if not pricelist_id or not partner_id:
+ return res
+
+ # - determine name and notes based on product in partner lang.
+ lang = res_partner.browse(cr, uid, partner_id).lang
+ context_partner = {'lang': lang, 'partner_id': partner_id}
+ product = product_product.browse(cr, uid, product_id, context=context_partner)
+ name = product.name
+ if product.description_purchase:
+ name += '\n' + product.description_purchase
+ res['value'].update({'name': name})
+
+ # - determine product_qty and date_planned based on seller info
supplierinfo = False
for supplier in product.seller_ids:
if supplier.name.id == partner_id:
@@ -938,14 +954,11 @@
res['value'].update({'date_planned': date_planned or dt, 'product_qty': qty})
- # - determine price_unit and taxes_id
+ # - determine price_unit according to pricelist
price = product_pricelist.price_get(cr, uid, [pricelist_id],
product.id, qty or 1.0, partner_id, {'uom': uom_id, 'date': date_order})[pricelist_id]
- taxes = account_tax.browse(cr, uid, map(lambda x: x.id, product.supplier_taxes_id))
- fpos = fiscal_position_id and account_fiscal_position.browse(cr, uid, fiscal_position_id, context=context) or False
- taxes_ids = account_fiscal_position.map_tax(cr, uid, fpos, taxes)
- res['value'].update({'price_unit': price, 'taxes_id': taxes_ids})
+ res['value'].update({'price_unit': price})
return res
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp