Merge branch 'mig/16.0/connector_opencart' into '16.0-test'

mig/16.0/connector_opencart into 16.0-test

See merge request hibou-io/hibou-odoo/suite!1615
This commit is contained in:
Hibou Bot
2023-03-13 21:06:25 +00:00
5 changed files with 43 additions and 45 deletions

View File

@@ -2,7 +2,7 @@
{
'name': 'Opencart Connector',
'version': '15.0.1.0.0',
'version': '16.0.1.0.0',
'category': 'Connector',
'depends': [
'account',

View File

@@ -100,7 +100,7 @@ class OpencartImporter(AbstractComponent):
binding_model._name, external_id
)
# Or the binding may not have its external_id set if you raise an exception.
self.env['base'].flush()
self.env.flush_all()
return True
if binding_model == 'opencart.product.template' and record.backend_id.so_require_product_setup:
# Though this is not the "right" place to do this,

View File

@@ -177,8 +177,8 @@ class OpencartBackend(models.Model):
return self._date_plus_hours(date, -(self.server_offset_hours or 0))
def _date_plus_hours(self, date, hours):
if date and isinstance(date, str):
date = fields.Datetime.from_string(date)
if not hours:
return date
if isinstance(date, str):
date = fields.Datetime.from_string(date)
return date + timedelta(hours=hours)

View File

@@ -84,6 +84,14 @@ class SaleOrderLine(models.Model):
inverse_name='odoo_id',
string="Opencart Bindings",
)
def _get_display_price(self):
# WARNING do NOT remove the line to read the currency_id
# in 16.0 as of 2023-03-13
# this fixes a res.currency bug on computing price
# the statement has very little effect other than that
self.read(['currency_id'])
return super()._get_display_price()
class SaleOrderAdapter(Component):

View File

@@ -18,15 +18,11 @@
<field name="name" class="oe_inline" />
</h1>
<group name="opencart" string="Opencart Configuration">
<notebook name="api">
<page string="API" name="api">
<group colspan="4" col="4">
<field name="base_url"/>
<field name="restadmin_token" password="1"/>
<field name="server_offset_hours"/>
</group>
</page>
</notebook>
<group colspan="4">
<field name="base_url"/>
<field name="restadmin_token" password="1"/>
<field name="server_offset_hours"/>
</group>
</group>
<group name="main_configuration" string="Main Configuration">
<group name="order_configuration" string="Order Defaults">
@@ -50,38 +46,32 @@
<field name="so_require_product_setup"/>
</group>
</group>
<notebook name="import_config">
<page name="import" string="Imports">
<p class="oe_grey oe_inline">
By clicking on the buttons,
you will initiate the synchronizations
with Opencart.
Note that the import or exports
won't be done directly,
they will create 'Jobs'
executed as soon as possible.
</p>
<p class="oe_grey oe_inline">
Once imported,
some types of records,
like the products or categories,
need a manual review.
You will find the list
of the new records to review
in the menu 'Connectors > Checkpoint'.
</p>
<group name="import_since">
<field name="import_orders_after_date"/>
<field name="import_orders_after_id"/>
<button name="import_sale_orders"
type="object"
class="oe_highlight"
string="Import in background"/>
</group>
</page>
</notebook>
<group name="import_since" string="Imports">
<p class="oe_grey oe_inline" colspan="2">
By clicking on the buttons,
you will initiate the synchronizations
with Opencart.
Note that the import or exports
won't be done directly,
they will create 'Jobs'
executed as soon as possible.
</p>
<p class="oe_grey oe_inline" colspan="2">
Once imported,
some types of records,
like the products or categories,
need a manual review.
You will find the list
of the new records to review
in the menu 'Connectors &gt; Checkpoint'.
</p>
<field name="import_orders_after_date"/>
<field name="import_orders_after_id"/>
<button name="import_sale_orders"
type="object"
class="oe_highlight"
string="Import in background"/>
</group>
</sheet>
</form>
</field>