openerp-connector-community team mailing list archive
-
openerp-connector-community team
-
Mailing list archive
-
Message #00443
Re: Cash on delivery
Thanks Guewen
What can I do if i want create a new method? And to be executed. Need some decorator before method?
Enviado desde mi iPhone
> El 12/06/2014, a las 08:36, Guewen Baconnier <guewen.baconnier@xxxxxxxxxxxxxx> escribió:
>
>> On 06/11/2014 06:19 PM, Alberto Garcia wrote:
>> Cash on delivery
>>
>> I want create a module for cash delivery. I have 2 options, inherit
>> _add_cash_on_delivery_line or create a new function.
>>
>> I try both options with not result. I don't knhow why but not used my
>> function.
>>
>> Example function:
>>
>> @magento_myversion
>> class CashDeliverySeur(SaleOrderImportMapper):
>> _model_name = 'magento.sale.oder'
>>
>>
>> def _add_cash_on_delivery_line_seur(self, map_record,values):
>> record = map_record.source
>> amount = float(record.get('i4seur_cashondelivery_surcharge') or
>> 0.0)
>> print "hola*******************"
>> if not amount:
>> return values
>> line_builder =
>> self.get_connector_unit_for_model(MagentoCashOnDeliveryLineBuilder)
>> backend = self.backend_record
>> print "hola*******************"
>> tax_include = self.options.tax_include
>> line_builder.price_unit = amount_incl if tax_include else
>> amount_excl
>> line = (0, 0, line_builder.get_line())
>> values['order_line'].append(line)
>> return values
>
>
> Hi,
>
> According to the name of the method "_add_cash_on_delivery_line_seur"
> there is no chance for it to be executed. It should be
> "_add_cash_on_delivery_line" if you want to override it.
>
> Also, check if you selected the appropriate version in the Magento
> Backend setup.
>
>
> --
> Guewen Baconnier
> Business Solutions Software Developer
>
> Camptocamp SA
> PSE A, CH-1015 Lausanne
> Phone: +41 21 619 10 39
> Office: +41 21 619 10 10
> http://www.camptocamp.com/
Follow ups
References